// check for type 'mysql' and tenant 3
cartridgeSubscriptions = dataInsertionAndRetrievalManager.getCartridgeSubscriptions(3, "mysql");
assertEquals(1, cartridgeSubscriptions.size());
// check for tenant 1 and alias 'esba'
CartridgeSubscription subscription = dataInsertionAndRetrievalManager.getCartridgeSubscription(1, "esba");
assertNotNull(subscription);
// check for tenant 1 and alias 'esbb'
subscription = dataInsertionAndRetrievalManager.getCartridgeSubscription(1, "esbb");
assertNull(subscription);
// check for tenant 2 and alias 'esba'
subscription = dataInsertionAndRetrievalManager.getCartridgeSubscription(2, "esba");
assertNull(subscription);
// check for tenant 2 and alias 'esbb'
subscription = dataInsertionAndRetrievalManager.getCartridgeSubscription(2, "esbb");
assertNotNull(subscription);
// check for tenant 1 and alias 'esba1'
subscription = dataInsertionAndRetrievalManager.getCartridgeSubscription(1, "esba1");
assertNotNull(subscription);
// check for tenant 2 and alias 'esba1'
subscription = dataInsertionAndRetrievalManager.getCartridgeSubscription(2, "esba1");
assertNull(subscription);
cartridgeSubscriptions = dataInsertionAndRetrievalManager.getCartridgeSubscriptionForCluster("esb.domain");
assertNotNull(cartridgeSubscriptions);
assertEquals(2, cartridgeSubscriptions.size());
for (CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
assertTrue(cartridgeSubscription.getAlias().equals("esba") || cartridgeSubscription.getAlias().equals("esbb"));
}
dataInsertionAndRetrievalManager.removeSubscriptionFromCache(1, "esba");
cartridgeSubscriptions = dataInsertionAndRetrievalManager.getCartridgeSubscriptionForCluster("esb.domain");
assertNotNull(cartridgeSubscriptions);
assertEquals(1, cartridgeSubscriptions.size());
for (CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
assertTrue(cartridgeSubscription.getAlias().equals("esbb"));
}
dataInsertionAndRetrievalManager.removeSubscriptionFromCache(2, "esbb");
assertNull(dataInsertionAndRetrievalManager.getCartridgeSubscriptionForCluster("esb.domain"));
cartridgeSubscriptions = dataInsertionAndRetrievalManager.getCartridgeSubscriptionForCluster("a.esb.domain");
assertNotNull(cartridgeSubscriptions);
assertEquals(1, cartridgeSubscriptions.size());
for (CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
assertTrue(cartridgeSubscription.getAlias().equals("esba1"));
}
dataInsertionAndRetrievalManager.removeSubscriptionFromCache(1, "esba1");
assertNull(dataInsertionAndRetrievalManager.getCartridgeSubscriptionForCluster("a.esb.domain"));
// check for tenant 3 and alias 'phpa'
subscription = dataInsertionAndRetrievalManager.getCartridgeSubscription(3, "phpa");
assertNotNull(subscription);
assertTrue(subscription.getAlias().equals("phpa"));
dataInsertionAndRetrievalManager.removeSubscriptionFromCache(3, "phpa");
subscription = dataInsertionAndRetrievalManager.getCartridgeSubscription(3, "phpa");
assertNull(subscription);
// check for tenant 3 and alias 'mysqla'
subscription = dataInsertionAndRetrievalManager.getCartridgeSubscription(3, "mysqla");
assertNotNull(subscription);
assertTrue(subscription.getAlias().equals("mysqla"));
dataInsertionAndRetrievalManager.removeSubscriptionFromCache(3, "mysqla");
subscription = dataInsertionAndRetrievalManager.getCartridgeSubscription(3, "mysqla");
assertNull(subscription);