geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [06/23] incubator-geode git commit: GEODE-1781: repackage internal statistics classes and refactor statistics tests
Date Mon, 15 Aug 2016 18:43:34 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/866bacec/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/SampleCollectorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/SampleCollectorJUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/SampleCollectorJUnitTest.java
deleted file mode 100755
index 1babbc1..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/SampleCollectorJUnitTest.java
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.statistics;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
-
-import java.io.File;
-import java.util.List;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.StatisticDescriptor;
-import com.gemstone.gemfire.Statistics;
-import com.gemstone.gemfire.StatisticsType;
-import com.gemstone.gemfire.internal.NanoTimer;
-import com.gemstone.gemfire.internal.statistics.TestSampleHandler.Info;
-import com.gemstone.gemfire.internal.statistics.TestSampleHandler.ResourceInstanceInfo;
-import com.gemstone.gemfire.internal.statistics.TestSampleHandler.ResourceTypeInfo;
-import com.gemstone.gemfire.internal.statistics.TestSampleHandler.SampledInfo;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-/**
- * Unit tests for the SampleCollector class. No disk IO.
- *   
- * @since GemFire 7.0
- */
-@Category(UnitTest.class)
-public class SampleCollectorJUnitTest {
-
-  private TestStatisticsManager manager;
-  private SampleCollector sampleCollector;
-  
-  @Before
-  public void setUp() throws Exception {
-    final long startTime = System.currentTimeMillis();
-    this.manager = new TestStatisticsManager(1, getClass().getSimpleName(), startTime);
-
-    final StatArchiveHandlerConfig mockStatArchiveHandlerConfig = mock(StatArchiveHandlerConfig.class,
getClass().getSimpleName() + "$" + StatArchiveHandlerConfig.class.getSimpleName());
-    when(mockStatArchiveHandlerConfig.getArchiveFileName()).thenReturn(new File(""));
-    when(mockStatArchiveHandlerConfig.getArchiveFileSizeLimit()).thenReturn(0L);
-    when(mockStatArchiveHandlerConfig.getArchiveDiskSpaceLimit()).thenReturn(0L);
-    when(mockStatArchiveHandlerConfig.getSystemId()).thenReturn(0L);
-    when(mockStatArchiveHandlerConfig.getSystemStartTime()).thenReturn(startTime);
-    when(mockStatArchiveHandlerConfig.getSystemDirectoryPath()).thenReturn("");
-    when(mockStatArchiveHandlerConfig.getProductDescription()).thenReturn(getClass().getSimpleName());
-
-    final StatisticsSampler sampler = new TestStatisticsSampler(manager);
-    this.sampleCollector = new SampleCollector(sampler);
-    this.sampleCollector.initialize(mockStatArchiveHandlerConfig, NanoTimer.getTime());
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    if (this.sampleCollector != null) {
-      this.sampleCollector.close();
-      this.sampleCollector = null;
-    }
-    this.manager = null;
-  }
-  
-  @Test
-  public void testAddHandlerBeforeSample() {
-    TestSampleHandler handler = new TestSampleHandler();
-    this.sampleCollector.addSampleHandler(handler);
-
-    StatisticDescriptor[] statsST1 = new StatisticDescriptor[] {
-        manager.createIntCounter("ST1_1_name", "ST1_1_desc", "ST1_1_units")
-    };
-    StatisticsType ST1 = manager.createType("ST1_name", "ST1_desc", statsST1);
-    Statistics st1_1 = manager.createAtomicStatistics(ST1, "st1_1_text", 1);
-    
-    this.sampleCollector.sample(NanoTimer.getTime());
-    
-    assertEquals(3, handler.getNotificationCount());
-    List<Info> notifications = handler.getNotifications(); 
-    
-    // validate the allocatedResourceType notification
-    assertTrue(notifications.get(0) instanceof ResourceTypeInfo);
-    ResourceTypeInfo allocatedResourceTypeInfo = (ResourceTypeInfo) notifications.get(0);
-    assertNotNull(allocatedResourceTypeInfo);
-    assertEquals("allocatedResourceType", allocatedResourceTypeInfo.getName());
-    ResourceType resourceType = allocatedResourceTypeInfo.getResourceType();
-    assertNotNull(resourceType);
-    assertEquals(0, resourceType.getId());
-    assertEquals(1, resourceType.getStatisticDescriptors().length);
-    StatisticsType statisticsType = resourceType.getStatisticsType();
-    assertNotNull(statisticsType);
-    assertTrue(statisticsType == ST1);
-    assertEquals("ST1_name", statisticsType.getName());
-    assertEquals("ST1_desc", statisticsType.getDescription());
-    assertEquals(1, statisticsType.getStatistics().length);
-    
-    // validate the allocatedResourceInstance notification
-    assertTrue(notifications.get(1) instanceof ResourceInstanceInfo);
-    ResourceInstanceInfo allocatedResourceInstanceInfo = (ResourceInstanceInfo) notifications.get(1);
-    assertNotNull(allocatedResourceInstanceInfo);
-    assertEquals("allocatedResourceInstance", allocatedResourceInstanceInfo.getName());
-    ResourceInstance resourceInstance = allocatedResourceInstanceInfo.getResourceInstance();
-    assertNotNull(resourceInstance);
-    assertEquals(0, resourceInstance.getId());
-    assertEquals(1, resourceInstance.getUpdatedStats().length);
-    assertEquals(1, resourceInstance.getLatestStatValues().length); // TODO: is this correct?
-    Statistics statistics = resourceInstance.getStatistics();
-    assertNotNull(statistics);
-    assertTrue(statistics == st1_1);
-    assertEquals(1, statistics.getUniqueId());
-    assertEquals(1, statistics.getNumericId());
-    assertEquals("st1_1_text", statistics.getTextId());
-    assertEquals("ST1_name", statistics.getType().getName());
-    assertTrue(resourceType == resourceInstance.getResourceType());
-    
-    // validate the sampled notification
-    assertTrue(notifications.get(2) instanceof SampledInfo);
-    SampledInfo sampledInfo = (SampledInfo) notifications.get(2);
-    assertNotNull(sampledInfo);
-    assertEquals("sampled", sampledInfo.getName());
-    assertEquals(1, sampledInfo.getResourceCount());
-  }
-  
-  @Test
-  public void testAddHandlerAfterSamples() {
-    StatisticDescriptor[] statsST1 = new StatisticDescriptor[] {
-        manager.createIntCounter("ST1_1_name", "ST1_1_desc", "ST1_1_units")
-    };
-    StatisticsType ST1 = manager.createType("ST1_name", "ST1_desc", statsST1);
-    Statistics st1_1 = manager.createAtomicStatistics(ST1, "st1_1_text", 1);
-    Statistics st1_2 = manager.createAtomicStatistics(ST1, "st1_2_text", 1);
-
-    StatisticDescriptor[] statsST2 = new StatisticDescriptor[] {
-        manager.createIntCounter("ST2_1_name", "ST2_1_desc", "ST2_1_units")
-    };
-    StatisticsType ST2 = manager.createType("ST2_name", "ST2_desc", statsST2);
-    Statistics st2_1 = manager.createAtomicStatistics(ST2, "st2_1_text", 1);
-    
-    st1_1.incInt("ST1_1_name", 1);
-    st1_2.incInt("ST1_1_name", 1);
-    st2_1.incInt("ST2_1_name", 1);
-    long sampleTime = NanoTimer.getTime();
-    this.sampleCollector.sample(sampleTime);
-
-    st1_1.incInt("ST1_1_name", 2);
-    st2_1.incInt("ST2_1_name", 1);
-    sampleTime += NanoTimer.millisToNanos(1000);
-    this.sampleCollector.sample(sampleTime);
-
-    st1_1.incInt("ST1_1_name", 1);
-    st1_1.incInt("ST1_1_name", 2);
-    sampleTime += NanoTimer.millisToNanos(1000);
-    this.sampleCollector.sample(sampleTime);
-
-    TestSampleHandler handler = new TestSampleHandler();
-    this.sampleCollector.addSampleHandler(handler);
-    
-    assertEquals("TestSampleHandler = " + handler, 0, handler.getNotificationCount());
-
-    st1_2.incInt("ST1_1_name", 1);
-    st2_1.incInt("ST2_1_name", 1);
-    sampleTime += NanoTimer.millisToNanos(1000);
-    this.sampleCollector.sample(sampleTime);
-
-    assertEquals(6, handler.getNotificationCount());
-    List<Info> notifications = handler.getNotifications();
-
-    // validate the allocatedResourceType notification for ST1
-    int notificationIdx = 0;
-    assertTrue(notifications.get(notificationIdx) instanceof ResourceTypeInfo);
-    ResourceTypeInfo allocatedResourceTypeInfo = (ResourceTypeInfo) notifications.get(notificationIdx);
-    assertNotNull(allocatedResourceTypeInfo);
-    assertEquals("allocatedResourceType", allocatedResourceTypeInfo.getName());
-    ResourceType resourceType = allocatedResourceTypeInfo.getResourceType();
-    assertNotNull(resourceType);
-    assertEquals(0, resourceType.getId());
-    assertEquals(1, resourceType.getStatisticDescriptors().length);
-    StatisticsType statisticsType = resourceType.getStatisticsType();
-    assertNotNull(statisticsType);
-    assertTrue(statisticsType == ST1);
-    assertEquals("ST1_name", statisticsType.getName());
-    assertEquals("ST1_desc", statisticsType.getDescription());
-    assertEquals(1, statisticsType.getStatistics().length);
-
-    // validate the allocatedResourceInstance notification for st1_1
-    notificationIdx++;
-    assertTrue(notifications.get(notificationIdx) instanceof ResourceInstanceInfo);
-    ResourceInstanceInfo allocatedResourceInstanceInfo = (ResourceInstanceInfo) notifications.get(notificationIdx);
-    assertNotNull(allocatedResourceInstanceInfo);
-    assertEquals("allocatedResourceInstance", allocatedResourceInstanceInfo.getName());
-    ResourceInstance resourceInstance = allocatedResourceInstanceInfo.getResourceInstance();
-    assertNotNull(resourceInstance);
-    assertEquals(0, resourceInstance.getId());
-    assertEquals(0, resourceInstance.getUpdatedStats().length);
-    assertEquals(1, resourceInstance.getLatestStatValues().length); // TODO: is this correct?
-    Statistics statistics = resourceInstance.getStatistics();
-    assertNotNull(statistics);
-    assertTrue(statistics == st1_1);
-    assertEquals(1, statistics.getUniqueId());
-    assertEquals(1, statistics.getNumericId());
-    assertEquals("st1_1_text", statistics.getTextId());
-    assertEquals("ST1_name", statistics.getType().getName());
-    assertTrue(resourceType == resourceInstance.getResourceType());
-    
-    // validate the allocatedResourceInstance notification for st1_2
-    notificationIdx++;
-    assertTrue(notifications.get(notificationIdx) instanceof ResourceInstanceInfo);
-    allocatedResourceInstanceInfo = (ResourceInstanceInfo) notifications.get(notificationIdx);
-    assertNotNull(allocatedResourceInstanceInfo);
-    assertEquals("allocatedResourceInstance", allocatedResourceInstanceInfo.getName());
-    resourceInstance = allocatedResourceInstanceInfo.getResourceInstance();
-    assertNotNull(resourceInstance);
-    assertEquals(1, resourceInstance.getId());
-    assertEquals(1, resourceInstance.getUpdatedStats().length);
-    assertEquals(1, resourceInstance.getLatestStatValues().length); // TODO: is this correct?
-    statistics = resourceInstance.getStatistics();
-    assertNotNull(statistics);
-    assertTrue(statistics == st1_2);
-    assertEquals(2, statistics.getUniqueId());
-    assertEquals(1, statistics.getNumericId());
-    assertEquals("st1_2_text", statistics.getTextId());
-    assertEquals("ST1_name", statistics.getType().getName());
-    assertTrue(resourceType == resourceInstance.getResourceType());
-    
-    // validate the allocatedResourceType notification for ST2
-    notificationIdx++;
-    assertTrue(notifications.get(notificationIdx) instanceof ResourceTypeInfo);
-    allocatedResourceTypeInfo = (ResourceTypeInfo) notifications.get(notificationIdx);
-    assertNotNull(allocatedResourceTypeInfo);
-    assertEquals("allocatedResourceType", allocatedResourceTypeInfo.getName());
-    resourceType = allocatedResourceTypeInfo.getResourceType();
-    assertNotNull(resourceType);
-    assertEquals(1, resourceType.getId());
-    assertEquals(1, resourceType.getStatisticDescriptors().length);
-    statisticsType = resourceType.getStatisticsType();
-    assertNotNull(statisticsType);
-    assertTrue(statisticsType == ST2);
-    assertEquals("ST2_name", statisticsType.getName());
-    assertEquals("ST2_desc", statisticsType.getDescription());
-    assertEquals(1, statisticsType.getStatistics().length);
-
-    // validate the allocatedResourceInstance notification for st2_1
-    notificationIdx++;
-    assertTrue(notifications.get(notificationIdx) instanceof ResourceInstanceInfo);
-    allocatedResourceInstanceInfo = (ResourceInstanceInfo) notifications.get(notificationIdx);
-    assertNotNull(allocatedResourceInstanceInfo);
-    assertEquals("allocatedResourceInstance", allocatedResourceInstanceInfo.getName());
-    resourceInstance = allocatedResourceInstanceInfo.getResourceInstance();
-    assertNotNull(resourceInstance);
-    assertEquals(2, resourceInstance.getId());
-    assertEquals(1, resourceInstance.getUpdatedStats().length);
-    assertEquals(1, resourceInstance.getLatestStatValues().length); // TODO: is this correct?
-    statistics = resourceInstance.getStatistics();
-    assertNotNull(statistics);
-    assertTrue(statistics == st2_1);
-    assertEquals(3, statistics.getUniqueId());
-    assertEquals(1, statistics.getNumericId());
-    assertEquals("st2_1_text", statistics.getTextId());
-    assertEquals("ST2_name", statistics.getType().getName());
-    assertTrue(resourceType == resourceInstance.getResourceType());
-    
-    // validate the sampled notification
-    notificationIdx++;
-    assertTrue(notifications.get(notificationIdx) instanceof SampledInfo);
-    SampledInfo sampledInfo = (SampledInfo) notifications.get(notificationIdx);
-    assertNotNull(sampledInfo);
-    assertEquals("sampled", sampledInfo.getName());
-    assertEquals(3, sampledInfo.getResourceCount());
-  }
-  
-  @Test
-  public void testGetStatMonitorHandler() {
-    StatMonitorHandler handler = SampleCollector.getStatMonitorHandler();
-    assertNotNull(handler);
-    assertTrue(handler.getMonitorsSnapshot().isEmpty());
-    assertNull(handler.getStatMonitorNotifier());
-  }
-
-  @Test
-  public void testGetStatMonitorHandlerAfterClose() {
-    this.sampleCollector.close();
-    try {
-      /*StatMonitorHandler handler =*/ SampleCollector.getStatMonitorHandler();
-      fail("getStatMonitorHandler should throw IllegalStateException when SampleCollector
is closed");
-    } catch (IllegalStateException expected) {
-      // passed
-    }
-  }
-
-  @Test
-  public void testGetStatMonitorHandlerBeforeAndAfterClose() {
-    StatMonitorHandler handler = SampleCollector.getStatMonitorHandler();
-    assertNotNull(handler);
-    this.sampleCollector.close();
-    try {
-      handler = SampleCollector.getStatMonitorHandler();
-      fail("getStatMonitorHandler should throw IllegalStateException when SampleCollector
is closed");
-    } catch (IllegalStateException expected) {
-      // passed
-    }
-  }
-  
-  @Test
-  public void testGetStatArchiveHandler() {
-    StatArchiveHandler handler = this.sampleCollector.getStatArchiveHandler();
-    assertNotNull(handler);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/866bacec/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/SampleCollectorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/SampleCollectorTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/SampleCollectorTest.java
new file mode 100755
index 0000000..dd6de34
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/SampleCollectorTest.java
@@ -0,0 +1,322 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.statistics;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.io.File;
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.StatisticDescriptor;
+import com.gemstone.gemfire.Statistics;
+import com.gemstone.gemfire.StatisticsType;
+import com.gemstone.gemfire.internal.NanoTimer;
+import com.gemstone.gemfire.internal.statistics.TestSampleHandler.Info;
+import com.gemstone.gemfire.internal.statistics.TestSampleHandler.ResourceInstanceInfo;
+import com.gemstone.gemfire.internal.statistics.TestSampleHandler.ResourceTypeInfo;
+import com.gemstone.gemfire.internal.statistics.TestSampleHandler.SampledInfo;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * Unit tests for {@link SampleCollector}.
+ *   
+ * @since GemFire 7.0
+ */
+@Category(UnitTest.class)
+public class SampleCollectorTest {
+
+  private TestStatisticsManager manager;
+  private SampleCollector sampleCollector;
+  
+  @Before
+  public void setUp() throws Exception {
+    final long startTime = System.currentTimeMillis();
+    this.manager = new TestStatisticsManager(1, getClass().getSimpleName(), startTime);
+
+    final StatArchiveHandlerConfig mockStatArchiveHandlerConfig = mock(StatArchiveHandlerConfig.class,
getClass().getSimpleName() + "$" + StatArchiveHandlerConfig.class.getSimpleName());
+    when(mockStatArchiveHandlerConfig.getArchiveFileName()).thenReturn(new File(""));
+    when(mockStatArchiveHandlerConfig.getArchiveFileSizeLimit()).thenReturn(0L);
+    when(mockStatArchiveHandlerConfig.getArchiveDiskSpaceLimit()).thenReturn(0L);
+    when(mockStatArchiveHandlerConfig.getSystemId()).thenReturn(0L);
+    when(mockStatArchiveHandlerConfig.getSystemStartTime()).thenReturn(startTime);
+    when(mockStatArchiveHandlerConfig.getSystemDirectoryPath()).thenReturn("");
+    when(mockStatArchiveHandlerConfig.getProductDescription()).thenReturn(getClass().getSimpleName());
+
+    final StatisticsSampler sampler = new TestStatisticsSampler(manager);
+    this.sampleCollector = new SampleCollector(sampler);
+    this.sampleCollector.initialize(mockStatArchiveHandlerConfig, NanoTimer.getTime());
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    if (this.sampleCollector != null) {
+      this.sampleCollector.close();
+      this.sampleCollector = null;
+    }
+    this.manager = null;
+  }
+  
+  @Test
+  public void testAddHandlerBeforeSample() {
+    TestSampleHandler handler = new TestSampleHandler();
+    this.sampleCollector.addSampleHandler(handler);
+
+    StatisticDescriptor[] statsST1 = new StatisticDescriptor[] {
+        manager.createIntCounter("ST1_1_name", "ST1_1_desc", "ST1_1_units")
+    };
+    StatisticsType ST1 = manager.createType("ST1_name", "ST1_desc", statsST1);
+    Statistics st1_1 = manager.createAtomicStatistics(ST1, "st1_1_text", 1);
+    
+    this.sampleCollector.sample(NanoTimer.getTime());
+    
+    assertEquals(3, handler.getNotificationCount());
+    List<Info> notifications = handler.getNotifications(); 
+    
+    // validate the allocatedResourceType notification
+    assertTrue(notifications.get(0) instanceof ResourceTypeInfo);
+    ResourceTypeInfo allocatedResourceTypeInfo = (ResourceTypeInfo) notifications.get(0);
+    assertNotNull(allocatedResourceTypeInfo);
+    assertEquals("allocatedResourceType", allocatedResourceTypeInfo.getName());
+    ResourceType resourceType = allocatedResourceTypeInfo.getResourceType();
+    assertNotNull(resourceType);
+    assertEquals(0, resourceType.getId());
+    assertEquals(1, resourceType.getStatisticDescriptors().length);
+    StatisticsType statisticsType = resourceType.getStatisticsType();
+    assertNotNull(statisticsType);
+    assertTrue(statisticsType == ST1);
+    assertEquals("ST1_name", statisticsType.getName());
+    assertEquals("ST1_desc", statisticsType.getDescription());
+    assertEquals(1, statisticsType.getStatistics().length);
+    
+    // validate the allocatedResourceInstance notification
+    assertTrue(notifications.get(1) instanceof ResourceInstanceInfo);
+    ResourceInstanceInfo allocatedResourceInstanceInfo = (ResourceInstanceInfo) notifications.get(1);
+    assertNotNull(allocatedResourceInstanceInfo);
+    assertEquals("allocatedResourceInstance", allocatedResourceInstanceInfo.getName());
+    ResourceInstance resourceInstance = allocatedResourceInstanceInfo.getResourceInstance();
+    assertNotNull(resourceInstance);
+    assertEquals(0, resourceInstance.getId());
+    assertEquals(1, resourceInstance.getUpdatedStats().length);
+    assertEquals(1, resourceInstance.getLatestStatValues().length); // TODO: is this correct?
+    Statistics statistics = resourceInstance.getStatistics();
+    assertNotNull(statistics);
+    assertTrue(statistics == st1_1);
+    assertEquals(1, statistics.getUniqueId());
+    assertEquals(1, statistics.getNumericId());
+    assertEquals("st1_1_text", statistics.getTextId());
+    assertEquals("ST1_name", statistics.getType().getName());
+    assertTrue(resourceType == resourceInstance.getResourceType());
+    
+    // validate the sampled notification
+    assertTrue(notifications.get(2) instanceof SampledInfo);
+    SampledInfo sampledInfo = (SampledInfo) notifications.get(2);
+    assertNotNull(sampledInfo);
+    assertEquals("sampled", sampledInfo.getName());
+    assertEquals(1, sampledInfo.getResourceCount());
+  }
+  
+  @Test
+  public void testAddHandlerAfterSamples() {
+    StatisticDescriptor[] statsST1 = new StatisticDescriptor[] {
+        manager.createIntCounter("ST1_1_name", "ST1_1_desc", "ST1_1_units")
+    };
+    StatisticsType ST1 = manager.createType("ST1_name", "ST1_desc", statsST1);
+    Statistics st1_1 = manager.createAtomicStatistics(ST1, "st1_1_text", 1);
+    Statistics st1_2 = manager.createAtomicStatistics(ST1, "st1_2_text", 1);
+
+    StatisticDescriptor[] statsST2 = new StatisticDescriptor[] {
+        manager.createIntCounter("ST2_1_name", "ST2_1_desc", "ST2_1_units")
+    };
+    StatisticsType ST2 = manager.createType("ST2_name", "ST2_desc", statsST2);
+    Statistics st2_1 = manager.createAtomicStatistics(ST2, "st2_1_text", 1);
+    
+    st1_1.incInt("ST1_1_name", 1);
+    st1_2.incInt("ST1_1_name", 1);
+    st2_1.incInt("ST2_1_name", 1);
+    long sampleTime = NanoTimer.getTime();
+    this.sampleCollector.sample(sampleTime);
+
+    st1_1.incInt("ST1_1_name", 2);
+    st2_1.incInt("ST2_1_name", 1);
+    sampleTime += NanoTimer.millisToNanos(1000);
+    this.sampleCollector.sample(sampleTime);
+
+    st1_1.incInt("ST1_1_name", 1);
+    st1_1.incInt("ST1_1_name", 2);
+    sampleTime += NanoTimer.millisToNanos(1000);
+    this.sampleCollector.sample(sampleTime);
+
+    TestSampleHandler handler = new TestSampleHandler();
+    this.sampleCollector.addSampleHandler(handler);
+    
+    assertEquals("TestSampleHandler = " + handler, 0, handler.getNotificationCount());
+
+    st1_2.incInt("ST1_1_name", 1);
+    st2_1.incInt("ST2_1_name", 1);
+    sampleTime += NanoTimer.millisToNanos(1000);
+    this.sampleCollector.sample(sampleTime);
+
+    assertEquals(6, handler.getNotificationCount());
+    List<Info> notifications = handler.getNotifications();
+
+    // validate the allocatedResourceType notification for ST1
+    int notificationIdx = 0;
+    assertTrue(notifications.get(notificationIdx) instanceof ResourceTypeInfo);
+    ResourceTypeInfo allocatedResourceTypeInfo = (ResourceTypeInfo) notifications.get(notificationIdx);
+    assertNotNull(allocatedResourceTypeInfo);
+    assertEquals("allocatedResourceType", allocatedResourceTypeInfo.getName());
+    ResourceType resourceType = allocatedResourceTypeInfo.getResourceType();
+    assertNotNull(resourceType);
+    assertEquals(0, resourceType.getId());
+    assertEquals(1, resourceType.getStatisticDescriptors().length);
+    StatisticsType statisticsType = resourceType.getStatisticsType();
+    assertNotNull(statisticsType);
+    assertTrue(statisticsType == ST1);
+    assertEquals("ST1_name", statisticsType.getName());
+    assertEquals("ST1_desc", statisticsType.getDescription());
+    assertEquals(1, statisticsType.getStatistics().length);
+
+    // validate the allocatedResourceInstance notification for st1_1
+    notificationIdx++;
+    assertTrue(notifications.get(notificationIdx) instanceof ResourceInstanceInfo);
+    ResourceInstanceInfo allocatedResourceInstanceInfo = (ResourceInstanceInfo) notifications.get(notificationIdx);
+    assertNotNull(allocatedResourceInstanceInfo);
+    assertEquals("allocatedResourceInstance", allocatedResourceInstanceInfo.getName());
+    ResourceInstance resourceInstance = allocatedResourceInstanceInfo.getResourceInstance();
+    assertNotNull(resourceInstance);
+    assertEquals(0, resourceInstance.getId());
+    assertEquals(0, resourceInstance.getUpdatedStats().length);
+    assertEquals(1, resourceInstance.getLatestStatValues().length); // TODO: is this correct?
+    Statistics statistics = resourceInstance.getStatistics();
+    assertNotNull(statistics);
+    assertTrue(statistics == st1_1);
+    assertEquals(1, statistics.getUniqueId());
+    assertEquals(1, statistics.getNumericId());
+    assertEquals("st1_1_text", statistics.getTextId());
+    assertEquals("ST1_name", statistics.getType().getName());
+    assertTrue(resourceType == resourceInstance.getResourceType());
+    
+    // validate the allocatedResourceInstance notification for st1_2
+    notificationIdx++;
+    assertTrue(notifications.get(notificationIdx) instanceof ResourceInstanceInfo);
+    allocatedResourceInstanceInfo = (ResourceInstanceInfo) notifications.get(notificationIdx);
+    assertNotNull(allocatedResourceInstanceInfo);
+    assertEquals("allocatedResourceInstance", allocatedResourceInstanceInfo.getName());
+    resourceInstance = allocatedResourceInstanceInfo.getResourceInstance();
+    assertNotNull(resourceInstance);
+    assertEquals(1, resourceInstance.getId());
+    assertEquals(1, resourceInstance.getUpdatedStats().length);
+    assertEquals(1, resourceInstance.getLatestStatValues().length); // TODO: is this correct?
+    statistics = resourceInstance.getStatistics();
+    assertNotNull(statistics);
+    assertTrue(statistics == st1_2);
+    assertEquals(2, statistics.getUniqueId());
+    assertEquals(1, statistics.getNumericId());
+    assertEquals("st1_2_text", statistics.getTextId());
+    assertEquals("ST1_name", statistics.getType().getName());
+    assertTrue(resourceType == resourceInstance.getResourceType());
+    
+    // validate the allocatedResourceType notification for ST2
+    notificationIdx++;
+    assertTrue(notifications.get(notificationIdx) instanceof ResourceTypeInfo);
+    allocatedResourceTypeInfo = (ResourceTypeInfo) notifications.get(notificationIdx);
+    assertNotNull(allocatedResourceTypeInfo);
+    assertEquals("allocatedResourceType", allocatedResourceTypeInfo.getName());
+    resourceType = allocatedResourceTypeInfo.getResourceType();
+    assertNotNull(resourceType);
+    assertEquals(1, resourceType.getId());
+    assertEquals(1, resourceType.getStatisticDescriptors().length);
+    statisticsType = resourceType.getStatisticsType();
+    assertNotNull(statisticsType);
+    assertTrue(statisticsType == ST2);
+    assertEquals("ST2_name", statisticsType.getName());
+    assertEquals("ST2_desc", statisticsType.getDescription());
+    assertEquals(1, statisticsType.getStatistics().length);
+
+    // validate the allocatedResourceInstance notification for st2_1
+    notificationIdx++;
+    assertTrue(notifications.get(notificationIdx) instanceof ResourceInstanceInfo);
+    allocatedResourceInstanceInfo = (ResourceInstanceInfo) notifications.get(notificationIdx);
+    assertNotNull(allocatedResourceInstanceInfo);
+    assertEquals("allocatedResourceInstance", allocatedResourceInstanceInfo.getName());
+    resourceInstance = allocatedResourceInstanceInfo.getResourceInstance();
+    assertNotNull(resourceInstance);
+    assertEquals(2, resourceInstance.getId());
+    assertEquals(1, resourceInstance.getUpdatedStats().length);
+    assertEquals(1, resourceInstance.getLatestStatValues().length); // TODO: is this correct?
+    statistics = resourceInstance.getStatistics();
+    assertNotNull(statistics);
+    assertTrue(statistics == st2_1);
+    assertEquals(3, statistics.getUniqueId());
+    assertEquals(1, statistics.getNumericId());
+    assertEquals("st2_1_text", statistics.getTextId());
+    assertEquals("ST2_name", statistics.getType().getName());
+    assertTrue(resourceType == resourceInstance.getResourceType());
+    
+    // validate the sampled notification
+    notificationIdx++;
+    assertTrue(notifications.get(notificationIdx) instanceof SampledInfo);
+    SampledInfo sampledInfo = (SampledInfo) notifications.get(notificationIdx);
+    assertNotNull(sampledInfo);
+    assertEquals("sampled", sampledInfo.getName());
+    assertEquals(3, sampledInfo.getResourceCount());
+  }
+  
+  @Test
+  public void testGetStatMonitorHandler() {
+    StatMonitorHandler handler = SampleCollector.getStatMonitorHandler();
+    assertNotNull(handler);
+    assertTrue(handler.getMonitorsSnapshot().isEmpty());
+    assertNull(handler.getStatMonitorNotifier());
+  }
+
+  @Test
+  public void testGetStatMonitorHandlerAfterClose() {
+    this.sampleCollector.close();
+    try {
+      /*StatMonitorHandler handler =*/ SampleCollector.getStatMonitorHandler();
+      fail("getStatMonitorHandler should throw IllegalStateException when SampleCollector
is closed");
+    } catch (IllegalStateException expected) {
+      // passed
+    }
+  }
+
+  @Test
+  public void testGetStatMonitorHandlerBeforeAndAfterClose() {
+    StatMonitorHandler handler = SampleCollector.getStatMonitorHandler();
+    assertNotNull(handler);
+    this.sampleCollector.close();
+    try {
+      handler = SampleCollector.getStatMonitorHandler();
+      fail("getStatMonitorHandler should throw IllegalStateException when SampleCollector
is closed");
+    } catch (IllegalStateException expected) {
+      // passed
+    }
+  }
+  
+  @Test
+  public void testGetStatArchiveHandler() {
+    StatArchiveHandler handler = this.sampleCollector.getStatArchiveHandler();
+    assertNotNull(handler);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/866bacec/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/SimpleStatSamplerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/SimpleStatSamplerIntegrationTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/SimpleStatSamplerIntegrationTest.java
new file mode 100755
index 0000000..d86b968
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/SimpleStatSamplerIntegrationTest.java
@@ -0,0 +1,351 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.statistics;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+import org.junit.rules.TestName;
+
+import com.gemstone.gemfire.CancelCriterion;
+import com.gemstone.gemfire.Statistics;
+import com.gemstone.gemfire.StatisticsType;
+import com.gemstone.gemfire.internal.SocketCreator;
+import com.gemstone.gemfire.internal.stats50.VMStats50;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+/**
+ * Integration tests for {@link SimpleStatSampler}.
+ * 
+ * @since GemFire 7.0
+ */
+@Category(IntegrationTest.class)
+public class SimpleStatSamplerIntegrationTest extends StatSamplerTestCase {
+
+  private LocalStatisticsFactory statisticsFactory;
+  private File testDir;
+
+  @Rule
+  public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+  @Rule
+  public TestName testName = new TestName();
+
+  @Before
+  public void setUp() throws Exception {
+    this.testDir = this.temporaryFolder.getRoot();
+    assertTrue(this.testDir.exists());
+    System.setProperty(SimpleStatSampler.ARCHIVE_FILE_NAME_PROPERTY,
+        this.testDir.getAbsolutePath() + File.separator + SimpleStatSampler.DEFAULT_ARCHIVE_FILE_NAME);
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    System.clearProperty(SimpleStatSampler.ARCHIVE_FILE_NAME_PROPERTY);
+    System.clearProperty(SimpleStatSampler.FILE_SIZE_LIMIT_PROPERTY);
+    System.clearProperty(SimpleStatSampler.DISK_SPACE_LIMIT_PROPERTY);
+    System.clearProperty(SimpleStatSampler.SAMPLE_RATE_PROPERTY);
+    closeStatisticsFactory();
+  }
+  
+  /**
+   * Tests the majority of getters and the basic functionality of the sampler.
+   */
+  @Test
+  public void testBasics() throws Exception {
+    initStatisticsFactory();
+
+    SimpleStatSampler statSampler = getSimpleStatSampler();
+    assertTrue(statSampler.waitForInitialization(5000));
+    
+    assertEquals(new File(System.getProperty(SimpleStatSampler.ARCHIVE_FILE_NAME_PROPERTY)),

+                 statSampler.getArchiveFileName());
+    assertEquals(0, statSampler.getArchiveFileSizeLimit());
+    assertEquals(0, statSampler.getArchiveDiskSpaceLimit());
+    assertEquals(SimpleStatSampler.DEFAULT_SAMPLE_RATE, statSampler.getSampleRate());
+    assertEquals(true, statSampler.isSamplingEnabled());
+    
+    int statsCount = statSampler.getStatisticsManager().getStatisticsCount();
+    
+    assertEquals(statsCount, statSampler.getStatisticsModCount());
+    assertEquals(statsCount, statSampler.getStatisticsManager().getStatisticsCount());
+    assertEquals(statsCount, statSampler.getStatistics().length);
+    
+    assertTrue(statsCount > 0);
+    
+    Assert.assertEquals(getStatisticsManager().getId(), statSampler.getSystemId());
+    assertTrue(statSampler.getSystemStartTime() <= System.currentTimeMillis());
+    Assert.assertEquals(SocketCreator.getHostName(SocketCreator.getLocalHost()),
+                 statSampler.getSystemDirectoryPath());
+
+    VMStatsContract vmStats = statSampler.getVMStats();
+    assertNotNull(vmStats);
+    assertTrue(vmStats instanceof VMStats50);
+    /* NOTE: VMStats50 is not an instance of Statistics but instead its
+     * instance contains 3 instances of Statistics:
+     * 1) vmStats
+     * 2) heapMemStats
+     * 3) nonHeapMemStats
+     */
+    
+    Method getProcessStats = null;
+    try {
+      getProcessStats = SimpleStatSampler.class.getMethod("getProcessStats");
+      fail("SimpleStatSampler should not have the method getProcessStats()");
+    } catch (NoSuchMethodException exected) {
+      // passed
+    }
+    assertNull(getProcessStats);
+    
+    assertEquals("Unknown product", statSampler.getProductDescription());
+  }
+
+  /**
+   * Tests that the configured archive file is created and exists. 
+   */
+  @Test
+  public void testArchiveFileExists() throws Exception {
+    final String dir = this.testDir.getAbsolutePath();
+    final String archiveFileName = dir + File.separator + this.testName + ".gfs";
+    final File archiveFile1 = new File(dir + File.separator + this.testName + ".gfs");
+    System.setProperty(SimpleStatSampler.ARCHIVE_FILE_NAME_PROPERTY, archiveFileName);
+    initStatisticsFactory();
+    
+    SimpleStatSampler statSampler = getSimpleStatSampler();
+    assertTrue(statSampler.waitForInitialization(5000));
+    
+    final File archiveFile = statSampler.getArchiveFileName();
+    assertNotNull(archiveFile);
+    assertEquals(archiveFile1, archiveFile);
+
+    waitForFileToExist(archiveFile, 5000, 10);
+    
+    assertTrue("File name incorrect: archiveFile.getName()=" + archiveFile.getName() +
+        " archiveFile.getAbsolutePath()=" + archiveFile.getAbsolutePath() +
+        " getCanonicalPath()" + archiveFile.getCanonicalPath(), 
+        archiveFileName.contains(archiveFile.getName()));
+  }
+  
+  /**
+   * Tests the statistics sample rate within an acceptable margin of error.
+   */
+  @Test
+  public void testSampleRate() throws Exception {
+    initStatisticsFactory();
+
+    SimpleStatSampler statSampler = getSimpleStatSampler();
+    assertTrue(statSampler.waitForInitialization(5000));
+
+    assertEquals(SimpleStatSampler.DEFAULT_SAMPLE_RATE, statSampler.getSampleRate());
+    
+    assertTrue(getStatisticsManager().getStatListModCount() > 0);
+    
+    List<Statistics> statistics = getStatisticsManager().getStatsList();
+    assertNotNull(statistics);
+    assertTrue(statistics.size() > 0);
+    
+    StatisticsType statSamplerType = getStatisticsManager().findType("StatSampler");
+    Statistics[] statsArray = getStatisticsManager().findStatisticsByType(statSamplerType);
+    assertEquals(1, statsArray.length);
+    
+    final Statistics statSamplerStats = statsArray[0];
+    final int initialSampleCount = statSamplerStats.getInt("sampleCount");
+    final int expectedSampleCount = initialSampleCount + 2;
+    
+    waitForStatSample(statSamplerStats, expectedSampleCount, 20000, 10);
+  }
+  
+  /**
+   * Tests lack of methods for supporting LocalStatListener.
+   */
+  @Test
+  public void testLocalStatListener() throws Exception {
+    initStatisticsFactory();
+
+    SimpleStatSampler statSampler = getSimpleStatSampler();
+    assertTrue(statSampler.waitForInitialization(5000));
+    
+    Method getLocalListeners = null;
+    try {
+      getLocalListeners = getSimpleStatSampler().getClass().getMethod("getLocalListeners");
+      fail("SimpleStatSampler should not have the method getLocalListeners()");
+    } catch (NoSuchMethodException exected) {
+      // passed
+    }
+    assertNull(getLocalListeners);
+
+    Method addLocalStatListener = null;
+    try {
+      addLocalStatListener = getSimpleStatSampler().getClass().getMethod("addLocalStatListener",
LocalStatListener.class, Statistics.class, String.class);
+      fail("SimpleStatSampler should not have the method addLocalStatListener()");
+    } catch (NoSuchMethodException exected) {
+      // passed
+    }
+    assertNull(addLocalStatListener);
+
+    Method removeLocalStatListener = null;
+    try {
+      removeLocalStatListener = getSimpleStatSampler().getClass().getMethod("removeLocalStatListener",
LocalStatListener.class);
+      fail("SimpleStatSampler should not have the method addLocalStatListener()");
+    } catch (NoSuchMethodException exected) {
+      // passed
+    }
+    assertNull(removeLocalStatListener);
+  }
+  
+  /**
+   * Invokes stop() and then validates that the sampler did in fact stop.
+   */
+  @Test
+  public void testStop() throws Exception {
+    initStatisticsFactory();
+
+    SimpleStatSampler statSampler = getSimpleStatSampler();
+    assertTrue(statSampler.waitForInitialization(5000));
+
+    // validate the stat sampler is running
+    StatisticsType statSamplerType = getStatisticsManager().findType("StatSampler");
+    Statistics[] statsArray = getStatisticsManager().findStatisticsByType(statSamplerType);
+    assertEquals(1, statsArray.length);
+    
+    final Statistics statSamplerStats = statsArray[0];
+    final int initialSampleCount = statSamplerStats.getInt("sampleCount");
+    final int expectedSampleCount = initialSampleCount + 2;
+    
+    waitForStatSample(statSamplerStats, expectedSampleCount, 20000, 10);
+
+    // stop the stat sampler
+    statSampler.stop();
+    
+    // validate the stat sampler has stopped
+    final int stoppedSampleCount = statSamplerStats.getInt("sampleCount");
+
+    // the following should timeout without completing
+    assertStatValueDoesNotChange(statSamplerStats, "sampleCount", stoppedSampleCount, 5000,
10);
+
+    assertEquals(stoppedSampleCount, statSamplerStats.getInt("sampleCount"));
+  }
+
+  /**
+   * Verifies that archive rolling works correctly when archive-file-size-limit
+   * is specified. This feature is broken in SimpleStatSampler.
+   */
+  @Test
+  public void testArchiveRolling() throws Exception {
+    // set the system property to use KB instead of MB for file size
+    System.setProperty(HostStatSampler.TEST_FILE_SIZE_LIMIT_IN_KB_PROPERTY, "true");
+
+    final String dir = this.testDir.getAbsolutePath() + File.separator + this.testName;
+    new File(dir).mkdir();
+
+    final String archiveFileName = dir + File.separator + this.testName + ".gfs";
+    System.setProperty(SimpleStatSampler.ARCHIVE_FILE_NAME_PROPERTY, archiveFileName);
+    System.setProperty(SimpleStatSampler.FILE_SIZE_LIMIT_PROPERTY, "1");
+    System.setProperty(SimpleStatSampler.DISK_SPACE_LIMIT_PROPERTY, "0");
+    System.setProperty(SimpleStatSampler.SAMPLE_RATE_PROPERTY, "1000");
+    initStatisticsFactory();
+
+    final File archiveFile1 = new File(dir + File.separator + this.testName + "-01-01.gfs");
+    final File archiveFile2 = new File(dir + File.separator + this.testName + "-01-02.gfs");
+    final File archiveFile3 = new File(dir + File.separator + this.testName + "-01-03.gfs");
+    final File archiveFile4 = new File(dir + File.separator + this.testName + "-01-04.gfs");
+
+    assertTrue(getSimpleStatSampler().waitForInitialization(5000));
+
+    assertTrue(getSimpleStatSampler().fileSizeLimitInKB());
+    assertEquals(1024, getSimpleStatSampler().getArchiveFileSizeLimit());
+
+    waitForFileToExist(archiveFile1, 4000, 10);
+    waitForFileToExist(archiveFile2, 4000, 10);
+    waitForFileToExist(archiveFile3, 4000, 10);
+    waitForFileToExist(archiveFile4, 4000, 10);
+  }
+
+  /**
+   * Verifies that archive removal works correctly when archive-disk-space-limit
+   * is specified. This feature is broken in SimpleStatSampler. 
+   */
+  @Test
+  public void testArchiveRemoval() throws Exception {
+    // set the system property to use KB instead of MB for file size
+    System.setProperty(HostStatSampler.TEST_FILE_SIZE_LIMIT_IN_KB_PROPERTY, "true");
+
+    final String dir = this.testDir.getAbsolutePath() + File.separator + this.testName;
+    new File(dir).mkdir();
+    
+    final String archiveFileName = dir + File.separator + this.testName + ".gfs";
+    final int sampleRate = 1000;
+    System.setProperty(SimpleStatSampler.ARCHIVE_FILE_NAME_PROPERTY, archiveFileName);
+    System.setProperty(SimpleStatSampler.FILE_SIZE_LIMIT_PROPERTY, "1");
+    System.setProperty(SimpleStatSampler.DISK_SPACE_LIMIT_PROPERTY, "12");
+    System.setProperty(SimpleStatSampler.SAMPLE_RATE_PROPERTY, String.valueOf(sampleRate));
+    initStatisticsFactory();
+
+    final File archiveFile1 = new File(dir + File.separator + this.testName + "-01-01.gfs");
+    final File archiveFile2 = new File(dir + File.separator + this.testName + "-01-02.gfs");
+    final File archiveFile3 = new File(dir + File.separator + this.testName + "-01-03.gfs");
+    final File archiveFile4 = new File(dir + File.separator + this.testName + "-01-04.gfs");
+    final File archiveFile5 = new File(dir + File.separator + this.testName + "-01-05.gfs");
+    
+    assertTrue(getSimpleStatSampler().waitForInitialization(5000));
+
+    waitForFileToExist(archiveFile1, 4*sampleRate, 10);
+    waitForFileToExist(archiveFile2, 4*sampleRate, 10);
+    waitForFileToExist(archiveFile3, 4*sampleRate, 10);
+    waitForFileToExist(archiveFile4, 4*sampleRate, 10);
+    waitForFileToExist(archiveFile5, 4*sampleRate, 10);
+    waitForFileToDelete(archiveFile1, 10*sampleRate, 10);
+  }
+
+  @Override
+  protected StatisticsManager getStatisticsManager() {
+    return this.statisticsFactory;
+  }
+
+  private SimpleStatSampler getSimpleStatSampler() {
+    return this.statisticsFactory.getStatSampler();
+  }
+  
+  private void initStatisticsFactory() {
+    CancelCriterion stopper = new CancelCriterion() {
+      public String cancelInProgress() {
+        return null;
+      }
+      public RuntimeException generateCancelledException(Throwable e) {
+        return null;
+      }
+    };
+    this.statisticsFactory = new LocalStatisticsFactory(stopper);
+  }
+  
+  private void closeStatisticsFactory() {
+    if (this.statisticsFactory != null) {
+      this.statisticsFactory.close();
+      this.statisticsFactory = null;
+    }
+  }
+}



Mime
View raw message