Browse Source

Tests: Add JNI-119 - enter_device_group()

JNI-119
heck 2 years ago
parent
commit
35861db3b7
2 changed files with 74 additions and 0 deletions
  1. +37
    -0
      test/java/foundation/pEp/jniadapter/test/jni119/Makefile
  2. +37
    -0
      test/java/foundation/pEp/jniadapter/test/jni119/TestAlice.java

+ 37
- 0
test/java/foundation/pEp/jniadapter/test/jni119/Makefile View File

@ -0,0 +1,37 @@
include ../../../../../../../Makefile.conf
include ../Makefile.conf
TEST_UNIT_NAME=jni119
JAVA_CLASSES = \
TestAlice.class \
../utils/AdapterBaseTestContext.class \
../utils/AdapterTestUtils.class \
../utils/TestCallbacks.class
.PHONY: pitytest compile alice test clean
all: alice compile
pitytest:
$(MAKE) -C $(PITYTEST_DIR)
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) pitytest
%.class: %.java
cd $(JAVA_CWD);$(JAVAC_CMD) -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-alice:
rm -rf $(PEP_HOME_DIR_ALICE)/.pEp

+ 37
- 0
test/java/foundation/pEp/jniadapter/test/jni119/TestAlice.java View File

@ -0,0 +1,37 @@
package foundation.pEp.jniadapter.test.jni119;
import foundation.pEp.jniadapter.Identity;
import foundation.pEp.jniadapter.test.utils.AdapterBaseTestContext;
import foundation.pEp.pitytest.TestSuite;
import foundation.pEp.pitytest.TestUnit;
import foundation.pEp.pitytest.utils.TestUtils;
import java.util.Vector;
class TestAlice {
public static void main(String[] args) throws Throwable {
TestSuite.getDefault().setVerbose(true);
TestSuite.getDefault().setTestColor(TestUtils.TermColor.GREEN);
new TestUnit<AdapterBaseTestContext>("enter_device_group() no exception with no identities", new AdapterBaseTestContext(), ctx -> {
ctx.alice = ctx.engine.myself(ctx.alice);
ctx.engine.enter_device_group(new Vector<Identity>());
});
new TestUnit<AdapterBaseTestContext>("enter_device_group() no exception with 2 identities", new AdapterBaseTestContext(), ctx -> {
ctx.alice = ctx.engine.myself(ctx.alice);
ctx.bob = ctx.engine.myself(ctx.bob);
Vector<Identity> grpIdents = new Vector<Identity>();
grpIdents.add(ctx.alice);
grpIdents.add(ctx.bob);
ctx.engine.enter_device_group(grpIdents);
});
TestSuite.getDefault().run();
}
}

Loading…
Cancel
Save