Browse Source

add Test template templateAlice

JNI-96
heck 5 years ago
parent
commit
433e1a0097
  1. 23
      test/java/foundation/pEp/jniadapter/test/templateAlice/Makefile
  2. 32
      test/java/foundation/pEp/jniadapter/test/templateAlice/TestAlice.java
  3. 21
      test/java/foundation/pEp/jniadapter/test/templateAlice/TestMain.java

23
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
clean-pep-home: clean-pep-home-alice
clean-pep-home-alice:
rm -rf $(PEP_HOME_DIR_ALICE)/.pEp

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

21
test/java/foundation/pEp/jniadapter/test/templateAlice/TestMain.java

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