use of org.jumpmind.symmetric.service.IConfigurationService in project symmetric-ds by JumpMind.
the class SimpleIntegrationTest method test14SuspendIgnorePullRemoteLocalComboBatches.
@Test(timeout = 120000)
public void test14SuspendIgnorePullRemoteLocalComboBatches() throws Exception {
// test suspend / ignore with remote database specifying the suspends
// and ignores
logTestRunning();
Date date = DateUtils.parseDate("2009-09-30", new String[] { "yyyy-MM-dd" });
Order order = new Order("442", 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());
IConfigurationService rootConfigurationService = getServer().getConfigurationService();
IConfigurationService clientConfigurationService = getClient().getConfigurationService();
// suspend on remote
NodeChannel c = rootConfigurationService.getNodeChannel(TestConstants.TEST_CHANNEL_ID, TestConstants.TEST_CLIENT_EXTERNAL_ID, false);
c.setSuspendEnabled(true);
rootConfigurationService.saveNodeChannel(c, true);
// ignore on local
c = clientConfigurationService.getNodeChannel(TestConstants.TEST_CHANNEL_ID, TestConstants.TEST_CLIENT_EXTERNAL_ID, false);
c.setIgnoreEnabled(true);
clientConfigurationService.saveNodeChannel(c, true);
order = new Order("443", 100, "C", date);
serverTestService.insertOrder(order);
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()));
// ignore on remote
c = rootConfigurationService.getNodeChannel(TestConstants.TEST_CHANNEL_ID, TestConstants.TEST_CLIENT_EXTERNAL_ID, false);
c.setIgnoreEnabled(true);
c.setSuspendEnabled(false);
rootConfigurationService.saveNodeChannel(c, true);
// suspend on local
c = clientConfigurationService.getNodeChannel(TestConstants.TEST_CHANNEL_ID, TestConstants.TEST_CLIENT_EXTERNAL_ID, false);
c.setIgnoreEnabled(false);
c.setSuspendEnabled(true);
clientConfigurationService.saveNodeChannel(c, true);
order = new Order("444", 100, "C", date);
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()));
// Cleanup!
c = rootConfigurationService.getNodeChannel(TestConstants.TEST_CHANNEL_ID, TestConstants.TEST_CLIENT_EXTERNAL_ID, false);
c.setSuspendEnabled(false);
c.setIgnoreEnabled(false);
rootConfigurationService.saveNodeChannel(c, true);
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.service.IConfigurationService 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.service.IConfigurationService in project symmetric-ds by JumpMind.
the class SimpleIntegrationTest method test23IgnoreNodeChannel.
@Test(timeout = 120000)
public void test23IgnoreNodeChannel() {
logTestRunning();
INodeService rootNodeService = getServer().getNodeService();
IConfigurationService rootConfigService = getServer().getConfigurationService();
rootNodeService.ignoreNodeChannelForExternalId(true, TestConstants.TEST_CHANNEL_ID, TestConstants.TEST_ROOT_NODE_GROUP, TestConstants.TEST_ROOT_EXTERNAL_ID);
rootConfigService.clearCache();
NodeChannel channel = rootConfigService.getNodeChannel(TestConstants.TEST_CHANNEL_ID, TestConstants.TEST_ROOT_EXTERNAL_ID, false);
assertNotNull(channel);
assertTrue(channel.isIgnoreEnabled());
assertFalse(channel.isSuspendEnabled());
Customer customer = new Customer(201, "Charlie Dude", true, "300 Grub Street", "New York", "NY", 90009, new Date(), new Date(), THIS_IS_A_TEST, BINARY_DATA);
serverTestService.insertCustomer(customer);
clientPull();
assertNull(clientTestService.getCustomer(customer.getCustomerId()));
rootNodeService.ignoreNodeChannelForExternalId(false, TestConstants.TEST_CHANNEL_ID, TestConstants.TEST_ROOT_NODE_GROUP, TestConstants.TEST_ROOT_EXTERNAL_ID);
rootConfigService.clearCache();
clientPull();
assertNull(clientTestService.getCustomer(customer.getCustomerId()));
getClient().getConfigurationService().clearCache();
}
use of org.jumpmind.symmetric.service.IConfigurationService 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();
}
Aggregations