use of com.oracle.coherence.plugin.visualvm.tablemodel.model.Data in project coherence-visualvm by oracle.
the class AbstractDataRetrieverTest method testElasticData.
/**
* Test the retrieval of RamJournalData and FlashJournalData via the VisualVMModel.
* Note: Called from testCacheData().
*/
public void testElasticData() throws Exception {
final int RAM_INSERT_COUNT = 1000;
final int FLASH_INSERT_COUNT = 2000;
final int DATA_SIZE = 1000;
List<Map.Entry<Object, Data>> ramJournalData;
List<Map.Entry<Object, Data>> flashJournalData;
// refresh the statistics
VisualVMModel model = getModel();
RequestSender requestSender = getRequestSender();
model.refreshStatistics(requestSender);
ramJournalData = model.getData(VisualVMModel.DataType.RAMJOURNAL);
setCurrentDataType(VisualVMModel.DataType.RAMJOURNAL);
// should have two entries from federation
assertTrue("RamJournalData should be empty but size is " + (ramJournalData == null ? null : ramJournalData.size()), ramJournalData == null || ramJournalData.size() == 2);
setClientProperties();
ExtensibleConfigurableCacheFactory eccf = getECCF();
NamedCache nc = eccf.ensureCache(RAM_CACHE, null);
populateRandomData(nc, RAM_INSERT_COUNT, DATA_SIZE);
assertTrue(nc.size() == RAM_INSERT_COUNT);
waitForRefresh();
model.refreshStatistics(requestSender);
ramJournalData = model.getData(VisualVMModel.DataType.RAMJOURNAL);
validateData(VisualVMModel.DataType.RAMJOURNAL, ramJournalData, 2);
Map.Entry<Object, Data> entryRamJournal1 = ramJournalData.get(0);
assertTrue(entryRamJournal1 != null && ((Integer) entryRamJournal1.getValue().getColumn(RamJournalData.NODE_ID)) != 0);
NamedCache nc2 = eccf.ensureCache(FLASH_CACHE, null);
populateRandomData(nc2, FLASH_INSERT_COUNT, DATA_SIZE);
assertThat(nc2.size(), is(FLASH_INSERT_COUNT));
waitForRefresh();
model.refreshStatistics(getRequestSender());
flashJournalData = model.getData(VisualVMModel.DataType.FLASHJOURNAL);
setCurrentDataType(VisualVMModel.DataType.FLASHJOURNAL);
validateData(VisualVMModel.DataType.FLASHJOURNAL, flashJournalData, 2);
Map.Entry<Object, Data> entryFlashJournal1 = flashJournalData.get(0);
assertTrue(entryFlashJournal1 != null && ((Integer) entryFlashJournal1.getValue().getColumn(RamJournalData.NODE_ID)) != 0);
}
use of com.oracle.coherence.plugin.visualvm.tablemodel.model.Data in project coherence-visualvm by oracle.
the class AbstractDataRetrieverTest method testMemberData.
/**
* Test the retrieval of MemberData via the VisualVMModel.
*/
private void testMemberData() {
List<Map.Entry<Object, Data>> memberData;
VisualVMModel model = getModel();
assertClusterReady();
waitForRefresh();
// refresh the statistics
model.refreshStatistics(getRequestSender());
memberData = model.getData(VisualVMModel.DataType.MEMBER);
setCurrentDataType(VisualVMModel.DataType.MEMBER);
validateData(VisualVMModel.DataType.MEMBER, memberData, 2);
Map.Entry<Object, Data> entryNode1 = memberData.get(0);
Map.Entry<Object, Data> entryNode2 = memberData.get(1);
Assert.assertNotNull(entryNode1);
Assert.assertNotNull(entryNode2);
setCurrentDataType(VisualVMModel.DataType.MEMBER);
// validate node 1 and 2 exists and has deterministic data
validateColumn(MemberData.NODE_ID, entryNode1, 1);
validateColumn(MemberData.NODE_ID, entryNode2, 2);
validateColumn(MemberData.ROLE_NAME, entryNode1, ROLE_NAME);
validateColumn(MemberData.ROLE_NAME, entryNode2, ROLE_NAME);
// this is always defaulted to true and only updated to false within the Members Tab
validateColumn(MemberData.STORAGE_ENABLED, entryNode2, "true");
}
use of com.oracle.coherence.plugin.visualvm.tablemodel.model.Data in project coherence-visualvm by oracle.
the class AbstractDataRetrieverTest method testPersistenceData.
/**
* Test the retrieval of PersistenceData via the VisualVMModel.
* Note: Called from testCacheData().
*/
public void testPersistenceData() {
List<Map.Entry<Object, Data>> persistenceData;
VisualVMModel model = getModel();
assertClusterReady();
waitForRefresh();
// refresh the statistics
model.refreshStatistics(getRequestSender());
persistenceData = model.getData(VisualVMModel.DataType.PERSISTENCE);
assertTrue("VisualVMModel does not report Coherence as 12.1.3 or above", model.is1213AndAbove() != null && model.is1213AndAbove());
setCurrentDataType(VisualVMModel.DataType.PERSISTENCE);
// need to account for difference in coherence versions as persistence is
// not on by default in 12.1.3 but is in 12.2.1.
int cCount = model.getClusterVersion().startsWith("12.1.3") ? 3 : 5;
validateData(VisualVMModel.DataType.PERSISTENCE, persistenceData, cCount);
// the services will be ordered as above, alphabetically
Map.Entry<Object, Data> entryPersistence1 = persistenceData.get(0);
Map.Entry<Object, Data> entryPersistence2 = persistenceData.get(1);
assertThat(entryPersistence1, is(notNullValue()));
assertThat(entryPersistence2, is(notNullValue()));
validateColumn(PersistenceData.SERVICE_NAME, entryPersistence1, DIST1_SERVICE);
validateColumn(PersistenceData.SERVICE_NAME, entryPersistence2, DIST2_SERVICE);
validateColumn(PersistenceData.SNAPSHOT_COUNT, entryPersistence1, 0);
validateColumn(PersistenceData.SNAPSHOT_COUNT, entryPersistence2, 0);
int cSnapshots = (Integer) entryPersistence1.getValue().getColumn(PersistenceData.SNAPSHOT_COUNT);
assertThat(cSnapshots, is(0));
}
use of com.oracle.coherence.plugin.visualvm.tablemodel.model.Data in project coherence-visualvm by oracle.
the class AbstractDataRetrieverTest method testProxyData.
/**
* Test the retrieval of ProxyData via the VisualVMModel.
* Note: Called from testCacheData().
*/
public void testProxyData() {
List<Map.Entry<Object, Data>> proxyData;
VisualVMModel model = getModel();
assertClusterReady();
waitForRefresh();
// refresh the statistics
model.setIncludeNameService(false);
model.refreshStatistics(getRequestSender());
proxyData = model.getData(VisualVMModel.DataType.PROXY);
setCurrentDataType(VisualVMModel.DataType.PROXY);
validateData(VisualVMModel.DataType.PROXY, proxyData, 2);
// ensure we have correct values
int nNode = 1;
int cConnection = 0;
long cTotalBytesRec = 0L;
long cTotalBytesSent = 0L;
long cTotalMsgRec = 0L;
long cTotalMsgSent = 0L;
for (Map.Entry<Object, Data> entry : proxyData) {
cConnection += (Integer) entry.getValue().getColumn(ProxyData.CONNECTION_COUNT);
cTotalBytesRec += (Long) entry.getValue().getColumn(ProxyData.TOTAL_BYTES_RECEIVED);
cTotalBytesSent += (Long) entry.getValue().getColumn(ProxyData.TOTAL_BYTES_SENT);
cTotalMsgRec += (Long) entry.getValue().getColumn(ProxyData.TOTAL_MSG_RECEIVED);
cTotalMsgSent += (Long) entry.getValue().getColumn(ProxyData.TOTAL_MSG_SENT);
}
assertThat(cConnection, is(1));
assertThat(cTotalBytesRec, is(greaterThan(0L)));
assertThat(cTotalBytesSent, is(greaterThan(0L)));
assertThat(cTotalMsgRec, is(greaterThan(0L)));
assertThat(cTotalMsgSent, is(greaterThan(0L)));
// Now include the name service
// refresh the statistics
model.setIncludeNameService(true);
waitForRefresh();
model.refreshStatistics(getRequestSender());
proxyData = model.getData(VisualVMModel.DataType.PROXY);
setCurrentDataType(VisualVMModel.DataType.PROXY);
validateData(VisualVMModel.DataType.PROXY, proxyData, 2);
for (Map.Entry<Object, Data> entry : proxyData) {
String sServiceName = (String) entry.getValue().getColumn(ProxyData.SERVICE_NAME);
assertThat(sServiceName, is(PROXY_SERVICE));
}
}
use of com.oracle.coherence.plugin.visualvm.tablemodel.model.Data in project coherence-visualvm by oracle.
the class AbstractDataRetrieverTest method testServiceData.
/**
* Test the retrieval of ServiceData via the VisualVMModel.
*/
public void testServiceData() {
List<Map.Entry<Object, Data>> serviceData;
List<Map.Entry<Object, Data>> serviceMemberData;
VisualVMModel model = getModel();
assertClusterReady();
waitForRefresh();
// refresh the statistics
model.refreshStatistics(getRequestSender());
serviceData = model.getData(VisualVMModel.DataType.SERVICE);
setCurrentDataType(VisualVMModel.DataType.SERVICE);
// the services will be ordered as above, alphabetically
Map.Entry<Object, Data> distService1 = getData(serviceData, DIST1_SERVICE);
Map.Entry<Object, Data> distService2 = getData(serviceData, DIST2_SERVICE);
Map.Entry<Object, Data> extendProxyService = getData(serviceData, PROXY_SERVICE);
Map.Entry<Object, Data> federatedService = getData(serviceData, FEDERATED_SERVICE);
Map.Entry<Object, Data> replicatedService = getData(serviceData, REPLICATED_SERVICE);
Assert.assertNotNull(distService1);
Assert.assertNotNull(distService2);
Assert.assertNotNull(extendProxyService);
// test Federation
if (isCommercial()) {
Assert.assertNotNull(federatedService);
validateColumn(ServiceData.STATUS_HA, federatedService, "NODE-SAFE");
validateColumn(ServiceData.STORAGE_MEMBERS, federatedService, 2);
}
setCurrentDataType(VisualVMModel.DataType.SERVICE);
// validate distributed caches
validateDistributedCacheService(distService1, DIST1_SERVICE);
validateDistributedCacheService(distService2, DIST2_SERVICE);
// validate proxy server
validateColumn(ServiceData.STATUS_HA, extendProxyService, "n/a");
validateColumn(ServiceData.MEMBERS, extendProxyService, 2);
validateColumn(ServiceData.STORAGE_MEMBERS, extendProxyService, 0);
// validate replicated scheme
validateColumn(ServiceData.STATUS_HA, replicatedService, "NODE-SAFE");
validateColumn(ServiceData.STORAGE_MEMBERS, replicatedService, 2);
// set the selected service and refresh to get ServiceMemberData
model.setSelectedService(DIST1_SERVICE);
assertClusterReady();
waitForRefresh();
// refresh the statistics
model.refreshStatistics(getRequestSender());
serviceMemberData = model.getData(VisualVMModel.DataType.SERVICE_DETAIL);
setCurrentDataType(VisualVMModel.DataType.SERVICE_DETAIL);
validateData(VisualVMModel.DataType.SERVICE_DETAIL, serviceMemberData, 2);
// ensure we have correct values
int nNode = 1;
for (Map.Entry<Object, Data> entry : serviceMemberData) {
validateColumn(ServiceMemberData.NODE_ID, entry, nNode++);
validateColumn(ServiceMemberData.THREAD_COUNT, entry, 10);
validateColumn(ServiceMemberData.THREAD_IDLE_COUNT, entry, 10);
validateColumn(ServiceMemberData.THREAD_UTILISATION_PERCENT, entry, 0.0f);
}
}
Aggregations