
5 changed files with 104 additions and 1 deletions
@ -0,0 +1,34 @@ |
|||||
|
include ../../../../../../../Makefile.conf |
||||
|
include ../Makefile.conf |
||||
|
|
||||
|
TEST_UNIT_NAME=jni149 |
||||
|
|
||||
|
JAVA_CLASSES+= \
|
||||
|
TestAlice.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 -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 |
@ -0,0 +1,58 @@ |
|||||
|
package foundation.pEp.jniadapter.test.jni149; |
||||
|
|
||||
|
import foundation.pEp.jniadapter.test.utils.AdapterTestUtils; |
||||
|
import foundation.pEp.jniadapter.test.utils.CTXBase; |
||||
|
import foundation.pEp.pitytest.TestSuite; |
||||
|
import foundation.pEp.pitytest.TestUnit; |
||||
|
import foundation.pEp.pitytest.utils.TestUtils; |
||||
|
|
||||
|
import static foundation.pEp.pitytest.TestLogger.log; |
||||
|
|
||||
|
|
||||
|
/* |
||||
|
JNI-149 - Wrap disable_all_sync_channels into the adapter |
||||
|
|
||||
|
Test: |
||||
|
create 3 identities a,b,c as new own identities using myself() |
||||
|
assert a,b,c are enabled for sync (ident.flags == 0) |
||||
|
call disable_all_sync_channels(); |
||||
|
assert a,b,c, are disabled for sync (ident.flags == 1) |
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
class TestAlice { |
||||
|
public static void main(String[] args) throws Exception { |
||||
|
TestSuite.getDefault().setVerbose(true); |
||||
|
TestSuite.getDefault().setTestColor(TestUtils.TermColor.GREEN); |
||||
|
|
||||
|
new TestUnit<CTXBase>("disable_all_sync_channels()", new CTXBase(), ctx -> { |
||||
|
ctx.alice = ctx.engine.myself(ctx.alice); |
||||
|
ctx.bob = ctx.engine.myself(ctx.bob); |
||||
|
ctx.carol = ctx.engine.myself(ctx.carol); |
||||
|
log(AdapterTestUtils.identityToString(ctx.alice, true)); |
||||
|
log(AdapterTestUtils.identityToString(ctx.bob, true)); |
||||
|
log(AdapterTestUtils.identityToString(ctx.carol, true)); |
||||
|
assert ctx.alice.flags == 0 : ctx.alice.address + ": flags are expected to be 0, but are: " + ctx.alice.flags; |
||||
|
assert ctx.bob.flags == 0 : ctx.bob.address + ": flags are expected to be 0, but are: " + ctx.bob.flags; |
||||
|
assert ctx.carol.flags == 0 : ctx.carol.address + ": flags are expected to be 0, but are: " + ctx.carol.flags; |
||||
|
|
||||
|
// disable_all_sync_channels
|
||||
|
ctx.engine.disable_all_sync_channels(); |
||||
|
|
||||
|
ctx.alice = ctx.engine.myself(ctx.alice); |
||||
|
ctx.bob = ctx.engine.myself(ctx.bob); |
||||
|
ctx.carol = ctx.engine.myself(ctx.carol); |
||||
|
log("\n\n"); |
||||
|
log(AdapterTestUtils.identityToString(ctx.alice, true)); |
||||
|
log(AdapterTestUtils.identityToString(ctx.bob, true)); |
||||
|
log(AdapterTestUtils.identityToString(ctx.carol, true)); |
||||
|
assert ctx.alice.flags == 1 : ctx.alice.address + ": flags are expected to be 1, but are: " + ctx.alice.flags; |
||||
|
assert ctx.bob.flags == 1 : ctx.bob.address + ": flags are expected to be 1, but are: " + ctx.bob.flags; |
||||
|
assert ctx.carol.flags == 1 : ctx.carol.address + ": flags are expected to be 1, but are: " + ctx.carol.flags; |
||||
|
}); |
||||
|
|
||||
|
TestSuite.getDefault().run(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
Loading…
Reference in new issue