diff --git a/graphenej/src/test/java/cy/agorise/graphenej/MemoTestAccounts.java b/graphenej/src/test/java/cy/agorise/graphenej/TestAccounts.java similarity index 68% rename from graphenej/src/test/java/cy/agorise/graphenej/MemoTestAccounts.java rename to graphenej/src/test/java/cy/agorise/graphenej/TestAccounts.java index e34ee01..5eebf78 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/MemoTestAccounts.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/TestAccounts.java @@ -4,7 +4,13 @@ package cy.agorise.graphenej; * Created by nelson on 11/2/17. */ -public class MemoTestAccounts { +public class TestAccounts { + + public class Bilthon5 { + public static final String BRAINKEY = "TIGROID BUTLER GALLOWS PAKEHA MOONJAH ACARI LUPUS BAE ACRISIA ABBACY BASSOON AKUND"; + public static final String WIF = "5Jr84yteNbomGgLq5nvH2Y6WYJCBTsjugPouCtggfS3RguqxDo8"; + } + public class Bilthon7 { public static final String BRAINKEY = "PUMPER ISOTOME SERE STAINER CLINGER MOONLIT CHAETA UPBRIM AEDILIC BERTHER NIT SHAP SAID SHADING JUNCOUS CHOUGH"; public static final String WIF = "5J96pne45qWM1WpektoeazN6k9Mt93jQ7LyueRxFfEMTiy6yxjM"; diff --git a/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java index b2de5c3..ea13bd6 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java @@ -33,12 +33,11 @@ import cy.agorise.graphenej.test.NaiveSSLContext; * Created by nelson on 3/6/17. */ public class TransactionTest { - private final String BILTHON_15_BRAIN_KEY = System.getenv("BILTHON_15_BRAINKEY"); - private final String BILTHON_5_BRAIN_KEY = System.getenv("BILTHON_5_BRAINKEY"); - private final String BILTHON_16_BRAIN_KEY = System.getenv("BILTHON_16_BRAINKEY"); + private final String BILTHON_7_BRAIN_KEY = TestAccounts.Bilthon7.BRAINKEY; + private final String BILTHON_5_BRAIN_KEY = TestAccounts.Bilthon5.BRAINKEY; + private final String BILTHON_16_BRAIN_KEY = TestAccounts.Bilthon16.BRAINKEY; - private final String BLOCK_PAY_DE = System.getenv("BLOCKPAY_DE"); - private final String BLOCK_PAY_FR = System.getenv("BLOCKPAY_FR"); + private final String NODE_URL = "wss://eu.openledger.info/ws"; // Transfer operation transaction private final Asset CORE_ASSET = new Asset("1.3.0"); @@ -53,6 +52,8 @@ public class TransactionTest { private AssetAmount minToReceive = new AssetAmount(UnsignedLong.valueOf(520), BIT_USD); private long expiration; + private final long FEE_AMOUNT = 21851; + // Lock object private static final class Lock { } private final Object lockObject = new Lock(); @@ -106,7 +107,7 @@ public class TransactionTest { // Set the custom SSL context. factory.setSSLContext(context); - WebSocket mWebSocket = factory.createSocket(BLOCK_PAY_DE); + WebSocket mWebSocket = factory.createSocket(NODE_URL); mWebSocket.addListener(new TransactionBroadcastSequence(transaction, CORE_ASSET, responseListener)); mWebSocket.connect(); @@ -137,7 +138,7 @@ public class TransactionTest { @Test public void testTransferTransaction(){ - ECKey sourcePrivateKey = new BrainKey(BILTHON_15_BRAIN_KEY, 0).getPrivateKey(); + ECKey sourcePrivateKey = new BrainKey(BILTHON_7_BRAIN_KEY, 0).getPrivateKey(); PublicKey to1 = new PublicKey(ECKey.fromPublicOnly(new BrainKey(BILTHON_5_BRAIN_KEY, 0).getPublicKey())); PublicKey to2 = new PublicKey(ECKey.fromPublicOnly(new BrainKey(BILTHON_16_BRAIN_KEY, 0).getPublicKey())); @@ -151,7 +152,7 @@ public class TransactionTest { .setTransferAmount(new AssetAmount(UnsignedLong.valueOf(1), CORE_ASSET)) .setSource(bilthon_15) .setDestination(bilthon_5) // bilthon-5 - .setFee(new AssetAmount(UnsignedLong.valueOf(264174), CORE_ASSET)) + .setFee(new AssetAmount(UnsignedLong.valueOf(FEE_AMOUNT), CORE_ASSET)) .build(); // Creating operation 2 @@ -159,7 +160,7 @@ public class TransactionTest { .setTransferAmount(new AssetAmount(UnsignedLong.valueOf(1), CORE_ASSET)) .setSource(bilthon_15) // bilthon-15 .setDestination(bilthon_16) // bilthon-16 - .setFee(new AssetAmount(UnsignedLong.valueOf(264174), CORE_ASSET)) + .setFee(new AssetAmount(UnsignedLong.valueOf(FEE_AMOUNT), CORE_ASSET)) .build(); @@ -174,7 +175,7 @@ public class TransactionTest { @Test public void testLimitOrderCreateTransaction(){ - ECKey privateKey = new BrainKey(BILTHON_15_BRAIN_KEY, 0).getPrivateKey(); + ECKey privateKey = new BrainKey(BILTHON_7_BRAIN_KEY, 0).getPrivateKey(); expiration = (System.currentTimeMillis() / 1000) + 60 * 60; // Creating limit order creation operation @@ -210,7 +211,7 @@ public class TransactionTest { public void testLimitOrderCancelTransaction() throws NoSuchAlgorithmException, IOException, WebSocketException { // We first must create a limit order for this test - ECKey privateKey = new BrainKey(BILTHON_15_BRAIN_KEY, 0).getPrivateKey(); + ECKey privateKey = new BrainKey(BILTHON_7_BRAIN_KEY, 0).getPrivateKey(); expiration = (System.currentTimeMillis() / 1000) + 60 * 5; // Creating limit order creation operation @@ -237,7 +238,7 @@ public class TransactionTest { // Set the custom SSL context. factory.setSSLContext(context); - WebSocket mWebSocket = factory.createSocket(BLOCK_PAY_DE); + WebSocket mWebSocket = factory.createSocket(NODE_URL); // Requesting limit order to cancel (Task 2) mWebSocket.addListener(new GetLimitOrders(base.getObjectId(), quote.getObjectId(), 100, new WitnessResponseListener() { @@ -250,7 +251,7 @@ public class TransactionTest { if(order.getSeller().getObjectId().equals(bilthon_15.getObjectId())){ // Instantiating a private key for bilthon-15 - ECKey privateKey = new BrainKey(BILTHON_15_BRAIN_KEY, 0).getPrivateKey(); + ECKey privateKey = new BrainKey(BILTHON_7_BRAIN_KEY, 0).getPrivateKey(); // Creating limit order cancellation operation LimitOrderCancelOperation operation = new LimitOrderCancelOperation(order, bilthon_15); diff --git a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java index 68055c5..b8a37b3 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java @@ -11,7 +11,7 @@ import org.junit.Before; import org.junit.Test; import cy.agorise.graphenej.Address; -import cy.agorise.graphenej.MemoTestAccounts; +import cy.agorise.graphenej.TestAccounts; import cy.agorise.graphenej.PublicKey; import cy.agorise.graphenej.Util; import cy.agorise.graphenej.errors.ChecksumException; @@ -30,8 +30,8 @@ public class MemoTest { private ECKey destinationPrivate; private Address destinationAddress; - private String sourceWIF = MemoTestAccounts.Bilthon16.WIF; - private String destinationWIF = MemoTestAccounts.Bilthon7.WIF; + private String sourceWIF = TestAccounts.Bilthon16.WIF; + private String destinationWIF = TestAccounts.Bilthon7.WIF; private String shortMessage = "test"; private String longerMessage = "testing now longer string with some special charaters é ç o ú á í Í mMno!!"; @@ -130,8 +130,8 @@ public class MemoTest { Memo memo = new Memo(sourceAddress, destinationAddress, shortEncryptedMessageNonce, encrypted); JsonElement jsonObject = memo.toJsonObject(); JsonObject expected = new JsonObject(); - expected.addProperty("from", new Address(ECKey.fromPublicOnly(ECKey.fromPrivate(DumpedPrivateKey.fromBase58(null, MemoTestAccounts.Bilthon16.WIF).getKey().getPrivKeyBytes()).getPubKey())).toString()); - expected.addProperty("to", new Address(ECKey.fromPublicOnly(ECKey.fromPrivate(DumpedPrivateKey.fromBase58(null, MemoTestAccounts.Bilthon7.WIF).getKey().getPrivKeyBytes()).getPubKey())).toString()); + expected.addProperty("from", new Address(ECKey.fromPublicOnly(ECKey.fromPrivate(DumpedPrivateKey.fromBase58(null, TestAccounts.Bilthon16.WIF).getKey().getPrivKeyBytes()).getPubKey())).toString()); + expected.addProperty("to", new Address(ECKey.fromPublicOnly(ECKey.fromPrivate(DumpedPrivateKey.fromBase58(null, TestAccounts.Bilthon7.WIF).getKey().getPrivKeyBytes()).getPubKey())).toString()); expected.addProperty("nonce", String.format("%d", shortEncryptedMessageNonce)); expected.addProperty("message", "93c398e05f2a36a535f82880032a062d"); assertEquals("Memo instance should generate a valid JsonObject",expected, jsonObject);