Search in sources :

Example 1 with RequestSender

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

the class AbstractDataRetrieverTest method setClientProperties.

/**
 * Set properties for the client.
 */
private void setClientProperties() throws Exception {
    // now that the cluster is started, set the properties to turn off local clustering
    // so we don't connect with the process just started
    System.setProperty("tangosol.coherence.tcmp.enabled", "false");
    System.setProperty("tangosol.coherence.override", "test-client-cache-override.xml");
    System.setProperty("tangosol.coherence.cacheconfig", "test-client-cache-config.xml");
    RequestSender requestSender = getRequestSender();
    ObjectName objName = requestSender.getCompleteObjectName(new ObjectName("Coherence:type=Node,nodeId=1,*")).iterator().next();
    // get the multicast port
    int nMulticastPortNode1 = Integer.parseInt(requestSender.getAttribute(objName, "MulticastPort"));
    System.setProperty("remote.port", Integer.toString(nMulticastPortNode1));
}
Also used : RequestSender(com.oracle.coherence.plugin.visualvm.helper.RequestSender) ObjectName(javax.management.ObjectName)

Example 2 with RequestSender

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

the class AbstractDataRetrieverTest method testGetAllAttributes.

/**
 * Test getAllAttributes for both {@link RequestSender}s.
 */
private void testGetAllAttributes() throws Exception {
    RequestSender requestSender = getRequestSender();
    String sQuery = "Coherence:type=StorageManager,service=" + DIST1_SERVICE + ",cache=" + DIST1_CACHE + ",nodeId=1,*";
    Set<ObjectName> setObjects = requestSender.getCompleteObjectName(new ObjectName(sQuery));
    for (Iterator<ObjectName> iter = setObjects.iterator(); iter.hasNext(); ) {
        ObjectName objName = iter.next();
        List<Attribute> lstAttr = requestSender.getAllAttributes(objName);
        assertNotNull(lstAttr);
        assertTrue(lstAttr.size() > 0);
    }
}
Also used : RequestSender(com.oracle.coherence.plugin.visualvm.helper.RequestSender) Attribute(javax.management.Attribute) ObjectName(javax.management.ObjectName)

Example 3 with RequestSender

use of com.oracle.coherence.plugin.visualvm.helper.RequestSender 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 4 with RequestSender

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

the class AbstractDataRetrieverTest method testCacheData.

/**
 * Test the retrieval of CacheData via the VisualVMModel.
 */
private void testCacheData() throws Exception {
    final int INSERT1_COUNT = 10000;
    final int INSERT2_COUNT = 7500;
    final int INSERT3_COUNT = 100;
    final int DATA_SIZE = 250;
    List<Map.Entry<Object, Data>> cacheData;
    List<Map.Entry<Object, Data>> cacheDetailData;
    List<Map.Entry<Object, Data>> cacheStorageData;
    VisualVMModel model = getModel();
    RequestSender requestSender = getRequestSender();
    assertClusterReady();
    waitForRefresh();
    // refresh the statistics
    model.refreshStatistics(requestSender);
    cacheData = model.getData(VisualVMModel.DataType.CACHE);
    setCurrentDataType(VisualVMModel.DataType.CACHE);
    setClientProperties();
    ExtensibleConfigurableCacheFactory eccf = getECCF();
    // now add 2 caches on 2 different services - note we are connecting via Extend
    NamedCache nc1 = eccf.ensureCache(DIST1_CACHE, null);
    NamedCache nc2 = eccf.ensureCache(DIST2_CACHE, null);
    NamedCache nc3 = eccf.ensureCache(REPL_CACHE, null);
    populateRandomData(nc1, INSERT1_COUNT, DATA_SIZE);
    populateRandomData(nc2, INSERT2_COUNT, DATA_SIZE);
    populateRandomData(nc3, INSERT3_COUNT, DATA_SIZE);
    assertTrue(nc1.size() == INSERT1_COUNT);
    assertTrue(nc2.size() == INSERT2_COUNT);
    assertTrue(nc3.size() == INSERT3_COUNT);
    waitForRefresh();
    model.refreshStatistics(requestSender);
    cacheData = model.getData(VisualVMModel.DataType.CACHE);
    Map.Entry<Object, Data> distCache1 = getData(cacheData, new Pair<>(DIST1_SERVICE, DIST1_CACHE));
    Map.Entry<Object, Data> distCache2 = getData(cacheData, new Pair<>(DIST2_SERVICE, DIST2_CACHE));
    Map.Entry<Object, Data> replCache1 = getData(cacheData, new Pair<>(REPLICATED_SERVICE, REPL_CACHE));
    // validate the data returned where its deterministic
    validateColumnNotNull(CacheData.SIZE, distCache1);
    validateColumn(CacheData.CACHE_NAME, distCache1, getCacheName(DIST1_SERVICE, DIST1_CACHE));
    validateColumnNotNull(CacheData.SIZE, distCache2);
    validateColumn(CacheData.CACHE_NAME, distCache2, getCacheName(DIST2_SERVICE, DIST2_CACHE));
    validateColumnNotNull(CacheData.SIZE, replCache1);
    validateColumn(CacheData.CACHE_NAME, replCache1, getCacheName(REPLICATED_SERVICE, REPL_CACHE));
    validateColumn(CacheData.UNIT_CALCULATOR, distCache1, "BINARY");
    // select the first service, which should then generate both CacheDetailData and
    // CacheStorageManagerData on next refresh
    model.setSelectedCache(new Pair<>(DIST1_SERVICE, DIST1_CACHE));
    // do 2 gets
    nc1.get(0);
    nc1.get(INSERT1_COUNT - 1);
    waitForRefresh();
    model.refreshStatistics(getRequestSender());
    cacheDetailData = model.getData(VisualVMModel.DataType.CACHE_DETAIL);
    cacheStorageData = model.getData(VisualVMModel.DataType.CACHE_STORAGE_MANAGER);
    setCurrentDataType(VisualVMModel.DataType.CACHE_DETAIL);
    validateData(VisualVMModel.DataType.CACHE_DETAIL, cacheDetailData, 2);
    setCurrentDataType(VisualVMModel.DataType.CACHE_STORAGE_MANAGER);
    validateData(VisualVMModel.DataType.CACHE_STORAGE_MANAGER, cacheStorageData, 2);
    // validate the CacheDetail data
    Map.Entry<Object, Data> entryDetail1 = cacheDetailData.get(0);
    Map.Entry<Object, Data> entryDetail2 = cacheDetailData.get(1);
    validateColumn(CacheDetailData.NODE_ID, entryDetail1, 1);
    validateColumn(CacheDetailData.NODE_ID, entryDetail2, 2);
    // call the dependent tests as we can't guarantee execution order in JUnit
    testPersistenceData();
    testProxyData();
    if (isCommercial()) {
        testElasticData();
    }
}
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)

Aggregations

RequestSender (com.oracle.coherence.plugin.visualvm.helper.RequestSender)4 VisualVMModel (com.oracle.coherence.plugin.visualvm.VisualVMModel)2 CacheData (com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheData)2 CacheDetailData (com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheDetailData)2 ClusterData (com.oracle.coherence.plugin.visualvm.tablemodel.model.ClusterData)2 Data (com.oracle.coherence.plugin.visualvm.tablemodel.model.Data)2 FederationData (com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationData)2 FederationDestinationDetailsData (com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationDestinationDetailsData)2 FederationOriginDetailsData (com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationOriginDetailsData)2 MemberData (com.oracle.coherence.plugin.visualvm.tablemodel.model.MemberData)2 PersistenceData (com.oracle.coherence.plugin.visualvm.tablemodel.model.PersistenceData)2 ProxyData (com.oracle.coherence.plugin.visualvm.tablemodel.model.ProxyData)2 RamJournalData (com.oracle.coherence.plugin.visualvm.tablemodel.model.RamJournalData)2 ServiceData (com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceData)2 ServiceMemberData (com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceMemberData)2 ExtensibleConfigurableCacheFactory (com.tangosol.net.ExtensibleConfigurableCacheFactory)2 NamedCache (com.tangosol.net.NamedCache)2 Map (java.util.Map)2 ObjectName (javax.management.ObjectName)2 Attribute (javax.management.Attribute)1