use of org.apache.geode.internal.cache.wan.AbstractGatewaySender in project geode by apache.
the class WANCommandTestBase method verifySenderState.
public void verifySenderState(String senderId, boolean isRunning, boolean isPaused) {
final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
try {
Set<GatewaySender> senders = cache.getGatewaySenders();
AbstractGatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = (AbstractGatewaySender) s;
break;
}
}
assertEquals(isRunning, sender.isRunning());
assertEquals(isPaused, sender.isPaused());
} finally {
exln.remove();
}
}
use of org.apache.geode.internal.cache.wan.AbstractGatewaySender in project geode by apache.
the class WANCommandTestBase method verifySenderAttributes.
public void verifySenderAttributes(String senderId, int remoteDsID, boolean isParallel, boolean manualStart, int socketBufferSize, int socketReadTimeout, boolean enableBatchConflation, int batchSize, int batchTimeInterval, boolean enablePersistence, boolean diskSynchronous, int maxQueueMemory, int alertThreshold, int dispatcherThreads, OrderPolicy orderPolicy, List<String> expectedGatewayEventFilters, List<String> expectedGatewayTransportFilters) {
Set<GatewaySender> senders = cache.getGatewaySenders();
AbstractGatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = (AbstractGatewaySender) s;
break;
}
}
assertEquals("remoteDistributedSystemId", remoteDsID, sender.getRemoteDSId());
assertEquals("isParallel", isParallel, sender.isParallel());
assertEquals("manualStart", manualStart, sender.isManualStart());
assertEquals("socketBufferSize", socketBufferSize, sender.getSocketBufferSize());
assertEquals("socketReadTimeout", socketReadTimeout, sender.getSocketReadTimeout());
assertEquals("enableBatchConflation", enableBatchConflation, sender.isBatchConflationEnabled());
assertEquals("batchSize", batchSize, sender.getBatchSize());
assertEquals("batchTimeInterval", batchTimeInterval, sender.getBatchTimeInterval());
assertEquals("enablePersistence", enablePersistence, sender.isPersistenceEnabled());
assertEquals("diskSynchronous", diskSynchronous, sender.isDiskSynchronous());
assertEquals("maxQueueMemory", maxQueueMemory, sender.getMaximumQueueMemory());
assertEquals("alertThreshold", alertThreshold, sender.getAlertThreshold());
assertEquals("dispatcherThreads", dispatcherThreads, sender.getDispatcherThreads());
assertEquals("orderPolicy", orderPolicy, sender.getOrderPolicy());
// verify GatewayEventFilters
if (expectedGatewayEventFilters != null) {
assertEquals("gatewayEventFilters", expectedGatewayEventFilters.size(), sender.getGatewayEventFilters().size());
List<GatewayEventFilter> actualGatewayEventFilters = sender.getGatewayEventFilters();
List<String> actualEventFilterClassNames = new ArrayList<String>(actualGatewayEventFilters.size());
for (GatewayEventFilter filter : actualGatewayEventFilters) {
actualEventFilterClassNames.add(filter.getClass().getName());
}
for (String expectedGatewayEventFilter : expectedGatewayEventFilters) {
if (!actualEventFilterClassNames.contains(expectedGatewayEventFilter)) {
fail("GatewayEventFilter " + expectedGatewayEventFilter + " is not added to the GatewaySender");
}
}
}
// verify GatewayTransportFilters
if (expectedGatewayTransportFilters != null) {
assertEquals("gatewayTransportFilters", expectedGatewayTransportFilters.size(), sender.getGatewayTransportFilters().size());
List<GatewayTransportFilter> actualGatewayTransportFilters = sender.getGatewayTransportFilters();
List<String> actualTransportFilterClassNames = new ArrayList<String>(actualGatewayTransportFilters.size());
for (GatewayTransportFilter filter : actualGatewayTransportFilters) {
actualTransportFilterClassNames.add(filter.getClass().getName());
}
for (String expectedGatewayTransportFilter : expectedGatewayTransportFilters) {
if (!actualTransportFilterClassNames.contains(expectedGatewayTransportFilter)) {
fail("GatewayTransportFilter " + expectedGatewayTransportFilter + " is not added to the GatewaySender.");
}
}
}
}
use of org.apache.geode.internal.cache.wan.AbstractGatewaySender in project geode by apache.
the class ParallelWANPropagationDUnitTest method test_ParallelGatewaySenderMetaRegionNotExposedToUser_Bug44216.
@Test
public void test_ParallelGatewaySenderMetaRegionNotExposedToUser_Bug44216() {
Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
createCache(lnPort);
createSender("ln", 2, true, 100, 300, false, false, null, true);
createPartitionedRegion(getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap());
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals("ln")) {
sender = s;
break;
}
}
try {
sender.start();
} catch (Exception e) {
e.printStackTrace();
fail("Failed with IOException");
}
GemFireCacheImpl gemCache = (GemFireCacheImpl) cache;
Set regionSet = gemCache.rootRegions();
for (Object r : regionSet) {
if (((Region) r).getName().equals(((AbstractGatewaySender) sender).getQueues().toArray(new RegionQueue[1])[0].getRegion().getName())) {
fail("The shadowPR is exposed to the user");
}
}
}
use of org.apache.geode.internal.cache.wan.AbstractGatewaySender in project geode by apache.
the class ParallelGatewaySenderQueueOverflowDUnitTest method test_ValidateParallelGatewaySenderQueueAttributes_1.
/**
* Test to validate that ParallelGatewaySenderQueue diskSynchronous attribute when persistence of
* sender is enabled.
*/
@Ignore("TODO: test is disabled")
@Test
public void test_ValidateParallelGatewaySenderQueueAttributes_1() {
Integer localLocPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
Integer remoteLocPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, localLocPort));
WANTestBase test = new WANTestBase();
Properties props = test.getDistributedSystemProperties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "localhost[" + localLocPort + "]");
InternalDistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
File directory = new File("TKSender" + "_disk_" + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
directory.mkdir();
File[] dirs1 = new File[] { directory };
DiskStoreFactory dsf = cache.createDiskStoreFactory();
dsf.setDiskDirs(dirs1);
DiskStore diskStore = dsf.create("FORNY");
GatewaySenderFactory fact = cache.createGatewaySenderFactory();
// set parallel to true
fact.setParallel(true);
fact.setBatchConflationEnabled(true);
fact.setBatchSize(200);
fact.setBatchTimeInterval(300);
// enable the persistence
fact.setPersistenceEnabled(true);
fact.setDiskSynchronous(true);
fact.setDiskStoreName("FORNY");
fact.setMaximumQueueMemory(200);
fact.setAlertThreshold(1200);
GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
fact.addGatewayEventFilter(myEventFilter1);
GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
fact.addGatewayTransportFilter(myStreamFilter1);
GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
fact.addGatewayTransportFilter(myStreamFilter2);
final IgnoredException exTKSender = IgnoredException.addIgnoredException("Could not connect");
try {
GatewaySender sender1 = fact.create("TKSender", 2);
AttributesFactory factory = new AttributesFactory();
factory.addGatewaySenderId(sender1.getId());
factory.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
Region region = cache.createRegionFactory(factory.create()).create("test_ValidateGatewaySenderAttributes");
Set<GatewaySender> senders = cache.getGatewaySenders();
assertEquals(senders.size(), 1);
GatewaySender gatewaySender = senders.iterator().next();
Set<RegionQueue> regionQueues = ((AbstractGatewaySender) gatewaySender).getQueues();
assertEquals(regionQueues.size(), 1);
RegionQueue regionQueue = regionQueues.iterator().next();
assertEquals(true, regionQueue.getRegion().getAttributes().isDiskSynchronous());
} finally {
exTKSender.remove();
}
}
use of org.apache.geode.internal.cache.wan.AbstractGatewaySender in project geode by apache.
the class SerialGatewaySenderOperationsDUnitTest method verifySenderPausedState.
public static void verifySenderPausedState(String senderId) {
Set<GatewaySender> senders = cache.getGatewaySenders();
AbstractGatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = (AbstractGatewaySender) s;
break;
}
}
assertTrue(sender.isPaused());
}
Aggregations