From 35861db3b77d52f5bc3c548fe734288ffa527961 Mon Sep 17 00:00:00 2001 From: heck Date: Sun, 13 Sep 2020 23:12:57 +0200 Subject: [PATCH] Tests: Add JNI-119 - enter_device_group() --- .../pEp/jniadapter/test/jni119/Makefile | 37 +++++++++++++++++++ .../pEp/jniadapter/test/jni119/TestAlice.java | 37 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 test/java/foundation/pEp/jniadapter/test/jni119/Makefile create mode 100644 test/java/foundation/pEp/jniadapter/test/jni119/TestAlice.java diff --git a/test/java/foundation/pEp/jniadapter/test/jni119/Makefile b/test/java/foundation/pEp/jniadapter/test/jni119/Makefile new file mode 100644 index 0000000..329571b --- /dev/null +++ b/test/java/foundation/pEp/jniadapter/test/jni119/Makefile @@ -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 diff --git a/test/java/foundation/pEp/jniadapter/test/jni119/TestAlice.java b/test/java/foundation/pEp/jniadapter/test/jni119/TestAlice.java new file mode 100644 index 0000000..304732b --- /dev/null +++ b/test/java/foundation/pEp/jniadapter/test/jni119/TestAlice.java @@ -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("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()); + }); + + new TestUnit("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 grpIdents = new Vector(); + grpIdents.add(ctx.alice); + grpIdents.add(ctx.bob); + + ctx.engine.enter_device_group(grpIdents); + }); + + TestSuite.getDefault().run(); + } +} + +