diff --git a/test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/Makefile b/test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/Makefile new file mode 100644 index 0000000..526f8b2 --- /dev/null +++ b/test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/Makefile @@ -0,0 +1,50 @@ +include ../../../../../../../Makefile.conf +include ../Makefile.conf + +TEST_UNIT_NAME=templateAliceBobCarol + +JAVA_CLASSES = \ + TestAlice.class \ + TestBob.class \ + TestCarol.class \ + ../utils/AdapterBaseTestContext.class \ + ../utils/AdapterTestUtils.class \ + ../utils/TestCallbacks.class + +JAVA_CLASSES += $(JAVA_CLASSES_FRAMEWORK) + +.PHONY: compile alice bob carol test clean + +all: alice compile + +alice: compile clean-pep-home-alice + cd $(JAVA_CWD);pwd;HOME=$(JAVA_PEP_HOME_DIR_ALICE) $(JAVA) $(JAVA_PKG_BASENAME).$(TEST_UNIT_NAME).TestAlice + +bob: compile clean-pep-home-bob + cd $(JAVA_CWD);pwd;HOME=$(JAVA_PEP_HOME_DIR_BOB) $(JAVA) $(JAVA_PKG_BASENAME).$(TEST_UNIT_NAME).TestBob + +carol: compile clean-pep-home-carol + cd $(JAVA_CWD);pwd;HOME=$(JAVA_PEP_HOME_DIR_CAROL) $(JAVA) $(JAVA_PKG_BASENAME).$(TEST_UNIT_NAME).TestCarol + +compile: $(JAVA_CLASSES) + +%.class: %.java + cd $(JAVA_CWD);javac -cp $(CLASSPATH) $(JAVA_PKG_BASEPATH)/$(TEST_UNIT_NAME)/$< + +clean: + rm -f $(JAVA_CLASSES) + rm -f *.class + rm -f *.log + rm -Rf .gnupg + rm -Rf .lldb + +clean-pep-home: clean-pep-home-alice clean-pep-home-bob clean-pep-home-carol + +clean-pep-home-alice: + rm -rf $(PEP_HOME_DIR_ALICE)/.pEp + +clean-pep-home-bob: + rm -rf $(PEP_HOME_DIR_BOB)/.pEp + +clean-pep-home-carol: + rm -rf $(PEP_HOME_DIR_CAROL)/.pEp \ No newline at end of file diff --git a/test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/TestAlice.java b/test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/TestAlice.java new file mode 100644 index 0000000..3d2069f --- /dev/null +++ b/test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/TestAlice.java @@ -0,0 +1,32 @@ +package foundation.pEp.jniadapter.test.templateAliceBobCarol; +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/templateAliceBobCarol/TestBob.java b/test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/TestBob.java new file mode 100644 index 0000000..3840ec2 --- /dev/null +++ b/test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/TestBob.java @@ -0,0 +1,32 @@ +package foundation.pEp.jniadapter.test.templateAliceBobCarol; +import static foundation.pEp.jniadapter.test.framework.TestLogger.*; +import foundation.pEp.jniadapter.test.framework.*; +import foundation.pEp.jniadapter.test.utils.*; + +class TestBob { + public static void main(String[] args) throws Exception { + TestSuite.setVerbose(true); + TestSuite.setTestColor(TestUtils.TermColor.YELLOW); + + new TestUnit("Test Bob",new AdapterBaseTestContext() , ctx -> { + // do stuff using the context + // Test FAILS on unhandled exception, otherwise SUCCESS + + ctx.bob = ctx.engine.myself(ctx.bob); + + if(ctx.bob.fpr == null) { + throw new RuntimeException(); + } + + for(int i=0; i < 1000; i++ ) { + log("Bob is waiting..."); + TestUtils.sleep(1000); + } + + }).add(); + + TestSuite.run(); + } +} + + diff --git a/test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/TestCarol.java b/test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/TestCarol.java new file mode 100644 index 0000000..411bc8e --- /dev/null +++ b/test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/TestCarol.java @@ -0,0 +1,32 @@ +package foundation.pEp.jniadapter.test.templateAliceBobCarol; +import static foundation.pEp.jniadapter.test.framework.TestLogger.*; +import foundation.pEp.jniadapter.test.framework.*; +import foundation.pEp.jniadapter.test.utils.*; + +class TestCarol { + public static void main(String[] args) throws Exception { + TestSuite.setVerbose(true); + TestSuite.setTestColor(TestUtils.TermColor.RED); + + new TestUnit("Test Carol",new AdapterBaseTestContext() , ctx -> { + // do stuff using the context + // Test FAILS on unhandled exception, otherwise SUCCESS + +// ctx.carol = ctx.engine.myself(ctx.carol); + +// if(ctx.carol.fpr == null) { +// throw new RuntimeException(); +// } + + for(int i=0; i < 1000; i++ ) { + log("Carol is waiting..."); + TestUtils.sleep(1000); + } + + }).add(); + + TestSuite.run(); + } +} + +