Browse Source

Tests: Rename AdapterBaseTestContext to CTXBase / Makefiles collect Utils classes themselves now in Makefile.conf

JNI-147
heck 1 year ago
parent
commit
f0f201adc7
56 changed files with 192 additions and 246 deletions
  1. +4
    -0
      test/java/foundation/pEp/jniadapter/test/Makefile.conf
  2. +1
    -5
      test/java/foundation/pEp/jniadapter/test/basic/Makefile
  3. +2
    -2
      test/java/foundation/pEp/jniadapter/test/basic/TestMain.java
  4. +2
    -4
      test/java/foundation/pEp/jniadapter/test/jni100/Makefile
  5. +1
    -1
      test/java/foundation/pEp/jniadapter/test/jni100/TestMain.java
  6. +2
    -5
      test/java/foundation/pEp/jniadapter/test/jni111/Makefile
  7. +10
    -10
      test/java/foundation/pEp/jniadapter/test/jni111/TestAlice.java
  8. +2
    -5
      test/java/foundation/pEp/jniadapter/test/jni114/Makefile
  9. +4
    -4
      test/java/foundation/pEp/jniadapter/test/jni114/TestAlice.java
  10. +2
    -5
      test/java/foundation/pEp/jniadapter/test/jni115/Makefile
  11. +2
    -2
      test/java/foundation/pEp/jniadapter/test/jni115/TestAlice.java
  12. +2
    -5
      test/java/foundation/pEp/jniadapter/test/jni117/Makefile
  13. +2
    -2
      test/java/foundation/pEp/jniadapter/test/jni117/TestAlice.java
  14. +2
    -5
      test/java/foundation/pEp/jniadapter/test/jni118/Makefile
  15. +1
    -1
      test/java/foundation/pEp/jniadapter/test/jni118/TestAlice.java
  16. +2
    -5
      test/java/foundation/pEp/jniadapter/test/jni119/Makefile
  17. +3
    -3
      test/java/foundation/pEp/jniadapter/test/jni119/TestAlice.java
  18. +2
    -5
      test/java/foundation/pEp/jniadapter/test/jni125/Makefile
  19. +3
    -3
      test/java/foundation/pEp/jniadapter/test/jni125/TestAlice.java
  20. +2
    -5
      test/java/foundation/pEp/jniadapter/test/jni126/Makefile
  21. +5
    -5
      test/java/foundation/pEp/jniadapter/test/jni126/TestAlice.java
  22. +2
    -5
      test/java/foundation/pEp/jniadapter/test/jni134/Makefile
  23. +26
    -26
      test/java/foundation/pEp/jniadapter/test/jni134/TestAlice.java
  24. +2
    -5
      test/java/foundation/pEp/jniadapter/test/jni135/Makefile
  25. +5
    -5
      test/java/foundation/pEp/jniadapter/test/jni135/TestAlice.java
  26. +2
    -6
      test/java/foundation/pEp/jniadapter/test/jni143/Makefile
  27. +5
    -5
      test/java/foundation/pEp/jniadapter/test/jni143/TestAlice.java
  28. +1
    -2
      test/java/foundation/pEp/jniadapter/test/jni88/Makefile
  29. +1
    -2
      test/java/foundation/pEp/jniadapter/test/jni91/Makefile
  30. +2
    -3
      test/java/foundation/pEp/jniadapter/test/jni92/Makefile
  31. +2
    -2
      test/java/foundation/pEp/jniadapter/test/jni94/Makefile
  32. +2
    -2
      test/java/foundation/pEp/jniadapter/test/jni94/TestMain.java
  33. +2
    -5
      test/java/foundation/pEp/jniadapter/test/jni96/Makefile
  34. +5
    -6
      test/java/foundation/pEp/jniadapter/test/jni96/TestAlice.java
  35. +2
    -3
      test/java/foundation/pEp/jniadapter/test/jni98/Makefile
  36. +3
    -3
      test/java/foundation/pEp/jniadapter/test/jni98/TestMain.java
  37. +2
    -3
      test/java/foundation/pEp/jniadapter/test/regression/Makefile
  38. +42
    -42
      test/java/foundation/pEp/jniadapter/test/regression/TestMain.java
  39. +1
    -1
      test/java/foundation/pEp/jniadapter/test/speedtest/Makefile
  40. +2
    -5
      test/java/foundation/pEp/jniadapter/test/templateAlice/Makefile
  41. +1
    -1
      test/java/foundation/pEp/jniadapter/test/templateAlice/TestAlice.java
  42. +2
    -5
      test/java/foundation/pEp/jniadapter/test/templateAliceBob/Makefile
  43. +2
    -5
      test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/Makefile
  44. +1
    -1
      test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/TestAlice.java
  45. +1
    -1
      test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/TestBob.java
  46. +1
    -1
      test/java/foundation/pEp/jniadapter/test/templateAliceBobCarol/TestCarol.java
  47. +3
    -3
      test/java/foundation/pEp/jniadapter/test/utils/CTXBase.java
  48. +2
    -2
      test/java/foundation/pEp/jniadapter/test/utils/transport/fsmqmanager/test/identities/Makefile
  49. +1
    -1
      test/java/foundation/pEp/jniadapter/test/utils/transport/fsmqmanager/test/stateless_ping/Makefile
  50. +2
    -2
      test/java/foundation/pEp/jniadapter/test/utils/transport/fsmqmanager/test/stateless_rxtx/Makefile
  51. +2
    -2
      test/java/foundation/pEp/jniadapter/test/utils/transport/fsmsgqueue/test/regression/Makefile
  52. +1
    -1
      test/java/foundation/pEp/pitytest/Makefile
  53. +2
    -2
      test/java/foundation/pEp/pitytest/examples/ctxinitfail/Makefile
  54. +2
    -2
      test/java/foundation/pEp/pitytest/examples/ctxmembers/Makefile
  55. +2
    -2
      test/java/foundation/pEp/pitytest/examples/helloworld/Makefile
  56. +2
    -2
      test/java/foundation/pEp/pitytest/examples/testsuite/Makefile

+ 4
- 0
test/java/foundation/pEp/jniadapter/test/Makefile.conf View File

@ -28,6 +28,10 @@ JAVA_OPT_LIBARY_PATH=-Djava.library.path=$(LD_LIB_PATH)
JAVA_OPTS=$(JAVA_OPT_ASSERTIONS) $(JAVA_OPT_XCHECK) $(JAVA_OPT_REMOTE_DEBUGGER) $(JAVA_OPT_CLASSPATH) $(JAVA_OPT_LIBARY_PATH)
JAVA=java $(JAVA_OPTS)
UTIL_SOURCES=$(wildcard ../utils/*.java)
UTIL_CLASSES=$(subst .java,.class,$(UTIL_SOURCES))
JAVA_CLASSES+=$(UTIL_CLASSES)
PITYTEST_DIR=../../../pitytest
ifdef ENGINE_LIB_PATH


+ 1
- 5
test/java/foundation/pEp/jniadapter/test/basic/Makefile View File

@ -3,11 +3,7 @@ include ../Makefile.conf
TEST_UNIT_NAME=basic
JAVA_CLASSES = \
TestMain.class \
../utils/AdapterBaseTestContext.class \
../utils/AdapterTestUtils.class \
../utils/TestCallbacks.class
JAVA_CLASSES+=TestMain.class
.PHONY: pitytest compile run test clean


+ 2
- 2
test/java/foundation/pEp/jniadapter/test/basic/TestMain.java View File

@ -3,7 +3,7 @@ package foundation.pEp.jniadapter.test.basic;
import foundation.pEp.jniadapter.Identity;
import foundation.pEp.jniadapter.Message;
import foundation.pEp.jniadapter.decrypt_message_Return;
import foundation.pEp.jniadapter.test.utils.AdapterBaseTestContext;
import foundation.pEp.jniadapter.test.utils.CTXBase;
import foundation.pEp.jniadapter.test.utils.AdapterTestUtils;
import foundation.pEp.pitytest.TestSuite;
import foundation.pEp.pitytest.TestUnit;
@ -12,7 +12,7 @@ import java.util.Vector;
import static foundation.pEp.pitytest.TestLogger.log;
class BasicTestContext extends AdapterBaseTestContext {
class BasicTestContext extends CTXBase {
Message enc;
decrypt_message_Return result;


+ 2
- 4
test/java/foundation/pEp/jniadapter/test/jni100/Makefile View File

@ -3,10 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni100
JAVA_CLASSES = \
TestMain.class \
../utils/AdapterTestUtils.class \
../utils/TestCallbacks.class
JAVA_CLASSES+= \
TestMain.class
.PHONY: pitytest compile run test clean


+ 1
- 1
test/java/foundation/pEp/jniadapter/test/jni100/TestMain.java View File

@ -8,7 +8,7 @@ import java.util.Vector;
class TestMain {
public static void main(String[] args) throws Exception {
new TestUnit<AdapterBaseTestContext>("JNI-100",new AdapterBaseTestContext() , ctx -> {
new TestUnit<CTXBase>("JNI-100",new CTXBase() , ctx -> {
TestCallbacks cb = new TestCallbacks();
ctx.engine.setMessageToSendCallback(cb);


+ 2
- 5
test/java/foundation/pEp/jniadapter/test/jni111/Makefile View File

@ -3,11 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni111
JAVA_CLASSES = \
TestAlice.class \
../utils/AdapterBaseTestContext.class \
../utils/AdapterTestUtils.class \
../utils/TestCallbacks.class
JAVA_CLASSES+= \
TestAlice.class
.PHONY: pitytest compile alice test clean


+ 10
- 10
test/java/foundation/pEp/jniadapter/test/jni111/TestAlice.java View File

@ -5,7 +5,7 @@ import foundation.pEp.jniadapter.Message;
import foundation.pEp.jniadapter.exceptions.pEpException;
import foundation.pEp.jniadapter.exceptions.pEpPassphraseRequired;
import foundation.pEp.jniadapter.exceptions.pEpWrongPassphrase;
import foundation.pEp.jniadapter.test.utils.AdapterBaseTestContext;
import foundation.pEp.jniadapter.test.utils.CTXBase;
import foundation.pEp.jniadapter.test.utils.AdapterTestUtils;
import foundation.pEp.pitytest.TestSuite;
import foundation.pEp.pitytest.TestUnit;
@ -18,7 +18,7 @@ import static foundation.pEp.pitytest.TestLogger.log;
// https://pep.foundation/jira/browse/JNI-111
class JNI111TestContext extends AdapterBaseTestContext {
class JNI111TestContext extends CTXBase {
@Override
public JNI111TestContext init() throws Throwable {
super.init();
@ -34,16 +34,16 @@ class TestAlice {
TestSuite.getDefault().setVerbose(false);
TestSuite.getDefault().setTestColor(TestUtils.TermColor.GREEN);
AdapterBaseTestContext jni111Ctx = new JNI111TestContext();
CTXBase jni111Ctx = new JNI111TestContext();
new TestUnit<AdapterBaseTestContext>("importKey()", jni111Ctx, ctx -> {
new TestUnit<CTXBase>("importKey()", jni111Ctx, ctx -> {
assert ctx.alice == null: "Alice is not null";
ctx.alice = ctx.engine.importKey(ctx.keyAliceSecPassphrase).get(0);
log(AdapterTestUtils.identityToString(ctx.alice, true));
assert ctx.alice != null: "Keyimport failed";
});
new TestUnit<AdapterBaseTestContext>("setOwnKey()", jni111Ctx, ctx -> {
new TestUnit<CTXBase>("setOwnKey()", jni111Ctx, ctx -> {
ctx.alice.user_id = "23";
ctx.alice = ctx.engine.setOwnKey(ctx.alice, ctx.alice.fpr);
log(AdapterTestUtils.identityToString(ctx.alice, true));
@ -51,7 +51,7 @@ class TestAlice {
assert ctx.alice.comm_type == CommType.PEP_ct_pEp;
});
new TestUnit<AdapterBaseTestContext>("encrypt_message() -> pEpPassphraseRequired ", jni111Ctx, ctx -> {
new TestUnit<CTXBase>("encrypt_message() -> pEpPassphraseRequired ", jni111Ctx, ctx -> {
try {
Message enc = ctx.engine.encrypt_message(ctx.msgAliceToAlice, new Vector<>(), Message.EncFormat.PEP);
} catch (pEpException e) {
@ -61,11 +61,11 @@ class TestAlice {
assert false:"encrypt_message() should have failed";
});
new TestUnit<AdapterBaseTestContext>("config_passphrase() wrong", jni111Ctx, ctx -> {
new TestUnit<CTXBase>("config_passphrase() wrong", jni111Ctx, ctx -> {
ctx.engine.config_passphrase("WRONG PASSPHRASE");
});
new TestUnit<AdapterBaseTestContext>("encrypt_message() -> pEpWrongPassphrase ", jni111Ctx, ctx -> {
new TestUnit<CTXBase>("encrypt_message() -> pEpWrongPassphrase ", jni111Ctx, ctx -> {
try {
Message enc = ctx.engine.encrypt_message(ctx.msgAliceToAlice, new Vector<>(), Message.EncFormat.PEP);
} catch (pEpException e) {
@ -75,11 +75,11 @@ class TestAlice {
assert false:"encrypt_message() should have failed";
});
new TestUnit<AdapterBaseTestContext>("config_passphrase() correct", jni111Ctx, ctx -> {
new TestUnit<CTXBase>("config_passphrase() correct", jni111Ctx, ctx -> {
ctx.engine.config_passphrase("passphrase_alice");
});
new TestUnit<AdapterBaseTestContext>("encrypt_message() -> success", jni111Ctx, ctx -> {
new TestUnit<CTXBase>("encrypt_message() -> success", jni111Ctx, ctx -> {
assert ctx.msgAliceToAlice.getEncFormat() == Message.EncFormat.None : "Orig msg not plain";
Message enc = ctx.engine.encrypt_message(ctx.msgAliceToAlice, new Vector<>(), Message.EncFormat.PEP);
assert enc.getEncFormat() == Message.EncFormat.PGPMIME :"Message not encrypted";


+ 2
- 5
test/java/foundation/pEp/jniadapter/test/jni114/Makefile View File

@ -3,11 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni114
JAVA_CLASSES = \
TestAlice.class \
../utils/AdapterBaseTestContext.class \
../utils/AdapterTestUtils.class \
../utils/TestCallbacks.class
JAVA_CLASSES+= \
TestAlice.class
.PHONY: pitytest compile alice test clean


+ 4
- 4
test/java/foundation/pEp/jniadapter/test/jni114/TestAlice.java View File

@ -21,8 +21,8 @@ class TestAlice {
TestSuite.getDefault().setVerbose(true);
TestSuite.getDefault().setTestColor(TestUtils.TermColor.GREEN);
AdapterBaseTestContext jni114Ctx = new AdapterBaseTestContext();
new TestUnit<AdapterBaseTestContext>("ImportKey/SetOwnKey", jni114Ctx, ctx -> {
CTXBase jni114Ctx = new CTXBase();
new TestUnit<CTXBase>("ImportKey/SetOwnKey", jni114Ctx, ctx -> {
// ImportKey and setOwnKey (with passphrase, of course)
ctx.alice = ctx.engine.importKey(ctx.keyAliceSecPassphrase).get(0);
log(AdapterTestUtils.identityToString(ctx.alice, true));
@ -34,7 +34,7 @@ class TestAlice {
});
new TestUnit<AdapterBaseTestContext>("no callback / encrypt fails nonblocking", jni114Ctx, ctx -> {
new TestUnit<CTXBase>("no callback / encrypt fails nonblocking", jni114Ctx, ctx -> {
ctx.alice = ctx.engine.myself(ctx.alice);
try {
Message enc = ctx.engine.encrypt_message(ctx.msgAliceToAlice, new Vector<>(), Message.EncFormat.PEP);
@ -46,7 +46,7 @@ class TestAlice {
});
new TestUnit<AdapterBaseTestContext>("use callback for encrypt", jni114Ctx, ctx -> {
new TestUnit<CTXBase>("use callback for encrypt", jni114Ctx, ctx -> {
// Register callback passphraseRequired()
ctx.engine.setPassphraseRequiredCallback(new Sync.PassphraseRequiredCallback() {
@Override


+ 2
- 5
test/java/foundation/pEp/jniadapter/test/jni115/Makefile View File

@ -3,11 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni115
JAVA_CLASSES = \
TestAlice.class \
../utils/AdapterBaseTestContext.class \
../utils/AdapterTestUtils.class \
../utils/TestCallbacks.class
JAVA_CLASSES+= \
TestAlice.class
.PHONY: pitytest compile alice test clean


+ 2
- 2
test/java/foundation/pEp/jniadapter/test/jni115/TestAlice.java View File

@ -1,7 +1,7 @@
package foundation.pEp.jniadapter.test.jni115;
import foundation.pEp.jniadapter.Message;
import foundation.pEp.jniadapter.test.utils.AdapterBaseTestContext;
import foundation.pEp.jniadapter.test.utils.CTXBase;
import foundation.pEp.jniadapter.test.utils.AdapterTestUtils;
import foundation.pEp.pitytest.TestSuite;
import foundation.pEp.pitytest.TestUnit;
@ -13,7 +13,7 @@ import java.util.List;
import static foundation.pEp.pitytest.TestLogger.log;
import static foundation.pEp.pitytest.TestLogger.logRaw;
class Jni115TestContext extends AdapterBaseTestContext {
class Jni115TestContext extends CTXBase {
public int messagesToBobCount = 10;
public List<Message> messagesToBobSmall;
public List<Message> messagesToBobBig;


+ 2
- 5
test/java/foundation/pEp/jniadapter/test/jni117/Makefile View File

@ -3,11 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni117
JAVA_CLASSES = \
TestAlice.class \
../utils/AdapterBaseTestContext.class \
../utils/AdapterTestUtils.class \
../utils/TestCallbacks.class
JAVA_CLASSES+= \
TestAlice.class
.PHONY: pitytest compile alice test clean


+ 2
- 2
test/java/foundation/pEp/jniadapter/test/jni117/TestAlice.java View File

@ -1,5 +1,5 @@
package foundation.pEp.jniadapter.test.jni117;
import foundation.pEp.jniadapter.test.utils.AdapterBaseTestContext;
import foundation.pEp.jniadapter.test.utils.CTXBase;
import foundation.pEp.pitytest.TestSuite;
import foundation.pEp.pitytest.TestUnit;
import foundation.pEp.pitytest.utils.TestUtils;
@ -18,7 +18,7 @@ class TestAlice {
TestSuite.getDefault().setVerbose(true);
TestSuite.getDefault().setTestColor(TestUtils.TermColor.GREEN);
new TestUnit<AdapterBaseTestContext>("Test Alice",new AdapterBaseTestContext() , ctx -> {
new TestUnit<CTXBase>("Test Alice",new CTXBase() , ctx -> {
ctx.alice = ctx.engine.myself(ctx.alice);
byte[] keydata = ctx.engine.export_key(ctx.alice.fpr);
String keydataStr = new String(keydata);


+ 2
- 5
test/java/foundation/pEp/jniadapter/test/jni118/Makefile View File

@ -3,11 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni118
JAVA_CLASSES = \
TestAlice.class \
../utils/AdapterBaseTestContext.class \
../utils/AdapterTestUtils.class \
../utils/TestCallbacks.class
JAVA_CLASSES+= \
TestAlice.class
.PHONY: pitytest compile alice test clean


+ 1
- 1
test/java/foundation/pEp/jniadapter/test/jni118/TestAlice.java View File

@ -36,7 +36,7 @@ import java.util.Vector;
class JNI1118Context extends AdapterBaseTestContext {
class JNI1118Context extends CTXBase {
public Message msgToBobEncrypted;
public Message msgToBobDecrypted;
public decrypt_message_Return msgToBobDecryptResult;


+ 2
- 5
test/java/foundation/pEp/jniadapter/test/jni119/Makefile View File

@ -3,11 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni119
JAVA_CLASSES = \
TestAlice.class \
../utils/AdapterBaseTestContext.class \
../utils/AdapterTestUtils.class \
../utils/TestCallbacks.class
JAVA_CLASSES+= \
TestAlice.class
.PHONY: pitytest compile alice test clean


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

@ -1,7 +1,7 @@
package foundation.pEp.jniadapter.test.jni119;
import foundation.pEp.jniadapter.Identity;
import foundation.pEp.jniadapter.test.utils.AdapterBaseTestContext;
import foundation.pEp.jniadapter.test.utils.CTXBase;
import foundation.pEp.pitytest.TestSuite;
import foundation.pEp.pitytest.TestUnit;
import foundation.pEp.pitytest.utils.TestUtils;
@ -14,12 +14,12 @@ class TestAlice {
TestSuite.getDefault().setVerbose(true);
TestSuite.getDefault().setTestColor(TestUtils.TermColor.GREEN);
new TestUnit<AdapterBaseTestContext>("enter_device_group() no exception with no identities", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("enter_device_group() no exception with no identities", new CTXBase(), 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 -> {
new TestUnit<CTXBase>("enter_device_group() no exception with 2 identities", new CTXBase(), ctx -> {
ctx.alice = ctx.engine.myself(ctx.alice);
ctx.bob = ctx.engine.myself(ctx.bob);


+ 2
- 5
test/java/foundation/pEp/jniadapter/test/jni125/Makefile View File

@ -3,11 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni125
JAVA_CLASSES = \
TestAlice.class \
../utils/AdapterBaseTestContext.class \
../utils/AdapterTestUtils.class \
../utils/TestCallbacks.class
JAVA_CLASSES+= \
TestAlice.class
.PHONY: pitytest compile alice test clean


+ 3
- 3
test/java/foundation/pEp/jniadapter/test/jni125/TestAlice.java View File

@ -1,7 +1,7 @@
package foundation.pEp.jniadapter.test.jni125;
import foundation.pEp.jniadapter.Message;
import foundation.pEp.jniadapter.test.utils.AdapterBaseTestContext;
import foundation.pEp.jniadapter.test.utils.CTXBase;
import foundation.pEp.pitytest.TestSuite;
import foundation.pEp.pitytest.TestUnit;
import foundation.pEp.pitytest.utils.TestUtils;
@ -11,7 +11,7 @@ class TestAlice {
TestSuite.getDefault().setVerbose(false);
TestSuite.getDefault().setTestColor(TestUtils.TermColor.GREEN);
new TestUnit<AdapterBaseTestContext>("enum Message.EncFormat verify .value", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("enum Message.EncFormat verify .value", new CTXBase(), ctx -> {
//TODO: This is stupid, we need a PityAssert()
assert Message.EncFormat.None.value == 0 : "Message.EncFormat.None == " + Message.EncFormat.None.value + "; expected " + 0;
assert Message.EncFormat.Pieces.value == 1 : "Message.Pieces.None == " + Message.EncFormat.Pieces.value + "; expected " + 1;
@ -24,7 +24,7 @@ class TestAlice {
assert Message.EncFormat.PEPEncAuto.value == 255 : "Message.PEPEncAuto.None == " + Message.EncFormat.PEPEncAuto.value + "; expected " + 255;
});
new TestUnit<AdapterBaseTestContext>("enum Message.EncFormat verify getByInt(0)", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("enum Message.EncFormat verify getByInt(0)", new CTXBase(), ctx -> {
assert Message.EncFormat.getByInt(0) == Message.EncFormat.None;
assert Message.EncFormat.getByInt(1) == Message.EncFormat.Inline;
assert Message.EncFormat.getByInt(2) == Message.EncFormat.SMIME;


+ 2
- 5
test/java/foundation/pEp/jniadapter/test/jni126/Makefile View File

@ -3,11 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni126
JAVA_CLASSES = \
TestAlice.class \
../utils/AdapterBaseTestContext.class \
../utils/AdapterTestUtils.class \
../utils/TestCallbacks.class
JAVA_CLASSES+= \
TestAlice.class
.PHONY: pitytest compile alice test clean


+ 5
- 5
test/java/foundation/pEp/jniadapter/test/jni126/TestAlice.java View File

@ -1,7 +1,7 @@
package foundation.pEp.jniadapter.test.jni126;
import foundation.pEp.jniadapter.*;
import foundation.pEp.jniadapter.test.utils.AdapterBaseTestContext;
import foundation.pEp.jniadapter.test.utils.CTXBase;
import foundation.pEp.pitytest.TestSuite;
import foundation.pEp.pitytest.TestUnit;
import foundation.pEp.pitytest.utils.TestUtils;
@ -9,9 +9,9 @@ import foundation.pEp.pitytest.utils.TestUtils;
import static foundation.pEp.pitytest.TestLogger.*;
import static foundation.pEp.pitytest.utils.TestUtils.*;
class Jni126TestContext extends AdapterBaseTestContext {
class Jni126TestContext extends CTXBase {
@Override
public AdapterBaseTestContext init() throws Throwable {
public CTXBase init() throws Throwable {
super.init();
alice = engine.importKey(keyAliceSecPassphrase).get(0);
@ -41,9 +41,9 @@ class TestAlice {
TestSuite.getDefault().setVerbose(true);
TestSuite.getDefault().setTestColor(TestUtils.TermColor.GREEN);
AdapterBaseTestContext jni126Ctx = new Jni126TestContext();
CTXBase jni126Ctx = new Jni126TestContext();
new TestUnit<AdapterBaseTestContext>("startSync()/stopSync()", jni126Ctx, ctx -> {
new TestUnit<CTXBase>("startSync()/stopSync()", jni126Ctx, ctx -> {
for(int reps = 0; reps < 3; reps++) {
ctx.engine.startSync();
for (int i = 0; i < 10; i++) {


+ 2
- 5
test/java/foundation/pEp/jniadapter/test/jni134/Makefile View File

@ -3,11 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni134
JAVA_CLASSES = \
TestAlice.class \
../utils/AdapterBaseTestContext.class \
../utils/AdapterTestUtils.class \
../utils/TestCallbacks.class
JAVA_CLASSES+= \
TestAlice.class
.PHONY: pitytest compile alice test clean


+ 26
- 26
test/java/foundation/pEp/jniadapter/test/jni134/TestAlice.java View File

@ -4,7 +4,7 @@ import foundation.pEp.jniadapter.Blob;
import foundation.pEp.jniadapter.Identity;
import foundation.pEp.jniadapter.Message;
import foundation.pEp.jniadapter.Pair;
import foundation.pEp.jniadapter.test.utils.AdapterBaseTestContext;
import foundation.pEp.jniadapter.test.utils.CTXBase;
import foundation.pEp.jniadapter.test.utils.AdapterTestUtils;
import foundation.pEp.pitytest.TestSuite;
import foundation.pEp.pitytest.TestUnit;
@ -16,9 +16,9 @@ import java.util.Vector;
import static foundation.pEp.pitytest.TestLogger.log;
class Jni134TestContext extends AdapterBaseTestContext {
class Jni134TestContext extends CTXBase {
@Override
public AdapterBaseTestContext init() throws Throwable {
public CTXBase init() throws Throwable {
super.init();
return this;
}
@ -29,9 +29,9 @@ class TestAlice {
TestSuite.getDefault().setVerbose(true);
TestSuite.getDefault().setTestColor(TestUtils.TermColor.GREEN);
AdapterBaseTestContext jni134Ctx = new Jni134TestContext();
CTXBase jni134Ctx = new Jni134TestContext();
new TestUnit<AdapterBaseTestContext>("setDir() == getDir() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setDir() == getDir() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
Message.Direction inVal = ctx.msgDirOutgoing;
msg.setDir(inVal);
@ -39,7 +39,7 @@ class TestAlice {
assert outVal == inVal : "\nreturned '" + outVal + "' instead of '" + inVal + "'";
});
new TestUnit<AdapterBaseTestContext>("setId() == getId() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setId() == getId() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
String inVal = "23";
msg.setId(inVal);
@ -47,7 +47,7 @@ class TestAlice {
assert outVal.equals(inVal) : "\nreturned '" + outVal + "' instead of '" + inVal + "'";
});
new TestUnit<AdapterBaseTestContext>("setShortmsg() == getShortmsg() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setShortmsg() == getShortmsg() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
String inVal = "23";
msg.setShortmsg(inVal);
@ -55,7 +55,7 @@ class TestAlice {
assert outVal.equals(inVal) : "\nreturned '" + outVal + "' instead of '" + inVal + "'";
});
new TestUnit<AdapterBaseTestContext>("setLongmsg() == getLongmsg() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setLongmsg() == getLongmsg() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
String inVal = "23";
msg.setLongmsg(inVal);
@ -63,7 +63,7 @@ class TestAlice {
assert outVal.equals(inVal) : "\nreturned '" + outVal + "' instead of '" + inVal + "'";
});
new TestUnit<AdapterBaseTestContext>("setLongmsgFormatted() == getLongmsgFormatted() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setLongmsgFormatted() == getLongmsgFormatted() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
String inVal = "23";
msg.setLongmsgFormatted(inVal);
@ -72,12 +72,12 @@ class TestAlice {
});
// TODO: use .equals()
new TestUnit<AdapterBaseTestContext>("setAttachments() == getAttachments() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setAttachments() == getAttachments() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
Vector<Blob> inVal = ctx.attachments;
Vector<Blob> inVal = ctx.attachmentList.getAttachments();
msg.setAttachments(inVal);
Vector<Blob> outVal = msg.getAttachments();
for (int i = 0; i < ctx.attachmentsLen; i++) {
for (int i = 0; i < ctx.attachmentList.getCount(); i++) {
Blob inElem = inVal.get(i);
Blob outElem = outVal.get(i);
assert inElem == outElem : "\nreturned '" + outElem + "' instead of '" + inElem + "'";
@ -85,7 +85,7 @@ class TestAlice {
});
// TODO: Date precision is truncated to seconds in the message struct
new TestUnit<AdapterBaseTestContext>("setSent() == getSent() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setSent() == getSent() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
Date inVal = new Date();
msg.setSent(inVal);
@ -97,7 +97,7 @@ class TestAlice {
});
// TODO: Date precision is truncated to seconds in the message struct
new TestUnit<AdapterBaseTestContext>("setRecv() == getRecv() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setRecv() == getRecv() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
Date inVal = new Date();
msg.setRecv(inVal);
@ -106,7 +106,7 @@ class TestAlice {
});
// TODO: use .equals()
new TestUnit<AdapterBaseTestContext>("setFrom() == getFrom() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setFrom() == getFrom() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
Identity inVal = ctx.alice;
msg.setFrom(inVal);
@ -115,7 +115,7 @@ class TestAlice {
});
// TODO: use .equals()
new TestUnit<AdapterBaseTestContext>("setTo() == getTo() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setTo() == getTo() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
Vector<Identity> inVal = new Vector<Identity>();
inVal.add(ctx.alice);
@ -130,7 +130,7 @@ class TestAlice {
});
// TODO: use .equals()
new TestUnit<AdapterBaseTestContext>("setRecvBy() == getRecvBy() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setRecvBy() == getRecvBy() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
Identity inVal = ctx.alice;
msg.setRecvBy(inVal);
@ -139,7 +139,7 @@ class TestAlice {
});
// TODO: use .equals()
new TestUnit<AdapterBaseTestContext>("setCc() == getCc() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setCc() == getCc() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
Vector<Identity> inVal = new Vector<Identity>();
inVal.add(ctx.alice);
@ -154,7 +154,7 @@ class TestAlice {
});
// TODO: use .equals()
new TestUnit<AdapterBaseTestContext>("setBcc() == getBcc() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setBcc() == getBcc() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
Vector<Identity> inVal = new Vector<Identity>();
inVal.add(ctx.alice);
@ -169,7 +169,7 @@ class TestAlice {
});
// TODO: use .equals()
new TestUnit<AdapterBaseTestContext>("setReplyTo() == getReplyTo() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setReplyTo() == getReplyTo() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
Vector<Identity> inVal = new Vector<Identity>();
inVal.add(ctx.alice);
@ -184,7 +184,7 @@ class TestAlice {
});
// TODO: use .equals()
new TestUnit<AdapterBaseTestContext>("setInReplyTo() == getInReplyTo() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setInReplyTo() == getInReplyTo() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
Vector<String> inVal = new Vector<String>();
inVal.add("pEp-auto-consume@pEp.foundation");
@ -199,7 +199,7 @@ class TestAlice {
});
// TODO: use .equals()
new TestUnit<AdapterBaseTestContext>("setReferences() == getReferences() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setReferences() == getReferences() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
Vector<String> inVal = new Vector<String>();
inVal.add("pEp-auto-consume@pEp.foundation");
@ -214,7 +214,7 @@ class TestAlice {
});
// TODO: use .equals()
new TestUnit<AdapterBaseTestContext>("setKeywords() == getKeywords() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setKeywords() == getKeywords() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
Vector<String> inVal = new Vector<String>();
inVal.add("pEp-auto-consume@pEp.foundation");
@ -229,7 +229,7 @@ class TestAlice {
});
// TODO: use .equals()
new TestUnit<AdapterBaseTestContext>("setComments() == getComments() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setComments() == getComments() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
String inVal = "pEp-auto-consume@pEp.foundation";
msg.setComments(inVal);
@ -237,7 +237,7 @@ class TestAlice {
assert outVal.equals(inVal) : "\nreturned:\n '" + outVal + "'\nexpected:\n '" + inVal + "'";
});
new TestUnit<AdapterBaseTestContext>("setOptFields() == getOptFields() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setOptFields() == getOptFields() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
ArrayList<Pair<String, String>> inVal = new ArrayList<>();
inVal.add(new Pair<>("Received", "in time"));
@ -247,7 +247,7 @@ class TestAlice {
assert AdapterTestUtils.optFieldsEqual(inVal, outVal) : "\nreturned:\n '" + outVal + "'\nexpected:\n '" + inVal + "'";
});
new TestUnit<AdapterBaseTestContext>("setEncFormat() == getEncFormat() ", new Jni134TestContext(), ctx -> {
new TestUnit<CTXBase>("setEncFormat() == getEncFormat() ", new Jni134TestContext(), ctx -> {
Message msg = new Message();
Message.EncFormat inVal = Message.EncFormat.PEP;
msg.setEncFormat(inVal);


+ 2
- 5
test/java/foundation/pEp/jniadapter/test/jni135/Makefile View File

@ -3,11 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni135
JAVA_CLASSES = \
TestAlice.class \
../utils/AdapterBaseTestContext.class \
../utils/AdapterTestUtils.class \
../utils/TestCallbacks.class
JAVA_CLASSES+= \
TestAlice.class
.PHONY: pitytest compile alice test clean


+ 5
- 5
test/java/foundation/pEp/jniadapter/test/jni135/TestAlice.java View File

@ -4,7 +4,7 @@ import foundation.pEp.jniadapter.Blob;
import foundation.pEp.jniadapter.Engine;
import foundation.pEp.jniadapter.Message;
import foundation.pEp.jniadapter.decrypt_message_Return;
import foundation.pEp.jniadapter.test.utils.AdapterBaseTestContext;
import foundation.pEp.jniadapter.test.utils.CTXBase;
import foundation.pEp.jniadapter.test.utils.AdapterTestUtils;
import foundation.pEp.pitytest.TestSuite;
import foundation.pEp.pitytest.TestUnit;
@ -16,9 +16,9 @@ import java.util.Vector;
import static foundation.pEp.pitytest.TestLogger.log;
class Jni135TestContext extends AdapterBaseTestContext {
class Jni135TestContext extends CTXBase {
@Override
public AdapterBaseTestContext init() throws Throwable {
public CTXBase init() throws Throwable {
super.init();
return this;
}
@ -40,11 +40,11 @@ class TestAlice {
// TestUtils.readKey();
TestSuite.getDefault().setVerbose(true);
TestSuite.getDefault().setTestColor(TestUtils.TermColor.GREEN);
AdapterBaseTestContext jni135Ctx = new Jni135TestContext();
CTXBase jni135Ctx = new Jni135TestContext();
Engine.setDebugLogEnabled(false);
new TestUnit<AdapterBaseTestContext>("setDir() == getDir() ", new Jni135TestContext(), ctx -> {
new TestUnit<CTXBase>("setDir() == getDir() ", new Jni135TestContext(), ctx -> {
ctx.alice = ctx.engine.myself(ctx.alice);
ctx.bob = ctx.engine.myself(ctx.bob);


+ 2
- 6
test/java/foundation/pEp/jniadapter/test/jni143/Makefile View File

@ -3,12 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni143
JAVA_CLASSES = \
TestAlice.class \
../utils/AdapterBaseTestContext.class \
../utils/AdapterTestUtils.class \
../utils/DiffResult.class \
../utils/TestCallbacks.class
JAVA_CLASSES+= \
TestAlice.class
.PHONY: pitytest compile alice test clean


+ 5
- 5
test/java/foundation/pEp/jniadapter/test/jni143/TestAlice.java View File

@ -3,7 +3,7 @@ package foundation.pEp.jniadapter.test.jni143;
import foundation.pEp.jniadapter.Blob;
import foundation.pEp.jniadapter.Message;
import foundation.pEp.jniadapter.decrypt_message_Return;
import foundation.pEp.jniadapter.test.utils.AdapterBaseTestContext;
import foundation.pEp.jniadapter.test.utils.CTXBase;
import foundation.pEp.jniadapter.test.utils.AdapterTestUtils;
import foundation.pEp.pitytest.TestSuite;
import foundation.pEp.pitytest.TestUnit;
@ -26,9 +26,9 @@ assert dataIn == dataOut
Logs the count of differing bytes.
*/
class Jni143TestContext extends AdapterBaseTestContext {
class Jni143TestContext extends CTXBase {
@Override
public AdapterBaseTestContext init() throws Throwable {
public CTXBase init() throws Throwable {
super.init();
return this;
}
@ -41,9 +41,9 @@ class TestAlice {
TestSuite.getDefault().setVerbose(true);
TestSuite.getDefault().setTestColor(TestUtils.TermColor.GREEN);
// TestUtils.readKey();
AdapterBaseTestContext jni143Ctx = new Jni143TestContext();
CTXBase jni143Ctx = new Jni143TestContext();
new TestUnit<AdapterBaseTestContext>("Attachement sizes", new Jni143TestContext(), ctx -> {
new TestUnit<CTXBase>("Attachement sizes", new Jni143TestContext(), ctx -> {
ctx.alice = ctx.engine.myself(ctx.alice);
ctx.bob = ctx.engine.myself(ctx.bob);


+ 1
- 2
test/java/foundation/pEp/jniadapter/test/jni88/Makefile View File

@ -3,8 +3,7 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni88
JAVA_CLASSES = \
TestMain.class
JAVA_CLASSES=TestMain.class
.PHONY: pitytest compile run test clean


+ 1
- 2
test/java/foundation/pEp/jniadapter/test/jni91/Makefile View File

@ -3,8 +3,7 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni91
JAVA_CLASSES = \
TestMain.class
JAVA_CLASSES=TestMain.class
.PHONY: pitytest compile run test clean


+ 2
- 3
test/java/foundation/pEp/jniadapter/test/jni92/Makefile View File

@ -3,9 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni92
JAVA_CLASSES = \
TestMain.class \
../utils/AdapterTestUtils.class
JAVA_CLASSES+= \
TestMain.class
.PHONY: pitytest compile run test clean


+ 2
- 2
test/java/foundation/pEp/jniadapter/test/jni94/Makefile View File

@ -3,8 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni94
JAVA_CLASSES = \
TestMain.class \
JAVA_CLASSES+= \
TestMain.class
.PHONY: pitytest compile run test clean


+ 2
- 2
test/java/foundation/pEp/jniadapter/test/jni94/TestMain.java View File

@ -1,7 +1,7 @@
package foundation.pEp.jniadapter.test.jni94;
import foundation.pEp.pitytest.*;
import foundation.pEp.jniadapter.*;
import foundation.pEp.jniadapter.test.utils.AdapterBaseTestContext;
import foundation.pEp.jniadapter.test.utils.CTXBase;
/*
This test tries to use the feature described in in JNI-94
@ -13,7 +13,7 @@ https://pep.foundation/jira/browse/JNI-94
class TestMain {
public static void main(String[] args) {
new TestUnit<AdapterBaseTestContext>("JNI-94", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("JNI-94", new CTXBase(), ctx -> {
TestLogger.logH2("Creating new Engine");
ctx.engine = new Engine();
Sync.DefaultCallback callbacks = new Sync.DefaultCallback();


+ 2
- 5
test/java/foundation/pEp/jniadapter/test/jni96/Makefile View File

@ -3,11 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni96
JAVA_CLASSES = \
TestAlice.class \
../utils/AdapterBaseTestContext.class \
../utils/AdapterTestUtils.class \
../utils/TestCallbacks.class
JAVA_CLASSES+= \
TestAlice.class
.PHONY: pitytest compile alice test clean


+ 5
- 6
test/java/foundation/pEp/jniadapter/test/jni96/TestAlice.java View File

@ -1,5 +1,4 @@
package foundation.pEp.jniadapter.test.jni96;
import static foundation.pEp.pitytest.TestLogger.*;
import foundation.pEp.jniadapter.Identity;
import foundation.pEp.pitytest.*;
@ -15,21 +14,21 @@ class TestAlice {
TestSuite.getDefault().setVerbose(true);
TestSuite.getDefault().setTestColor(TestUtils.TermColor.GREEN);
new TestUnit<AdapterBaseTestContext>("import_key() 1 pub key",new AdapterBaseTestContext() , ctx -> {
new TestUnit<CTXBase>("import_key() 1 pub key",new CTXBase() , ctx -> {
Vector<Identity> privKeys = null;
privKeys = ctx.engine.importKey(ctx.keyAlicePub);
log(AdapterTestUtils.identityListToString(privKeys, false));
assert privKeys.size() == 0: "pub key should not be in return";
});
new TestUnit<AdapterBaseTestContext>("import_key() 1 sec key",new AdapterBaseTestContext() , ctx -> {
new TestUnit<CTXBase>("import_key() 1 sec key",new CTXBase() , ctx -> {
Vector<Identity> privKeys = null;
privKeys = ctx.engine.importKey(ctx.keyAliceSec);
log(AdapterTestUtils.identityListToString(privKeys, false));
assert privKeys.size() == 1: "imported sec key should be returned";
});
new TestUnit<AdapterBaseTestContext>("import_key() 2 pub keys",new AdapterBaseTestContext() , ctx -> {
new TestUnit<CTXBase>("import_key() 2 pub keys",new CTXBase() , ctx -> {
byte[] keys = concat(ctx.keyAlicePub, ctx.keyBobPub);
Vector<Identity> privKeys = null;
@ -38,7 +37,7 @@ class TestAlice {
assert privKeys.size() == 0: "imported pub keys should not be returned";
});
new TestUnit<AdapterBaseTestContext>("import_key() 2 sec keys",new AdapterBaseTestContext() , ctx -> {
new TestUnit<CTXBase>("import_key() 2 sec keys",new CTXBase() , ctx -> {
byte[] keys = concat(ctx.keyAliceSec, ctx.keyBobSec);
Vector<Identity> privKeys = null;
@ -47,7 +46,7 @@ class TestAlice {
assert privKeys.size() == 2: "imported sec keys should be returned";
});
new TestUnit<AdapterBaseTestContext>("import_key() 4 keys pub/sec",new AdapterBaseTestContext() , ctx -> {
new TestUnit<CTXBase>("import_key() 4 keys pub/sec",new CTXBase() , ctx -> {
byte[] keys = concat(ctx.keyAlicePub, concat(ctx.keyAliceSec, concat(ctx.keyBobPub, ctx.keyBobSec)));
Vector<Identity> privKeys = null;


+ 2
- 3
test/java/foundation/pEp/jniadapter/test/jni98/Makefile View File

@ -3,9 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=jni98
JAVA_CLASSES = \
TestMain.class \
../utils/AdapterTestUtils.class
JAVA_CLASSES+= \
TestMain.class
.PHONY: pitytest compile run test clean


+ 3
- 3
test/java/foundation/pEp/jniadapter/test/jni98/TestMain.java View File

@ -3,7 +3,7 @@ package foundation.pEp.jniadapter.test.jni98;
import foundation.pEp.jniadapter.*;
import foundation.pEp.jniadapter.Message;
import foundation.pEp.pitytest.TestUnit;
import foundation.pEp.jniadapter.test.utils.AdapterBaseTestContext;
import foundation.pEp.jniadapter.test.utils.CTXBase;
import java.util.Vector;
@ -28,7 +28,7 @@ Please see https://pep.foundation/jira/browse/JNI-98 for further discussion
class TestMain {
public static void main(String[] args) throws Exception {
new TestUnit<AdapterBaseTestContext>("JNI-98 - Message.EncFormat.PEP", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("JNI-98 - Message.EncFormat.PEP", new CTXBase(), ctx -> {
ctx.engine.importKey(ctx.keyBobPub);
// Make msg1 by encrypting msgToBob
logH2("Create target Message");
@ -51,7 +51,7 @@ class TestMain {
log("\n" + msgToString(result.dst, false));
}).run();
new TestUnit<AdapterBaseTestContext>("JNI-98 - Message.EncFormat.PEP_enc_inline_EA", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("JNI-98 - Message.EncFormat.PEP_enc_inline_EA", new CTXBase(), ctx -> {
ctx.engine.importKey(ctx.keyBobPub);
// Make msg1 by encrypting msgToBob
logH2("Create target Message");


+ 2
- 3
test/java/foundation/pEp/jniadapter/test/regression/Makefile View File

@ -3,9 +3,8 @@ include ../Makefile.conf
TEST_UNIT_NAME=regression
JAVA_CLASSES = \
TestMain.class \
../utils/AdapterBaseTestContext.class
JAVA_CLASSES+= \
TestMain.class
.PHONY: pitytest compile run test clean


+ 42
- 42
test/java/foundation/pEp/jniadapter/test/regression/TestMain.java View File

@ -8,7 +8,7 @@ import java.util.Vector;
import static foundation.pEp.pitytest.TestLogger.log;
class CTXAlice extends AdapterBaseTestContext {
class CTXAlice extends CTXBase {
@Override
public CTXAlice init() throws Throwable {
super.init();
@ -28,7 +28,7 @@ class CTXAlice2 extends CTXAlice {
}
// Almost exact copy of JNI1118Context, we need a shared context hierarchy
class CTXReEvaluateMessageRating extends AdapterBaseTestContext {
class CTXReEvaluateMessageRating extends CTXBase {
public Message msgToBobEncrypted;
public Message msgToBobDecrypted;
public decrypt_message_Return msgToBobDecryptResult;
@ -73,11 +73,11 @@ class TestMain {
public static void main(String[] args) {
TestSuite.getDefault().setVerbose(false);
new TestUnit<AdapterBaseTestContext>("Engine.myself", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.myself", new CTXBase(), ctx -> {
ctx.alice = ctx.engine.myself(ctx.alice);
});
new TestUnit<AdapterBaseTestContext>("Engine.encrypt_message", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.encrypt_message", new CTXBase(), ctx -> {
ctx.engine.encrypt_message(ctx.msgAliceToBob, null, Message.EncFormat.PEP);
});
@ -89,7 +89,7 @@ class TestMain {
ctx.engine.encrypt_message_for_self(ctx.alice, ctx.msgAliceToAlice, null);
});
new TestUnit<AdapterBaseTestContext>("Engine.decrypt_message", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.decrypt_message", new CTXBase(), ctx -> {
ctx.engine.decrypt_message(ctx.msgAliceToAlice, new Vector<String>(), 0);
});
@ -97,11 +97,11 @@ class TestMain {
ctx.engine.re_evaluate_message_rating(ctx.msgToBobDecrypted);
});
new TestUnit<AdapterBaseTestContext>("Engine.outgoing_message_rating", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.outgoing_message_rating", new CTXBase(), ctx -> {
ctx.engine.outgoing_message_rating(ctx.msgAliceToBob);
});
new TestUnit<AdapterBaseTestContext>("Engine.outgoing_message_rating_preview", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.outgoing_message_rating_preview", new CTXBase(), ctx -> {
ctx.engine.outgoing_message_rating_preview(ctx.msgAliceToBob);
});
@ -113,7 +113,7 @@ class TestMain {
ctx.engine.identity_rating(ctx.alice);
});
new TestUnit<AdapterBaseTestContext>("Engine.blacklist_retrieve", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.blacklist_retrieve", new CTXBase(), ctx -> {
ctx.engine.blacklist_retrieve();
});
@ -122,19 +122,19 @@ class TestMain {
// ctx.engine.own_message_private_key_details(ctx.msgToSelf);
// });
new TestUnit<AdapterBaseTestContext>("Engine.OpenPGP_list_keyinfo", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.OpenPGP_list_keyinfo", new CTXBase(), ctx -> {
ctx.engine.OpenPGP_list_keyinfo("");
});
new TestUnit<AdapterBaseTestContext>("Engine.set_identity_flags", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.set_identity_flags", new CTXBase(), ctx -> {
ctx.engine.set_identity_flags(ctx.alice, 0);
});
new TestUnit<AdapterBaseTestContext>("Engine.unset_identity_flags", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.unset_identity_flags", new CTXBase(), ctx -> {
ctx.engine.unset_identity_flags(ctx.alice, 0);
});
new TestUnit<AdapterBaseTestContext>("Engine.own_identities_retrieve", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.own_identities_retrieve", new CTXBase(), ctx -> {
ctx.engine.own_identities_retrieve();
});
@ -146,11 +146,11 @@ class TestMain {
ctx.engine.get_trustwords_for_fprs(ctx.alice.fpr, ctx.bob.fpr, "en", false);
});
new TestUnit<AdapterBaseTestContext>("Engine.get_message_trustwords", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.get_message_trustwords", new CTXBase(), ctx -> {
ctx.engine.get_message_trustwords(ctx.msgAliceToBob, null, ctx.bob, "en", false);
});
new TestUnit<AdapterBaseTestContext>("Engine.get_languagelist", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.get_languagelist", new CTXBase(), ctx -> {
ctx.engine.get_languagelist();
});
@ -166,12 +166,12 @@ class TestMain {
ctx.engine.key_reset_user("fsdjugsh", ctx.alice.fpr);
});
new TestUnit<AdapterBaseTestContext>("Engine.key_reset_all_own_keys", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.key_reset_all_own_keys", new CTXBase(), ctx -> {
ctx.engine.key_reset_all_own_keys();
});
// TODO: FAILS
// new TestUnit<AdapterBaseTestContext>("Engine.deliverHandshakeResult", new AdapterBaseTestContext(), ctx -> {
// new TestUnit<CTXBase>("Engine.deliverHandshakeResult", new CTXBase(), ctx -> {
// ctx.engine.deliverHandshakeResult(SyncHandshakeResult.SyncHandshakeCancel, ctx.vID);
// });
@ -182,7 +182,7 @@ class TestMain {
// [17:52] < heck> | the error i get is:
// [17:53] < heck> | *** send message KeySync Beacon service KeySync_fsm.c:234
// [17:53] < heck> | Assertion failed: (msg->from && msg->from->fpr), function attach_own_key, file message_api.c, line 1581.
// new TestUnit<AdapterBaseTestContext>("Engine.leave_device_group", new AdapterBaseTestContext(), ctx -> {
// new TestUnit<CTXBase>("Engine.leave_device_group", new CTXBase(), ctx -> {
// ctx.engine.startSync();
// ctx.engine.leave_device_group();
// });
@ -195,15 +195,15 @@ class TestMain {
ctx.engine.disable_identity_for_sync(ctx.alice);
});
new TestUnit<AdapterBaseTestContext>("Engine.config_cipher_suite", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.config_cipher_suite", new CTXBase(), ctx -> {
ctx.engine.config_cipher_suite(CipherSuite.pEpCipherSuiteDefault);
});
new TestUnit<AdapterBaseTestContext>("Engine.trustwords", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.trustwords", new CTXBase(), ctx -> {
ctx.engine.trustwords(ctx.alice);
});
new TestUnit<AdapterBaseTestContext>("Engine.updateIdentity", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.updateIdentity", new CTXBase(), ctx -> {
ctx.engine.updateIdentity(ctx.alice);
});
@ -215,11 +215,11 @@ class TestMain {
ctx.engine.keyMistrusted(ctx.alice);
});
new TestUnit<AdapterBaseTestContext>("Engine.keyResetTrust", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.keyResetTrust", new CTXBase(), ctx -> {
ctx.engine.keyResetTrust(ctx.alice);
});
new TestUnit<AdapterBaseTestContext>("Engine.trustPersonalKey", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.trustPersonalKey", new CTXBase(), ctx -> {
ctx.engine.trustPersonalKey(ctx.alice);
});
@ -227,84 +227,84 @@ class TestMain {
ctx.engine.trustOwnKey(ctx.alice);
});
new TestUnit<AdapterBaseTestContext>("Engine.importKey", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.importKey", new CTXBase(), ctx -> {
ctx.engine.importKey(ctx.keyBobPub);
});
new TestUnit<AdapterBaseTestContext>("Engine.blacklist_add", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.blacklist_add", new CTXBase(), ctx -> {
ctx.engine.blacklist_add("43");
});
new TestUnit<AdapterBaseTestContext>("Engine.blacklist_delete", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.blacklist_delete", new CTXBase(), ctx -> {
ctx.engine.blacklist_delete("43");
});
new TestUnit<AdapterBaseTestContext>("Engine.blacklist_is_listed", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.blacklist_is_listed", new CTXBase(), ctx -> {
ctx.engine.blacklist_is_listed("43");
});
new TestUnit<AdapterBaseTestContext>("Engine.config_passive_mode", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.config_passive_mode", new CTXBase(), ctx -> {
ctx.engine.config_passive_mode(false);
});
new TestUnit<AdapterBaseTestContext>("Engine.config_unencrypted_subject", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.config_unencrypted_subject", new CTXBase(), ctx -> {
ctx.engine.config_unencrypted_subject(false);
});
new TestUnit<AdapterBaseTestContext>("Engine.getCrashdumpLog", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.getCrashdumpLog", new CTXBase(), ctx -> {
ctx.engine.getCrashdumpLog(0);
});
new TestUnit<AdapterBaseTestContext>("Engine.getUserDirectory", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.getUserDirectory", new CTXBase(), ctx -> {
ctx.engine.getUserDirectory();
});
new TestUnit<AdapterBaseTestContext>("Engine.getMachineDirectory", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.getMachineDirectory", new CTXBase(), ctx -> {
ctx.engine.getMachineDirectory();
});
// AbstractEngine.java
new TestUnit<AdapterBaseTestContext>("Engine.close", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.close", new CTXBase(), ctx -> {
ctx.engine.close();
});
new TestUnit<AdapterBaseTestContext>("Engine.getVersion", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.getVersion", new CTXBase(), ctx -> {
ctx.engine.getVersion();
});
new TestUnit<AdapterBaseTestContext>("Engine.getProtocolVersion", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.getProtocolVersion", new CTXBase(), ctx -> {
ctx.engine.getProtocolVersion();
});
new TestUnit<AdapterBaseTestContext>("Engine.startKeyserverLookup", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.startKeyserverLookup", new CTXBase(), ctx -> {
ctx.engine.startKeyserverLookup();
});
new TestUnit<AdapterBaseTestContext>("Engine.startSync", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.startSync", new CTXBase(), ctx -> {
ctx.engine.startSync();
});
new TestUnit<AdapterBaseTestContext>("Engine.stopSync", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.stopSync", new CTXBase(), ctx -> {
ctx.engine.stopSync();
});
new TestUnit<AdapterBaseTestContext>("Engine.isSyncRunning", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.isSyncRunning", new CTXBase(), ctx -> {
ctx.engine.isSyncRunning();
});
new TestUnit<AdapterBaseTestContext>("Engine.config_passphrase",new AdapterBaseTestContext() , ctx -> {
new TestUnit<CTXBase>("Engine.config_passphrase",new CTXBase() , ctx -> {
ctx.engine.config_passphrase("SUPERCOMPLICATEDPASSPHRASE");
});
new TestUnit<AdapterBaseTestContext>("Engine.config_passphrase_for_new_keys",new AdapterBaseTestContext() , ctx -> {
new TestUnit<CTXBase>("Engine.config_passphrase_for_new_keys",new CTXBase() , ctx -> {
ctx.engine.config_passphrase_for_new_keys(true, "SUPERCOMPLICATEDPASSPHRASE");
});
new TestUnit<AdapterBaseTestContext>("Engine.setDebugLogEnabled", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.setDebugLogEnabled", new CTXBase(), ctx -> {
Engine.setDebugLogEnabled(true);
});
new TestUnit<AdapterBaseTestContext>("Engine.setDebugLogEnabled", new AdapterBaseTestContext(), ctx -> {
new TestUnit<CTXBase>("Engine.setDebugLogEnabled", new CTXBase(), ctx -> {
Engine.getDebugLogEnabled();
});


+ 1
- 1
test/java/foundation/pEp/jniadapter/test/speedtest/Makefile View File

@ -3,7 +3,7 @@ include ../Makefile.conf
TEST_UNIT_NAME=speedtest
JAVA_CLASSES = \
JAVA_CLASSES+= \
MT999.class \
MTConstants.class \
MTMsgCodec.class \