Search in sources :

Example 1 with FederationOriginDetailsData

use of com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationOriginDetailsData in project coherence-visualvm by oracle.

the class VisualVMModel method init.

// ---- helper methods --------------------------------------------------
/**
 * Initialize anything for this instance of the model.
 */
private void init() {
    m_nRefreshTime = getRefreshTime();
    m_fLogJMXQueryTimes = isLogQueryTimes();
    String sReporterDisabled = System.getProperty(PROP_REPORTER_DISABLED);
    // version >= 12.1.3
    if ("true".equalsIgnoreCase(sReporterDisabled)) {
        setReporterAvailable(false);
    }
    // force update on first time
    m_ldtLastUpdate = System.currentTimeMillis() - m_nRefreshTime - 1L;
    // populate mapCollectedData which contains an entry for each type
    m_mapCollectedData = new HashMap<DataType, List<Entry<Object, Data>>>();
    for (DataType type : DataType.values()) {
        m_mapCollectedData.put(type, null);
    }
    // intialize the data retrievers map
    f_mapDataRetrievers.put(CacheData.class, new CacheData());
    f_mapDataRetrievers.put(ClusterData.class, new ClusterData());
    f_mapDataRetrievers.put(MemberData.class, new MemberData());
    f_mapDataRetrievers.put(ServiceData.class, new ServiceData());
    f_mapDataRetrievers.put(ServiceMemberData.class, new ServiceMemberData());
    f_mapDataRetrievers.put(ProxyData.class, new ProxyData());
    f_mapDataRetrievers.put(MachineData.class, new MachineData());
    f_mapDataRetrievers.put(CacheDetailData.class, new CacheDetailData());
    f_mapDataRetrievers.put(CacheFrontDetailData.class, new CacheFrontDetailData());
    f_mapDataRetrievers.put(TopicData.class, new TopicData());
    f_mapDataRetrievers.put(PersistenceData.class, new PersistenceData());
    f_mapDataRetrievers.put(PersistenceNotificationsData.class, new PersistenceNotificationsData());
    f_mapDataRetrievers.put(CacheStorageManagerData.class, new CacheStorageManagerData());
    f_mapDataRetrievers.put(HttpSessionData.class, new HttpSessionData());
    f_mapDataRetrievers.put(FederationDestinationData.class, new FederationDestinationData());
    f_mapDataRetrievers.put(FederationDestinationDetailsData.class, new FederationDestinationDetailsData());
    f_mapDataRetrievers.put(FederationOriginData.class, new FederationOriginData());
    f_mapDataRetrievers.put(FederationOriginDetailsData.class, new FederationOriginDetailsData());
    f_mapDataRetrievers.put(RamJournalData.class, new RamJournalData());
    f_mapDataRetrievers.put(FlashJournalData.class, new FlashJournalData());
    f_mapDataRetrievers.put(JCacheConfigurationData.class, new JCacheConfigurationData());
    f_mapDataRetrievers.put(JCacheStatisticsData.class, new JCacheStatisticsData());
    f_mapDataRetrievers.put(HttpProxyData.class, new HttpProxyData());
    f_mapDataRetrievers.put(HttpProxyMemberData.class, new HttpProxyMemberData());
    f_mapDataRetrievers.put(HotCacheData.class, new HotCacheData());
    f_mapDataRetrievers.put(HotCachePerCacheData.class, new HotCachePerCacheData());
    f_mapDataRetrievers.put(NodeStorageData.class, new NodeStorageData());
    f_mapDataRetrievers.put(ExecutorData.class, new ExecutorData());
    f_mapDataRetrievers.put(GrpcProxyData.class, new GrpcProxyData());
    // Loop through each data retriever and initialize the map of
    // report XML. Doing it this way we load it only once
    Iterator<Map.Entry<Class, DataRetriever>> iter = f_mapDataRetrievers.entrySet().iterator();
    while (iter.hasNext()) {
        Map.Entry<Class, DataRetriever> entry = iter.next();
        String sReport = entry.getValue().getReporterReport();
        if (sReport != null) {
            String sReportXML = getReportXML(sReport);
            if (sReportXML != null) {
                f_mapReportXML.put(entry.getKey(), sReportXML);
            }
        }
    }
}
Also used : PersistenceNotificationsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.PersistenceNotificationsData) HttpProxyMemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.HttpProxyMemberData) CacheData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheData) HotCachePerCacheData(com.oracle.coherence.plugin.visualvm.tablemodel.model.HotCachePerCacheData) HotCacheData(com.oracle.coherence.plugin.visualvm.tablemodel.model.HotCacheData) TopicData(com.oracle.coherence.plugin.visualvm.tablemodel.model.TopicData) FederationDestinationData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationDestinationData) ServiceMemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceMemberData) HotCacheData(com.oracle.coherence.plugin.visualvm.tablemodel.model.HotCacheData) HttpSessionData(com.oracle.coherence.plugin.visualvm.tablemodel.model.HttpSessionData) MachineData(com.oracle.coherence.plugin.visualvm.tablemodel.model.MachineData) CacheDetailData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheDetailData) Entry(java.util.Map.Entry) HttpProxyData(com.oracle.coherence.plugin.visualvm.tablemodel.model.HttpProxyData) GrpcProxyData(com.oracle.coherence.plugin.visualvm.tablemodel.model.GrpcProxyData) ProxyData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ProxyData) CacheFrontDetailData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheFrontDetailData) HttpProxyData(com.oracle.coherence.plugin.visualvm.tablemodel.model.HttpProxyData) FederationDestinationDetailsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationDestinationDetailsData) HotCachePerCacheData(com.oracle.coherence.plugin.visualvm.tablemodel.model.HotCachePerCacheData) List(java.util.List) ArrayList(java.util.ArrayList) FlashJournalData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FlashJournalData) NodeStorageData(com.oracle.coherence.plugin.visualvm.tablemodel.model.NodeStorageData) ServiceMemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceMemberData) HttpProxyMemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.HttpProxyMemberData) MemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.MemberData) PersistenceData(com.oracle.coherence.plugin.visualvm.tablemodel.model.PersistenceData) FederationOriginData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationOriginData) JCacheConfigurationData(com.oracle.coherence.plugin.visualvm.tablemodel.model.JCacheConfigurationData) GrpcProxyData(com.oracle.coherence.plugin.visualvm.tablemodel.model.GrpcProxyData) NodeStorageData(com.oracle.coherence.plugin.visualvm.tablemodel.model.NodeStorageData) PersistenceData(com.oracle.coherence.plugin.visualvm.tablemodel.model.PersistenceData) PersistenceNotificationsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.PersistenceNotificationsData) HttpProxyData(com.oracle.coherence.plugin.visualvm.tablemodel.model.HttpProxyData) GrpcProxyData(com.oracle.coherence.plugin.visualvm.tablemodel.model.GrpcProxyData) FederationOriginDetailsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationOriginDetailsData) CacheData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheData) ServiceMemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceMemberData) FederationOriginData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationOriginData) ClusterData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ClusterData) CacheFrontDetailData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheFrontDetailData) ProxyData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ProxyData) HttpProxyMemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.HttpProxyMemberData) HotCachePerCacheData(com.oracle.coherence.plugin.visualvm.tablemodel.model.HotCachePerCacheData) MemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.MemberData) CacheStorageManagerData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheStorageManagerData) MachineData(com.oracle.coherence.plugin.visualvm.tablemodel.model.MachineData) ExecutorData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ExecutorData) ServiceData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceData) HttpSessionData(com.oracle.coherence.plugin.visualvm.tablemodel.model.HttpSessionData) JCacheConfigurationData(com.oracle.coherence.plugin.visualvm.tablemodel.model.JCacheConfigurationData) FederationDestinationDetailsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationDestinationDetailsData) JCacheStatisticsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.JCacheStatisticsData) Data(com.oracle.coherence.plugin.visualvm.tablemodel.model.Data) FlashJournalData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FlashJournalData) CacheDetailData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheDetailData) RamJournalData(com.oracle.coherence.plugin.visualvm.tablemodel.model.RamJournalData) TopicData(com.oracle.coherence.plugin.visualvm.tablemodel.model.TopicData) HotCacheData(com.oracle.coherence.plugin.visualvm.tablemodel.model.HotCacheData) FederationDestinationData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationDestinationData) DataRetriever(com.oracle.coherence.plugin.visualvm.tablemodel.model.DataRetriever) FederationOriginDetailsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationOriginDetailsData) ServiceData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceData) ExecutorData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ExecutorData) CacheStorageManagerData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheStorageManagerData) ClusterData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ClusterData) RamJournalData(com.oracle.coherence.plugin.visualvm.tablemodel.model.RamJournalData) Map(java.util.Map) SortedMap(java.util.SortedMap) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap) JCacheStatisticsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.JCacheStatisticsData)

Example 2 with FederationOriginDetailsData

use of com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationOriginDetailsData in project coherence-visualvm by oracle.

the class AbstractDataRetrieverTest method testFederationData.

/**
 * Test the retrieval of FederationData via the VisualVMModel.
 */
public void testFederationData() {
    if (Boolean.getBoolean(PROP_REPORTER_DISABLED)) {
        return;
    }
    final int INSERT_COUNT = 100;
    final int INSERT_COUNT2 = 2 * INSERT_COUNT;
    final int DATA_SIZE = 250;
    List<Map.Entry<Object, Data>> federationOriginData;
    List<Map.Entry<Object, Data>> federationOriginDetailsData;
    List<Map.Entry<Object, Data>> federationDestinationData;
    List<Map.Entry<Object, Data>> federationDestinationDetailsData;
    VisualVMModel model = getModel();
    assertClusterReady();
    NamedCache ncA = s_memberA1.getCache(FED_CACHE);
    populateRandomData(ncA, INSERT_COUNT, DATA_SIZE);
    assertThat(ncA.size(), is(INSERT_COUNT));
    NamedCache ncB = s_memberB1.getCache(FED_CACHE);
    populateRandomData(ncB, INSERT_COUNT2, DATA_SIZE);
    assertThat(ncB.size(), is(INSERT_COUNT2));
    // wait for the data to get to the destination
    // size should be 200 as the keys always start at 0 so the first 100 are updates
    Eventually.assertDeferred(() -> ncA.size(), is(INSERT_COUNT2));
    // select a service participant
    model.setSelectedServiceParticipant(new Pair<String, String>(FEDERATED_SERVICE, "ClusterB"));
    waitForRefresh();
    waitForRefresh();
    model.refreshStatistics(getRequestSender());
    federationDestinationData = model.getData(VisualVMModel.DataType.FEDERATION_DESTINATION);
    setCurrentDataType(VisualVMModel.DataType.FEDERATION_DESTINATION);
    validateColumn(FederationData.Column.PARTICIPANT.getColumn(), federationDestinationData.get(0), "ClusterB");
    federationDestinationDetailsData = model.getData(VisualVMModel.DataType.FEDERATION_DESTINATION_DETAILS);
    setCurrentDataType(VisualVMModel.DataType.FEDERATION_DESTINATION_DETAILS);
    Assert.assertNotNull(federationDestinationDetailsData);
    List<Long> listDestEntriesSent = federationDestinationDetailsData.stream().map(e -> (Long) getColumn(FederationDestinationDetailsData.Column.TOTAL_ENTRIES_SENT.getColumn() - 1, e)).collect(Collectors.toList());
    long lTotalDestEntriesSent = listDestEntriesSent.stream().mapToLong(Long::longValue).sum();
    assertThat("Incorrect total destination entries sent with " + listDestEntriesSent, lTotalDestEntriesSent, is(INSERT_COUNT * 1L));
    federationOriginData = model.getData(VisualVMModel.DataType.FEDERATION_ORIGIN);
    setCurrentDataType(VisualVMModel.DataType.FEDERATION_ORIGIN);
    String sParticipant = (String) getColumn(FederationData.Column.PARTICIPANT.getColumn(), federationOriginData.get(0));
    assertThat("Expected ClusterB, but got " + sParticipant, sParticipant, is("ClusterB"));
    federationOriginDetailsData = model.getData(VisualVMModel.DataType.FEDERATION_ORIGIN_DETAILS);
    setCurrentDataType(VisualVMModel.DataType.FEDERATION_ORIGIN_DETAILS);
    long lTotalOrigEntriesSent = federationOriginDetailsData.stream().map(e -> (Long) getColumn(FederationOriginDetailsData.Column.TOTAL_ENTRIES_RECEIVED.getColumn() - 1, e)).reduce(0L, Long::sum);
    assertThat(federationOriginDetailsData, is(notNullValue()));
    assertThat("Total origin entries sent should be positive.", lTotalOrigEntriesSent, is(greaterThan(0L)));
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) VisualVMModel(com.oracle.coherence.plugin.visualvm.VisualVMModel) MemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.MemberData) URL(java.net.URL) Pair(com.oracle.coherence.plugin.visualvm.tablemodel.model.Pair) CoreMatchers.notNullValue(org.hamcrest.CoreMatchers.notNullValue) Assert.assertThat(org.junit.Assert.assertThat) ServiceData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceData) Attribute(javax.management.Attribute) RequestSender(com.oracle.coherence.plugin.visualvm.helper.RequestSender) Map(java.util.Map) PersistenceData(com.oracle.coherence.plugin.visualvm.tablemodel.model.PersistenceData) ExtensibleConfigurableCacheFactory(com.tangosol.net.ExtensibleConfigurableCacheFactory) FederationDestinationDetailsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationDestinationDetailsData) NamedCache(com.tangosol.net.NamedCache) AfterClass(org.junit.AfterClass) PROP_REPORTER_DISABLED(com.oracle.coherence.plugin.visualvm.VisualVMModel.PROP_REPORTER_DISABLED) Data(com.oracle.coherence.plugin.visualvm.tablemodel.model.Data) Iterator(java.util.Iterator) FederationOriginDetailsData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationOriginDetailsData) Coherence(com.tangosol.coherence.component.application.console.Coherence) Assert.assertNotNull(org.junit.Assert.assertNotNull) CacheDetailData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheDetailData) CacheData(com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheData) Set(java.util.Set) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) RamJournalData(com.oracle.coherence.plugin.visualvm.tablemodel.model.RamJournalData) ObjectName(javax.management.ObjectName) Collectors(java.util.stream.Collectors) ServiceMemberData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceMemberData) List(java.util.List) CacheFactory(com.tangosol.net.CacheFactory) ProtectionDomain(java.security.ProtectionDomain) Matchers.greaterThan(org.hamcrest.Matchers.greaterThan) FederationData(com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationData) CodeSource(java.security.CodeSource) ClusterData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ClusterData) Assert(org.junit.Assert) ProxyData(com.oracle.coherence.plugin.visualvm.tablemodel.model.ProxyData) Eventually(com.oracle.bedrock.testsupport.deferred.Eventually) VisualVMModel(com.oracle.coherence.plugin.visualvm.VisualVMModel) NamedCache(com.tangosol.net.NamedCache)

Aggregations

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 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 List (java.util.List)2 Map (java.util.Map)2 Eventually (com.oracle.bedrock.testsupport.deferred.Eventually)1 VisualVMModel (com.oracle.coherence.plugin.visualvm.VisualVMModel)1 PROP_REPORTER_DISABLED (com.oracle.coherence.plugin.visualvm.VisualVMModel.PROP_REPORTER_DISABLED)1 RequestSender (com.oracle.coherence.plugin.visualvm.helper.RequestSender)1 CacheFrontDetailData (com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheFrontDetailData)1 CacheStorageManagerData (com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheStorageManagerData)1