use of com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationDestinationDetailsData 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);
}
}
}
}
use of com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationDestinationDetailsData 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)));
}
Aggregations