use of org.apache.geode.internal.statistics.StatArchiveReader.ResourceInst in project geode by apache.
the class StatTypesAreRolledOverRegressionTest method verifyStatisticsTypeIsInArchiveFile.
private void verifyStatisticsTypeIsInArchiveFile(final File archiveFile, final int expectedResources) throws IOException {
StatArchiveReader reader = new StatArchiveReader(new File[] { archiveFile }, null, false);
// compare all resourceInst values against what was printed above
List<ResourceInst> resources = reader.getResourceInstList();
if (expectedResources > 0) {
assertThat(resources).hasAtLeastOneElementOfType(ResourceInst.class);
}
for (ResourceInst resourceInstance : resources) {
if (resourceInstance == null)
continue;
assertThat(resourceInstance.getName()).isNotNull();
assertThat(resourceInstance.getType()).isNotNull();
assertThat(resourceInstance.getType().getName()).isEqualTo(this.statisticsType.getName());
}
}
use of org.apache.geode.internal.statistics.StatArchiveReader.ResourceInst in project geode by apache.
the class ResourceInstTest method differentFirstTSidxIsNotEqual.
@Test
public void differentFirstTSidxIsNotEqual() throws Exception {
ResourceInst resourceInst1 = new ResourceInst(this.archive1, 0, "name", 0, this.resourceType, false);
setFirstTSidx(resourceInst1, 1);
ResourceInst resourceInst2 = new ResourceInst(this.archive1, 0, "name", 0, this.resourceType, false);
setFirstTSidx(resourceInst2, 2);
assertThat(resourceInst1).isNotEqualTo(resourceInst2);
}
use of org.apache.geode.internal.statistics.StatArchiveReader.ResourceInst in project geode by apache.
the class ResourceInstTest method sameFirstTSidxEquals.
@Test
public void sameFirstTSidxEquals() throws Exception {
ResourceInst resourceInst1 = new ResourceInst(this.archive1, 0, "name", 0, this.resourceType, false);
setFirstTSidx(resourceInst1, 1);
ResourceInst resourceInst2 = new ResourceInst(this.archive1, 0, "name", 0, this.resourceType, false);
setFirstTSidx(resourceInst2, 1);
assertThat(resourceInst1).isEqualTo(resourceInst2);
}
use of org.apache.geode.internal.statistics.StatArchiveReader.ResourceInst in project geode by apache.
the class StatArchiveWithConsecutiveResourceInstGenerator method validateArchiveFile.
protected void validateArchiveFile() throws IOException {
final File archiveFile = new File(this.archiveFileName);
assertTrue(archiveFile.exists());
logger.info("ArchiveFile: {}", archiveFile.getAbsolutePath());
logger.info("ArchiveFile length: {}", archiveFile.length());
for (ResourceInst resourceInst : findResourceInsts(archiveFile, STATS_SPEC_STRING)) {
logger.info("ResourceInst: {}", resourceInst);
}
}
use of org.apache.geode.internal.statistics.StatArchiveReader.ResourceInst in project geode by apache.
the class StatUtils method addResourceInstsToSet.
private static void addResourceInstsToSet(final File archiveFile, final String specString, final Set<ResourceInst> resourceInsts) throws IOException {
StatSpec statSpec = new StatSpec(specString);
StatArchiveReader reader = new StatArchiveReader(new File[] { archiveFile }, new StatSpec[] { statSpec }, true);
StatValue[] statValues = reader.matchSpec(statSpec);
for (StatValue statValue : statValues) {
for (ResourceInst resourceInst : statValue.getResources()) {
resourceInsts.add(resourceInst);
}
}
}
Aggregations