try { this.dataOut.writeByte(RESOURCE_INSTANCE_CREATE_TOKEN); this.dataOut.writeInt(statResource.getId()); this.dataOut.writeUTF(statResource.getStatistics().getTextId()); this.dataOut.writeLong(statResource.getStatistics().getNumericId()); && (traceStatisticsTypeName == null || traceStatisticsTypeName .equals(statResource.getResourceType().getStatisticsType().getName()))) { traceResourceInstId = statResource.getId(); this.traceDataOut.println("writeHeader traceResourceInstId: " + traceResourceInstId); this.traceDataOut + RESOURCE_INSTANCE_CREATE_TOKEN); this.traceDataOut.println( "allocatedResourceInstance#writeInt statResource.getId(): " + statResource.getId()); this.traceDataOut .println("allocatedResourceInstance#writeUTF statResource.getStatistics().getTextId(): "
if (!wroteInstId) { wroteInstId = true; writeResourceInst(ri.getId());
@Test public void testNotificationResourceInstances() throws Exception { final int resourceInstanceCount = 100; final List<ResourceInstance> resourceInstances = new ArrayList<ResourceInstance>(); for (int i = 0; i < resourceInstanceCount; i++) { resourceInstances.add(new ResourceInstance(i, null, null)); } StatMonitorHandler handler = new StatMonitorHandler(); TestStatisticsMonitor monitor = new TestStatisticsMonitor(); handler.addMonitor(monitor); handler.sampled(NanoTimer.getTime(), Collections.unmodifiableList(resourceInstances)); waitForNotificationCount(monitor, 1, 2 * 1000, 10, false); final List<ResourceInstance> notificationResourceInstances = monitor.getResourceInstances(); assertNotNull(notificationResourceInstances); assertEquals(resourceInstances, notificationResourceInstances); assertEquals(resourceInstanceCount, notificationResourceInstances.size()); int i = 0; for (ResourceInstance resourceInstance : notificationResourceInstances) { assertEquals(i, resourceInstance.getId()); i++; } }
ResourceInstance resourceInstance = allocatedResourceInstanceInfo.getResourceInstance(); assertNotNull(resourceInstance); assertEquals(0, resourceInstance.getId()); assertEquals(1, resourceInstance.getUpdatedStats().length); assertEquals(1, resourceInstance.getLatestStatValues().length); // TODO: is this correct?
ResourceInstance resourceInstance = allocatedResourceInstanceInfo.getResourceInstance(); assertNotNull(resourceInstance); assertEquals(0, resourceInstance.getId()); assertEquals(0, resourceInstance.getUpdatedStats().length); assertEquals(1, resourceInstance.getLatestStatValues().length); // TODO: is this correct? resourceInstance = allocatedResourceInstanceInfo.getResourceInstance(); assertNotNull(resourceInstance); assertEquals(1, resourceInstance.getId()); assertEquals(1, resourceInstance.getUpdatedStats().length); assertEquals(1, resourceInstance.getLatestStatValues().length); // TODO: is this correct? resourceInstance = allocatedResourceInstanceInfo.getResourceInstance(); assertNotNull(resourceInstance); assertEquals(2, resourceInstance.getId()); assertEquals(1, resourceInstance.getUpdatedStats().length); assertEquals(1, resourceInstance.getLatestStatValues().length); // TODO: is this correct?