Renamed HistoricalTransfer to OperationHistory

This commit is contained in:
Nelson R. Perez 2018-04-26 18:26:04 -05:00
parent 0a4c0c0c9d
commit 5dea8a6eb4
7 changed files with 12 additions and 10 deletions

0
gradlew vendored Normal file → Executable file
View file

View file

@ -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<WitnessResponse<List<HistoricalTransfer>>>(){}.getType();
Type RelativeAccountHistoryResponse = new TypeToken<WitnessResponse<List<OperationHistory>>>(){}.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<List<HistoricalTransfer>> transfersResponse = gsonBuilder.create().fromJson(response, RelativeAccountHistoryResponse);
WitnessResponse<List<OperationHistory>> transfersResponse = gsonBuilder.create().fromJson(response, RelativeAccountHistoryResponse);
mListener.onSuccess(transfersResponse);
}
}

View file

@ -61,7 +61,7 @@ public class SubscriptionMessagesHub extends BaseGrapheneHandler implements Subs
private int subscriptionCounter = 0;
private HashMap<Long, BaseGrapheneHandler> mHandlerMap = new HashMap<>();
private List<BaseGrapheneHandler> pendingHandlerList = new ArrayList<>();
private boolean printLogs;
private boolean printLogs = true;
// State variables
private boolean isUnsubscribing;

View file

@ -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;

View file

@ -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
}

View file

@ -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<List<HistoricalTransfer>> resp = response;
for(HistoricalTransfer historicalTransfer : resp.result){
WitnessResponse<List<OperationHistory>> resp = response;
for(OperationHistory historicalTransfer : resp.result){
if(historicalTransfer.getOperation() != null){
System.out.println("Got transfer operation!");
TransferOperation transferOperation = historicalTransfer.getOperation();

View file

@ -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;