Skip to content

Commit

Permalink
0001249: test ack
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Jun 12, 2013
1 parent 5c16770 commit 7c44ac7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
Expand Up @@ -53,6 +53,15 @@ public class BatchResult {
* error on the client including SQL Error Number and description
*/
private String statusDescription;

public BatchResult(String nodeId, long batchId, boolean success) {
this.status = success ? "OK" : "ER";
this.nodeId = nodeId;
this.batchId = batchId;
}

public BatchResult() {
}

/**
* Returns the nodeId for the given batch result
Expand Down
Expand Up @@ -20,14 +20,15 @@
*/
package org.jumpmind.symmetric.web.rest.model;

import java.util.ArrayList;
import java.util.List;

public class BatchResults {

/**
* A list of batchResults to be acknowledged on the Server
*/
List<BatchResult> batchResults;
List<BatchResult> batchResults = new ArrayList<BatchResult>();

/**
* Returns a list of batch results
Expand Down
Expand Up @@ -13,6 +13,8 @@
import org.jumpmind.symmetric.service.IParameterService;
import org.jumpmind.symmetric.web.rest.NotAllowedException;
import org.jumpmind.symmetric.web.rest.RestService;
import org.jumpmind.symmetric.web.rest.model.BatchResult;
import org.jumpmind.symmetric.web.rest.model.BatchResults;
import org.jumpmind.symmetric.web.rest.model.PullDataResults;
import org.jumpmind.symmetric.web.rest.model.RegistrationInfo;
import org.jumpmind.util.FormatUtils;
Expand Down Expand Up @@ -119,6 +121,17 @@ protected void test(ISymmetricEngine rootServer, ISymmetricEngine clientServer)

log.info(results.getBatches().get(1).getSqlStatements().get(0));
log.info(results.getBatches().get(1).getSqlStatements().get(1));

BatchResults batchResults = new BatchResults();
batchResults.getBatchResults().add(new BatchResult(registrationInfo.getNodeId(), 3, true));
batchResults.getBatchResults().add(new BatchResult(registrationInfo.getNodeId(), 4, true));
restService.putAcknowledgeBatch("server", batchResults);

results = restService.pullData("server", registrationInfo.getNodeId(),
registrationInfo.getNodePassword());
Assert.assertNotNull("Should have a non null results object", results);
Assert.assertEquals(0, results.getNbrBatches());

}

}

0 comments on commit 7c44ac7

Please sign in to comment.