From b9533f4ff6d05354492e461a3e6a82a813fa150f Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 26 Apr 2018 18:26:04 -0500 Subject: [PATCH] Renamed HistoricalTransfer to OperationHistory --- gradlew | 0 .../cy/agorise/graphenej/api/GetRelativeAccountHistory.java | 6 +++--- .../cy/agorise/graphenej/api/SubscriptionMessagesHub.java | 2 +- .../{HistoricalTransfer.java => OperationHistory.java} | 2 +- .../cy/agorise/graphenej/models/SubscriptionResponse.java | 2 ++ .../graphenej/api/GetRelativeAccountHistoryTest.java | 6 +++--- .../agorise/graphenej/api/SubscriptionMessagesHubTest.java | 4 ++-- 7 files changed, 12 insertions(+), 10 deletions(-) mode change 100644 => 100755 gradlew rename graphenej/src/main/java/cy/agorise/graphenej/models/{HistoricalTransfer.java => OperationHistory.java} (97%) diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/GetRelativeAccountHistory.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetRelativeAccountHistory.java index 935618f..b13c78d 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/GetRelativeAccountHistory.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetRelativeAccountHistory.java @@ -18,7 +18,7 @@ import cy.agorise.graphenej.UserAccount; import cy.agorise.graphenej.interfaces.WitnessResponseListener; import cy.agorise.graphenej.models.ApiCall; import cy.agorise.graphenej.models.BaseResponse; -import cy.agorise.graphenej.models.HistoricalTransfer; +import cy.agorise.graphenej.models.OperationHistory; import cy.agorise.graphenej.models.WitnessResponse; import cy.agorise.graphenej.objects.Memo; import cy.agorise.graphenej.operations.TransferOperation; @@ -158,12 +158,12 @@ public class GetRelativeAccountHistory extends BaseGrapheneHandler { sendRelativeAccountHistoryRequest(); }else if(baseResponse.id >= GET_HISTORY_DATA){ - Type RelativeAccountHistoryResponse = new TypeToken>>(){}.getType(); + Type RelativeAccountHistoryResponse = new TypeToken>>(){}.getType(); GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.registerTypeAdapter(TransferOperation.class, new TransferOperation.TransferDeserializer()); gsonBuilder.registerTypeAdapter(AssetAmount.class, new AssetAmount.AssetAmountDeserializer()); gsonBuilder.registerTypeAdapter(Memo.class, new Memo.MemoDeserializer()); - WitnessResponse> transfersResponse = gsonBuilder.create().fromJson(response, RelativeAccountHistoryResponse); + WitnessResponse> transfersResponse = gsonBuilder.create().fromJson(response, RelativeAccountHistoryResponse); mListener.onSuccess(transfersResponse); } } diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java b/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java index b6e3b43..5364314 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java @@ -61,7 +61,7 @@ public class SubscriptionMessagesHub extends BaseGrapheneHandler implements Subs private int subscriptionCounter = 0; private HashMap mHandlerMap = new HashMap<>(); private List pendingHandlerList = new ArrayList<>(); - private boolean printLogs; + private boolean printLogs = true; // State variables private boolean isUnsubscribing; diff --git a/graphenej/src/main/java/cy/agorise/graphenej/models/HistoricalTransfer.java b/graphenej/src/main/java/cy/agorise/graphenej/models/OperationHistory.java similarity index 97% rename from graphenej/src/main/java/cy/agorise/graphenej/models/HistoricalTransfer.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/OperationHistory.java index d14e5b8..8780a89 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/models/HistoricalTransfer.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/OperationHistory.java @@ -10,7 +10,7 @@ import cy.agorise.graphenej.operations.TransferOperation; * More operations types might be listed in the response of that method, but by using this class * those will be filtered out of the parsed result. */ -public class HistoricalTransfer { +public class OperationHistory { private String id; private TransferOperation op; public Object[] result; diff --git a/graphenej/src/main/java/cy/agorise/graphenej/models/SubscriptionResponse.java b/graphenej/src/main/java/cy/agorise/graphenej/models/SubscriptionResponse.java index 8edbfcd..2468a15 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/models/SubscriptionResponse.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/SubscriptionResponse.java @@ -182,6 +182,8 @@ public class SubscriptionResponse { broadcastedTransaction.setTransactionId(jsonObject.get(BroadcastedTransaction.KEY_TRX_ID).getAsString()); objectMap.put(ObjectType.TRANSACTION_OBJECT, true); secondArgument.add(broadcastedTransaction); + }else if(grapheneObject.getObjectType() == ObjectType.OPERATION_HISTORY_OBJECT){ + //TODO: Add support for other types of objects }else{ //TODO: Add support for other types of objects } diff --git a/graphenej/src/test/java/cy/agorise/graphenej/api/GetRelativeAccountHistoryTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/GetRelativeAccountHistoryTest.java index 220a523..e937191 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/api/GetRelativeAccountHistoryTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/GetRelativeAccountHistoryTest.java @@ -8,7 +8,7 @@ import java.util.List; import cy.agorise.graphenej.UserAccount; import cy.agorise.graphenej.interfaces.WitnessResponseListener; import cy.agorise.graphenej.models.BaseResponse; -import cy.agorise.graphenej.models.HistoricalTransfer; +import cy.agorise.graphenej.models.OperationHistory; import cy.agorise.graphenej.models.WitnessResponse; import cy.agorise.graphenej.operations.TransferOperation; @@ -51,8 +51,8 @@ public class GetRelativeAccountHistoryTest extends BaseApiTest { public void onSuccess(WitnessResponse response) { System.out.println("mTransferHistoryListener.onSuccess"); historicalTransferCount++; - WitnessResponse> resp = response; - for(HistoricalTransfer historicalTransfer : resp.result){ + WitnessResponse> resp = response; + for(OperationHistory historicalTransfer : resp.result){ if(historicalTransfer.getOperation() != null){ System.out.println("Got transfer operation!"); TransferOperation transferOperation = historicalTransfer.getOperation(); diff --git a/graphenej/src/test/java/cy/agorise/graphenej/api/SubscriptionMessagesHubTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/SubscriptionMessagesHubTest.java index b6f8fda..3e1cbe1 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/api/SubscriptionMessagesHubTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/SubscriptionMessagesHubTest.java @@ -10,13 +10,13 @@ import java.util.Timer; import java.util.TimerTask; import cy.agorise.graphenej.ObjectType; -import cy.agorise.graphenej.Transaction; import cy.agorise.graphenej.interfaces.NodeErrorListener; import cy.agorise.graphenej.interfaces.SubscriptionListener; import cy.agorise.graphenej.models.BaseResponse; import cy.agorise.graphenej.models.BroadcastedTransaction; import cy.agorise.graphenej.models.DynamicGlobalProperties; import cy.agorise.graphenej.models.SubscriptionResponse; +import cy.agorise.graphenej.Transaction; /** * Class used to encapsulate all tests that relate to the {@see SubscriptionMessagesHub} class. @@ -178,7 +178,7 @@ public class SubscriptionMessagesHubTest extends BaseApiTest { @Test public void testBroadcastedTransactionDeserializer(){ try{ - mMessagesHub = new SubscriptionMessagesHub("", "", mErrorListener); + mMessagesHub = new SubscriptionMessagesHub("", "", true, mErrorListener); mMessagesHub.addSubscriptionListener(new SubscriptionListener() { private int MAX_MESSAGES = 15; private int messageCounter = 0;