From 433e1a0097dd22658b9838b8f3b0f75dcc254895 Mon Sep 17 00:00:00 2001 From: heck Date: Thu, 28 May 2020 23:34:02 +0200 Subject: [PATCH] add Test template templateAlice --- .../jniadapter/test/templateAlice/Makefile | 23 +++++++------ .../test/templateAlice/TestAlice.java | 32 +++++++++++++++++++ .../test/templateAlice/TestMain.java | 21 ------------ 3 files changed, 45 insertions(+), 31 deletions(-) create mode 100644 test/java/foundation/pEp/jniadapter/test/templateAlice/TestAlice.java delete mode 100644 test/java/foundation/pEp/jniadapter/test/templateAlice/TestMain.java diff --git a/test/java/foundation/pEp/jniadapter/test/templateAlice/Makefile b/test/java/foundation/pEp/jniadapter/test/templateAlice/Makefile index c02d07f..1ba568d 100644 --- a/test/java/foundation/pEp/jniadapter/test/templateAlice/Makefile +++ b/test/java/foundation/pEp/jniadapter/test/templateAlice/Makefile @@ -1,20 +1,22 @@ include ../../../../../../../Makefile.conf include ../Makefile.conf -TEST_UNIT_NAME=templateAlice +TEST_UNIT_NAME=templateAliceBob JAVA_CLASSES = \ - TestMain.class + TestAlice.class \ + ../utils/AdapterBaseTestContext.class \ + ../utils/AdapterTestUtils.class \ + ../utils/TestCallbacks.class JAVA_CLASSES += $(JAVA_CLASSES_FRAMEWORK) -.PHONY: compile run test clean +.PHONY: compile alice test clean -all: compile - $(MAKE) run +all: alice compile -run: compile clean-pep-home - cd $(JAVA_CWD);pwd;HOME=$(JAVA_PEP_HOME_DIR) $(JAVA) $(JAVA_PKG_BASENAME).$(TEST_UNIT_NAME).TestMain +alice: compile clean-pep-home-alice + cd $(JAVA_CWD);pwd;HOME=$(JAVA_PEP_HOME_DIR_ALICE) $(JAVA) $(JAVA_PKG_BASENAME).$(TEST_UNIT_NAME).TestAlice compile: $(JAVA_CLASSES) @@ -28,6 +30,7 @@ clean: rm -Rf .gnupg rm -Rf .lldb -clean-pep-home: - rm -rf $(PEP_HOME_DIR)/* - rm -rf $(PEP_HOME_DIR)/.pEp \ No newline at end of file +clean-pep-home: clean-pep-home-alice + +clean-pep-home-alice: + rm -rf $(PEP_HOME_DIR_ALICE)/.pEp diff --git a/test/java/foundation/pEp/jniadapter/test/templateAlice/TestAlice.java b/test/java/foundation/pEp/jniadapter/test/templateAlice/TestAlice.java new file mode 100644 index 0000000..31b5ce2 --- /dev/null +++ b/test/java/foundation/pEp/jniadapter/test/templateAlice/TestAlice.java @@ -0,0 +1,32 @@ +package foundation.pEp.jniadapter.test.templateAlice; +import static foundation.pEp.jniadapter.test.framework.TestLogger.*; +import foundation.pEp.jniadapter.test.framework.*; +import foundation.pEp.jniadapter.test.utils.*; + +class TestAlice { + public static void main(String[] args) throws Exception { + TestSuite.setVerbose(true); + TestSuite.setTestColor(TestUtils.TermColor.GREEN); + + new TestUnit("Test Alice",new AdapterBaseTestContext() , ctx -> { + // do stuff using the context + // Test FAILS on unhandled exception, otherwise SUCCESS + + ctx.alice = ctx.engine.myself(ctx.alice); + + if(ctx.alice.fpr == null) { + throw new RuntimeException(); + } + + for(int i=0; i < 1000; i++ ) { + log("Alice is waiting..."); + TestUtils.sleep(1000); + } + + }).add(); + + TestSuite.run(); + } +} + + diff --git a/test/java/foundation/pEp/jniadapter/test/templateAlice/TestMain.java b/test/java/foundation/pEp/jniadapter/test/templateAlice/TestMain.java deleted file mode 100644 index 0a8a847..0000000 --- a/test/java/foundation/pEp/jniadapter/test/templateAlice/TestMain.java +++ /dev/null @@ -1,21 +0,0 @@ -package foundation.pEp.jniadapter.test.templateAlice; -import foundation.pEp.jniadapter.test.framework.*; -import foundation.pEp.jniadapter.test.utils.AdapterBaseTestContext; - - -class TestMain { - public static void main(String[] args) throws Exception { - new TestUnit("Test Template",new AdapterBaseTestContext() , ctx -> { - // do stuff using the context - // Test FAILS on unhandled exception, otherwise SUCCESS - - ctx.alice = ctx.engine.myself(ctx.alice); - - if(ctx.alice.fpr == null) { - throw new RuntimeException(); - } - }).run(); - } -} - -