From 733ca522c70d962d266d811cec30c38607173e16 Mon Sep 17 00:00:00 2001 From: heck Date: Wed, 3 Jun 2020 00:13:34 +0200 Subject: [PATCH] TestContext rename --- .../fsmqmanager/test/regression/TestMain.java | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/test/java/foundation/pEp/jniadapter/test/utils/transport/fsmqmanager/test/regression/TestMain.java b/test/java/foundation/pEp/jniadapter/test/utils/transport/fsmqmanager/test/regression/TestMain.java index a538284..5959924 100644 --- a/test/java/foundation/pEp/jniadapter/test/utils/transport/fsmqmanager/test/regression/TestMain.java +++ b/test/java/foundation/pEp/jniadapter/test/utils/transport/fsmqmanager/test/regression/TestMain.java @@ -1,19 +1,16 @@ package foundation.pEp.jniadapter.test.utils.transport.fsmqmanager.test.regression; import static foundation.pEp.jniadapter.test.framework.TestLogger.*; -import static foundation.pEp.jniadapter.test.framework.TestUtils.deleteRecursively; import foundation.pEp.jniadapter.test.utils.transport.fsmqmanager.*; import foundation.pEp.jniadapter.test.framework.*; -import foundation.pEp.jniadapter.test.utils.transport.fsmsgqueue.FsMsgQueue; -import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.concurrent.TimeoutException; -class FsMsgQueueTestContext extends AbstractTestContext { +class FsMQManagerTestContext extends AbstractTestContext { String ownAddress = "Alice"; String ownQDir = "../resources/fsmsgqueue-test/alice"; String bobAddress = "Bob"; @@ -47,21 +44,21 @@ class FsMsgQueueTestContext extends AbstractTestContext { class TestMain { public static void main(String[] args) throws Exception { TestSuite.setVerbose(true); - FsMsgQueueTestContext testCtx = new FsMsgQueueTestContext(); + FsMQManagerTestContext testCtx = new FsMQManagerTestContext(); - new TestUnit("Create own ident: " + testCtx.ownAddress, testCtx, ctx -> { + new TestUnit("Create own ident: " + testCtx.ownAddress, testCtx, ctx -> { ctx.self = new FsMQIdentity(ctx.ownAddress, ctx.ownQDir); assert ctx.self != null : "null"; assert ctx.self.getAddress().equals(ctx.ownAddress): "Address mismatch"; assert ctx.self.getqDir().equals(ctx.ownQDir): "qDir mismatch"; }).add(); - new TestUnit("Constructor with: " + testCtx.ownAddress, testCtx, ctx -> { + new TestUnit("Constructor with: " + testCtx.ownAddress, testCtx, ctx -> { ctx.qm = new FsMQManager(ctx.self); assert ctx.qm != null : "null"; }).add(); - new TestUnit("Ident known: " + testCtx.ownAddress, testCtx, ctx -> { + new TestUnit("Ident known: " + testCtx.ownAddress, testCtx, ctx -> { FsMQIdentity self = ctx.qm.getIdentityForAddress(ctx.ownAddress); assert self != null : "null"; assert self.equals(ctx.self) : "Obj mismatch"; @@ -69,14 +66,14 @@ class TestMain { log("qDir: " + self.getqDir()); }).add(); - new TestUnit("Create ident " + testCtx.bobAddress, testCtx, ctx -> { + new TestUnit("Create ident " + testCtx.bobAddress, testCtx, ctx -> { ctx.bob = new FsMQIdentity(ctx.bobAddress, ctx.bobQDir); assert ctx.bob != null : "null"; assert ctx.bob.getAddress().equals(ctx.bobAddress) : "Address mismatch"; assert ctx.bob.getqDir().equals(ctx.bobQDir) : "qDir mismatch"; }).add(); - new TestUnit("Ident unknown: " + testCtx.bobAddress, testCtx, ctx -> { + new TestUnit("Ident unknown: " + testCtx.bobAddress, testCtx, ctx -> { try { FsMQIdentity self = ctx.qm.getIdentityForAddress(ctx.bobAddress); } catch (UnknownIdentityException e) { @@ -85,24 +82,24 @@ class TestMain { assert false : "Ident is known but shouldnt"; }).add(); - new TestUnit("Add ident " + testCtx.bobAddress, testCtx, ctx -> { + new TestUnit("Add ident " + testCtx.bobAddress, testCtx, ctx -> { assert ctx.qm.addOrUpdateIdentity(ctx.bob) : "Identity updated but should have been added"; }).add(); - new TestUnit("Ident known: " + testCtx.bobAddress, testCtx, ctx -> { + new TestUnit("Ident known: " + testCtx.bobAddress, testCtx, ctx -> { FsMQIdentity bob = ctx.qm.getIdentityForAddress(ctx.bobAddress); assert bob.equals(ctx.bob) : "Obj mismatch"; }).add(); - new TestUnit("Update ident " + testCtx.bobAddress, testCtx, ctx -> { + new TestUnit("Update ident " + testCtx.bobAddress, testCtx, ctx -> { assert !ctx.qm.addOrUpdateIdentity(ctx.bob) : "Ident got added but should have been updated"; }).add(); - new TestUnit("ClearOwnQueue: " + testCtx.bobAddress, testCtx, ctx -> { + new TestUnit("ClearOwnQueue: " + testCtx.bobAddress, testCtx, ctx -> { ctx.qm.clearOwnQueue(); }).add(); - new TestUnit("waitForMsg timeout", testCtx, ctx -> { + new TestUnit("waitForMsg timeout", testCtx, ctx -> { log("waitForMessage with timeout..."); try { ctx.qm.waitForMsg(3); @@ -115,7 +112,7 @@ class TestMain { } }).add(); - new TestUnit("sendMsgTo self " + testCtx.ownAddress, testCtx, ctx -> { + new TestUnit("sendMsgTo self " + testCtx.ownAddress, testCtx, ctx -> { String msg = ctx.messages.get(0); log("TX MSG: " + msg); try { @@ -125,7 +122,7 @@ class TestMain { } }).add(); - new TestUnit("waitForMsg", testCtx, ctx -> { + new TestUnit("waitForMsg", testCtx, ctx -> { String msg = null; try { msg = ctx.qm.waitForMsg(10); @@ -133,7 +130,7 @@ class TestMain { throw new RuntimeException(e.toString()); } log("RX MSG: " + msg); - assert msg.equals(ctx.messages.get(0)); + assert msg.equals(ctx.messages.get(0)) : "message content mismatch"; }).add();