use of org.jumpmind.symmetric.model.OutgoingBatches in project symmetric-ds by JumpMind.
the class SimpleIntegrationTest method test13SuspendIgnorePullRemoteBatches.
@Test(timeout = 120000)
public void test13SuspendIgnorePullRemoteBatches() throws Exception {
// test suspend / ignore with remote database specifying the suspends
// and ignores
logTestRunning();
clientPull();
Date date = DateUtils.parseDate("2009-09-30", new String[] { "yyyy-MM-dd" });
Order order = new Order("42", 100, "C", date);
serverTestService.insertOrder(order);
clientPull();
IOutgoingBatchService rootOutgoingBatchService = getServer().getOutgoingBatchService();
OutgoingBatches batches = rootOutgoingBatchService.getOutgoingBatches(TestConstants.TEST_CLIENT_NODE.getNodeId(), false);
assertNotNull(clientTestService.getOrder(order.getOrderId()));
assertEquals("There should be no outgoing batches", 0, batches.getBatches().size());
// Suspend the channel...
IConfigurationService rootConfigurationService = getServer().getConfigurationService();
NodeChannel c = rootConfigurationService.getNodeChannel(TestConstants.TEST_CHANNEL_ID, TestConstants.TEST_CLIENT_EXTERNAL_ID, false);
c.setSuspendEnabled(true);
rootConfigurationService.saveNodeChannel(c, true);
date = DateUtils.parseDate("2009-09-30", new String[] { "yyyy-MM-dd" });
order = new Order("43", 100, "C", date);
serverTestService.insertOrder(order);
clientPull();
batches = rootOutgoingBatchService.getOutgoingBatches(TestConstants.TEST_CLIENT_NODE.getNodeId(), false);
assertEquals("There should be 1 outgoing batch", 1, batches.getBatches().size());
assertNull(clientTestService.getOrder(order.getOrderId()));
c = rootConfigurationService.getNodeChannel(TestConstants.TEST_CHANNEL_ID, TestConstants.TEST_CLIENT_EXTERNAL_ID, false);
c.setIgnoreEnabled(true);
rootConfigurationService.saveNodeChannel(c, true);
// ignore
clientPull();
batches = rootOutgoingBatchService.getOutgoingBatches(TestConstants.TEST_CLIENT_NODE.getNodeId(), false);
assertNull(clientTestService.getOrder(order.getOrderId()));
assertEquals("There should be no outgoing batches", 0, batches.getBatches().size());
// Cleanup!
c = rootConfigurationService.getNodeChannel(TestConstants.TEST_CHANNEL_ID, TestConstants.TEST_CLIENT_EXTERNAL_ID, false);
c.setSuspendEnabled(false);
c.setIgnoreEnabled(false);
rootConfigurationService.saveNodeChannel(c, true);
clientPull();
batches = rootOutgoingBatchService.getOutgoingBatches(TestConstants.TEST_CLIENT_NODE.getNodeId(), false);
assertEquals("There should be no outgoing batches", 0, batches.getBatches().size());
assertNull(clientTestService.getOrder(order.getOrderId()));
}
use of org.jumpmind.symmetric.model.OutgoingBatches in project symmetric-ds by JumpMind.
the class SimpleIntegrationTest method test16SuspendIgnorePullLocalBatches.
@Test(timeout = 120000)
public void test16SuspendIgnorePullLocalBatches() throws Exception {
// test suspend / ignore with local database specifying suspends and
// ignores
logTestRunning();
// Should not sync when status = null
Date date = DateUtils.parseDate("2009-09-30", new String[] { "yyyy-MM-dd" });
Order order = new Order("44", 100, "C", date);
serverTestService.insertOrder(order);
clientPull();
IOutgoingBatchService rootOutgoingBatchService = getServer().getOutgoingBatchService();
OutgoingBatches batches = rootOutgoingBatchService.getOutgoingBatches(TestConstants.TEST_CLIENT_NODE.getNodeId(), false);
assertNotNull(clientTestService.getOrder(order.getOrderId()));
assertEquals("There should be no outgoing batches", 0, batches.getBatches().size());
// Suspend the channel...
IConfigurationService clientConfigurationService = getClient().getConfigurationService();
NodeChannel c = clientConfigurationService.getNodeChannel(TestConstants.TEST_CHANNEL_ID, TestConstants.TEST_CLIENT_EXTERNAL_ID, false);
c.setSuspendEnabled(true);
clientConfigurationService.saveNodeChannel(c, true);
order = new Order("45", 100, "C", date);
serverTestService.insertOrder(order);
clientPull();
batches = rootOutgoingBatchService.getOutgoingBatches(TestConstants.TEST_CLIENT_NODE.getNodeId(), false);
assertNull(clientTestService.getOrder(order.getOrderId()));
assertEquals("There should be 1 outgoing batches", 1, batches.getBatches().size());
c = clientConfigurationService.getNodeChannel(TestConstants.TEST_CHANNEL_ID, TestConstants.TEST_CLIENT_EXTERNAL_ID, false);
c.setIgnoreEnabled(true);
clientConfigurationService.saveNodeChannel(c, true);
// ignore
clientPull();
assertNoPendingBatchesOnServer();
c = clientConfigurationService.getNodeChannel(TestConstants.TEST_CHANNEL_ID, TestConstants.TEST_CLIENT_EXTERNAL_ID, false);
c.setSuspendEnabled(false);
c.setIgnoreEnabled(false);
clientConfigurationService.saveNodeChannel(c, true);
clientPull();
}
use of org.jumpmind.symmetric.model.OutgoingBatches in project symmetric-ds by JumpMind.
the class AbstractIntegrationTest method assertNoPendingBatchesOnClient.
protected void assertNoPendingBatchesOnClient() {
IOutgoingBatchService outgoingBatchService = getClient().getOutgoingBatchService();
OutgoingBatches batches = outgoingBatchService.getOutgoingBatches(TestConstants.TEST_ROOT_NODE.getNodeId(), false);
assertEquals("There should be no outgoing batches", 0, batches.getBatches().size());
}
use of org.jumpmind.symmetric.model.OutgoingBatches in project symmetric-ds by JumpMind.
the class FileSyncTest method testManual.
protected void testManual(ISymmetricEngine rootServer, ISymmetricEngine clientServer) throws Exception {
IFileSyncService fileSyncService = rootServer.getFileSyncService();
FileTriggerRouter fileTriggerRouter = fileSyncService.getFileTriggerRouter("all", "server_2_client");
fileTriggerRouter.setConflictStrategy(FileConflictStrategy.MANUAL);
fileSyncService.saveFileTriggerRouter(fileTriggerRouter);
pull("client");
File allFile1 = new File(allSvrSourceDir, "manual/test.txt");
allFile1.getParentFile().mkdirs();
FileUtils.write(allFile1, "server value");
File allFile1Target = new File(allClntTargetDir, allFile1.getParentFile().getName() + "/" + allFile1.getName());
allFile1Target.getParentFile().mkdirs();
FileUtils.write(allFile1Target, "client value");
pullFiles();
assertEquals("client value", FileUtils.readFileToString(allFile1Target));
OutgoingBatches batchesInError = rootServer.getOutgoingBatchService().getOutgoingBatchErrors(10);
List<OutgoingBatch> batches = batchesInError.getBatchesForChannel(Constants.CHANNEL_FILESYNC);
assertEquals(1, batches.size());
allFile1Target.delete();
pullFiles();
assertEquals("server value", FileUtils.readFileToString(allFile1Target));
batchesInError = rootServer.getOutgoingBatchService().getOutgoingBatchErrors(10);
batches = batchesInError.getBatchesForChannel(Constants.CHANNEL_FILESYNC);
assertEquals(0, batches.size());
}
Aggregations