Browse Source

add Test template templateAliceBobCarol

JNI-96
heck 5 years ago
parent
commit
e0a511d1fd
  1. 50
      test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/Makefile
  2. 32
      test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/TestAlice.java
  3. 32
      test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/TestBob.java
  4. 32
      test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/TestCarol.java

50
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

32
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<AdapterBaseTestContext>("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();
}
}

32
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<AdapterBaseTestContext>("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();
}
}

32
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<AdapterBaseTestContext>("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();
}
}
Loading…
Cancel
Save