Search in sources :

Example 1 with VisualVMModel

use of com.oracle.coherence.plugin.visualvm.VisualVMModel 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);
}
Also used : RequestSender(com.oracle.coherence.plugin.visualvm.helper.RequestSender) MemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.MemberData) ServiceData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceData) PersistenceData(com.oracle.coherence.plugin.visualvm.tablemodel.model.PersistenceData) FederationDestinationDetailsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationDestinationDetailsData) Data(com.oracle.coherence.plugin.visualvm.tablemodel.model.Data) FederationOriginDetailsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationOriginDetailsData) CacheDetailData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheDetailData) CacheData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheData) RamJournalData(com.oracle.coherence.plugin.visualvm.tablemodel.model.RamJournalData) ServiceMemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceMemberData) FederationData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationData) ClusterData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ClusterData) ProxyData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ProxyData) VisualVMModel(com.oracle.coherence.plugin.visualvm.VisualVMModel) ExtensibleConfigurableCacheFactory(com.tangosol.net.ExtensibleConfigurableCacheFactory) Map(java.util.Map) NamedCache(com.tangosol.net.NamedCache)

Example 2 with VisualVMModel

use of com.oracle.coherence.plugin.visualvm.VisualVMModel in project coherence-visualvm by oracle.

the class AbstractDataRetrieverTest method testNodeStorageData.

/**
 * Test NodeStorageData.
 */
private void testNodeStorageData() {
    List<Map.Entry<Object, Data>> nodeStorageData;
    VisualVMModel model = getModel();
    assertClusterReady();
    waitForRefresh();
    // refresh the statistics
    model.refreshStatistics(getRequestSender());
    nodeStorageData = model.getData(VisualVMModel.DataType.NODE_STORAGE);
    assertThat(nodeStorageData.size(), is(2));
}
Also used : VisualVMModel(com.oracle.coherence.plugin.visualvm.VisualVMModel)

Example 3 with VisualVMModel

use of com.oracle.coherence.plugin.visualvm.VisualVMModel 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");
}
Also used : MemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.MemberData) ServiceData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceData) PersistenceData(com.oracle.coherence.plugin.visualvm.tablemodel.model.PersistenceData) FederationDestinationDetailsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationDestinationDetailsData) Data(com.oracle.coherence.plugin.visualvm.tablemodel.model.Data) FederationOriginDetailsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationOriginDetailsData) CacheDetailData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheDetailData) CacheData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheData) RamJournalData(com.oracle.coherence.plugin.visualvm.tablemodel.model.RamJournalData) ServiceMemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceMemberData) FederationData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationData) ClusterData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ClusterData) ProxyData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ProxyData) VisualVMModel(com.oracle.coherence.plugin.visualvm.VisualVMModel) Map(java.util.Map)

Example 4 with VisualVMModel

use of com.oracle.coherence.plugin.visualvm.VisualVMModel 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));
}
Also used : MemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.MemberData) ServiceData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceData) PersistenceData(com.oracle.coherence.plugin.visualvm.tablemodel.model.PersistenceData) FederationDestinationDetailsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationDestinationDetailsData) Data(com.oracle.coherence.plugin.visualvm.tablemodel.model.Data) FederationOriginDetailsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationOriginDetailsData) CacheDetailData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheDetailData) CacheData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheData) RamJournalData(com.oracle.coherence.plugin.visualvm.tablemodel.model.RamJournalData) ServiceMemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceMemberData) FederationData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationData) ClusterData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ClusterData) ProxyData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ProxyData) VisualVMModel(com.oracle.coherence.plugin.visualvm.VisualVMModel) Map(java.util.Map)

Example 5 with VisualVMModel

use of com.oracle.coherence.plugin.visualvm.VisualVMModel 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));
    }
}
Also used : MemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.MemberData) ServiceData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceData) PersistenceData(com.oracle.coherence.plugin.visualvm.tablemodel.model.PersistenceData) FederationDestinationDetailsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationDestinationDetailsData) Data(com.oracle.coherence.plugin.visualvm.tablemodel.model.Data) FederationOriginDetailsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationOriginDetailsData) CacheDetailData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheDetailData) CacheData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheData) RamJournalData(com.oracle.coherence.plugin.visualvm.tablemodel.model.RamJournalData) ServiceMemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceMemberData) FederationData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationData) ClusterData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ClusterData) ProxyData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ProxyData) VisualVMModel(com.oracle.coherence.plugin.visualvm.VisualVMModel) Map(java.util.Map)

Aggregations

VisualVMModel (com.oracle.coherence.plugin.visualvm.VisualVMModel)11 CacheData (com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheData)8 CacheDetailData (com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheDetailData)8 ClusterData (com.oracle.coherence.plugin.visualvm.tablemodel.model.ClusterData)8 Data (com.oracle.coherence.plugin.visualvm.tablemodel.model.Data)8 FederationData (com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationData)8 FederationDestinationDetailsData (com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationDestinationDetailsData)8 FederationOriginDetailsData (com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationOriginDetailsData)8 MemberData (com.oracle.coherence.plugin.visualvm.tablemodel.model.MemberData)8 PersistenceData (com.oracle.coherence.plugin.visualvm.tablemodel.model.PersistenceData)8 ProxyData (com.oracle.coherence.plugin.visualvm.tablemodel.model.ProxyData)8 RamJournalData (com.oracle.coherence.plugin.visualvm.tablemodel.model.RamJournalData)8 ServiceData (com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceData)8 ServiceMemberData (com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceMemberData)8 Map (java.util.Map)8 RequestSender (com.oracle.coherence.plugin.visualvm.helper.RequestSender)3 ExtensibleConfigurableCacheFactory (com.tangosol.net.ExtensibleConfigurableCacheFactory)3 NamedCache (com.tangosol.net.NamedCache)3 Test (org.junit.Test)2 Eventually (com.oracle.bedrock.testsupport.deferred.Eventually)1