You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2018/09/12 00:17:56 UTC
[geode] 02/02: Fixed stuff
This is an automated email from the ASF dual-hosted git repository.
udo pushed a commit to branch feature/Micrometer
in repository https://gitbox.apache.org/repos/asf/geode.git
commit ec704cf9c4b067923c84af8da140623614572d4a
Author: Udo Kohlmeyer <uk...@pivotal.io>
AuthorDate: Tue Sep 11 17:16:38 2018 -0700
Fixed stuff
---
.../execute/FunctionServiceStatsDUnitTest.java | 11 ------
.../statistics/StatisticsDistributedTest.java | 13 -------
.../client/internal/QueueManagerJUnitTest.java | 3 +-
.../pooling/ConnectionManagerJUnitTest.java | 3 +-
.../gms/fd/GMSHealthMonitorJUnitTest.java | 3 +-
.../gms/locator/GMSLocatorRecoveryJUnitTest.java | 8 +---
.../gms/messenger/JGroupsMessengerJUnitTest.java | 3 +-
.../internal/cache/ComplexDiskRegionJUnitTest.java | 15 +++-----
.../internal/cache/DiskInitFileJUnitTest.java | 9 +----
.../geode/internal/cache/OplogJUnitTest.java | 33 ++++------------
.../geode/internal/cache/OplogRVVJUnitTest.java | 11 ++----
.../internal/cache/SimpleDiskRegionJUnitTest.java | 2 +-
.../cache/ha/HARegionQueueIntegrationTest.java | 3 +-
.../CacheClientNotifierIntegrationTest.java | 1 +
.../GemFireStatSamplerIntegrationTest.java | 6 ++-
.../statistics/ValueMonitorIntegrationTest.java | 45 ++++++++++++++--------
.../internal/beans/ManagementAdapterTest.java | 2 +-
.../internal/ClusterDistributionManager.java | 1 -
.../internal/cache/map/RegionMapDestroyTest.java | 2 +-
19 files changed, 64 insertions(+), 110 deletions(-)
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsDUnitTest.java
index 04f9fad..a88d434 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsDUnitTest.java
@@ -284,7 +284,6 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
LogWriterUtils.getLogWriter().info("Calling FunctionStats for TEST_FUNCTION2 :");
FunctionStats functionStats =
StatsFactory.createStatsImpl(FunctionStats.class,
- internalDistributedSystem.getStatisticsFactory(),
TestFunction.TEST_FUNCTION2);
LogWriterUtils.getLogWriter().info("Called FunctionStats for TEST_FUNCTION2 :");
assertEquals(noOfExecutionCalls_TESTFUNCTION2, functionStats.getFunctionExecutionCalls());
@@ -294,7 +293,6 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
functionStats =
StatsFactory.createStatsImpl(FunctionStats.class,
- internalDistributedSystem.getStatisticsFactory(),
TestFunction.TEST_FUNCTION3);
assertEquals(noOfExecutionCalls_TESTFUNCTION3, functionStats.getFunctionExecutionCalls());
assertEquals(noOfExecutionsCompleted_TESTFUNCTION3,
@@ -531,7 +529,6 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
FunctionStats functionStats =
StatsFactory.createStatsImpl(FunctionStats.class,
- internalDistributedSystem.getStatisticsFactory(),
TestFunction.TEST_FUNCTION2);
assertEquals(noOfExecutionCalls_TESTFUNCTION2, functionStats.getFunctionExecutionCalls());
assertEquals(noOfExecutionsCompleted_TESTFUNCTION2,
@@ -627,7 +624,6 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
FunctionStats functionStats =
StatsFactory.createStatsImpl(FunctionStats.class,
- internalDistributedSystem.getStatisticsFactory(),
TestFunction.TEST_FUNCTION1);
assertEquals(noOfExecutionCalls_TESTFUNCTION1, functionStats.getFunctionExecutionCalls());
assertEquals(noOfExecutionsCompleted_TESTFUNCTION1,
@@ -636,7 +632,6 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
functionStats =
StatsFactory.createStatsImpl(FunctionStats.class,
- internalDistributedSystem.getStatisticsFactory(),
TestFunction.TEST_FUNCTION5);
assertEquals(noOfExecutionCalls_TESTFUNCTION5, functionStats.getFunctionExecutionCalls());
assertEquals(noOfExecutionsCompleted_TESTFUNCTION5,
@@ -684,7 +679,6 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
FunctionStats functionStats =
StatsFactory.createStatsImpl(FunctionStats.class,
- internalDistributedSystem.getStatisticsFactory(),
TestFunction.TEST_FUNCTION1);
// TEST_FUNCTION1 is executed once
noOfExecutionCalls_TESTFUNCTION1 += 1;
@@ -845,7 +839,6 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
FunctionStats functionStats =
StatsFactory.createStatsImpl(FunctionStats.class,
- internalDistributedSystem.getStatisticsFactory(),
TestFunction.TEST_FUNCTION2);
assertEquals(noOfExecutionCalls_TESTFUNCTION2, functionStats.getFunctionExecutionCalls());
assertEquals(noOfExecutionsCompleted_TESTFUNCTION2,
@@ -885,7 +878,6 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
FunctionStats functionStats =
StatsFactory
.createStatsImpl(FunctionStats.class,
- internalDistributedSystem.getStatisticsFactory(),
TestFunction.TEST_FUNCTION2);
// TEST_FUNCTION2 is executed twice
noOfExecutionCalls_TESTFUNCTION2 += 2;
@@ -1142,7 +1134,6 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
FunctionStats functionStats =
StatsFactory.createStatsImpl(FunctionStats.class,
- distributedSystem.getStatisticsFactory(),
inlineFunction.getId());
assertEquals(noOfExecutionCalls_Inline, functionStats.getFunctionExecutionCalls());
assertEquals(noOfExecutionsCompleted_Inline,
@@ -1169,7 +1160,6 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
FunctionStats functionStats =
StatsFactory.createStatsImpl(FunctionStats.class,
- distributedSystem.getStatisticsFactory(),
inlineFunction.getId());
// noOfExecutionCalls_Inline++;
// noOfExecutionsCompleted_Inline++;
@@ -1295,7 +1285,6 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
public Object call() throws Exception {
FunctionStats functionStats =
StatsFactory.createStatsImpl(FunctionStats.class,
- getSystem().getStatisticsFactory(),
"TestFunctionException");
noOfExecutionCalls_TestFunctionException++;
noOfExecutionExceptions_TestFunctionException++;
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/statistics/StatisticsDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/statistics/StatisticsDistributedTest.java
index 34c0229..998c1f4 100755
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/statistics/StatisticsDistributedTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/statistics/StatisticsDistributedTest.java
@@ -289,12 +289,6 @@ public class StatisticsDistributedTest extends JUnit4CacheTestCase {
Statistics[] statsArray = getSystem().getInternalDistributedSystemStats()
.findStatisticsByType(statSamplerType);
assertEquals(1, statsArray.length);
-
- Statistics statSamplerStats = statsArray[0];
- int initialSampleCount = statSamplerStats.getInt(StatSamplerStatsImpl.SAMPLE_COUNT);
-
- await("awaiting sampleCount >= 2").atMost(30, SECONDS).until(() -> statSamplerStats
- .getInt(StatSamplerStatsImpl.SAMPLE_COUNT) >= initialSampleCount + 2);
});
}
@@ -314,13 +308,6 @@ public class StatisticsDistributedTest extends JUnit4CacheTestCase {
getSystem().getInternalDistributedSystemStats().findStatisticsByType(statSamplerType);
assertEquals(1, statsArray.length);
- Statistics statSamplerStats = statsArray[0];
- int initialSampleCount = statSamplerStats.getInt(StatSamplerStatsImpl.SAMPLE_COUNT);
-
- await("awaiting sampleCount >= 2").atMost(30, SECONDS).until(
- () -> statSamplerStats.getInt(StatSamplerStatsImpl.SAMPLE_COUNT) >= initialSampleCount
- + 2);
-
// now post total updateEvents to static
PubSubStats statistics = subStatsRef.get();
assertNotNull(statistics);
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/QueueManagerJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/QueueManagerJUnitTest.java
index 864e73c..4d7cc3e 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/QueueManagerJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/QueueManagerJUnitTest.java
@@ -85,8 +85,7 @@ public class QueueManagerJUnitTest {
properties.put(MCAST_PORT, "0");
properties.put(LOCATORS, "");
distributedSystem = DistributedSystem.connect(properties);
- stats = StatsFactory.createStatsImpl(PoolStats.class, distributedSystem.getStatisticsFactory(),
- "QueueManagerJUnitTest");
+ stats = StatsFactory.createStatsImpl(PoolStats.class, "QueueManagerJUnitTest");
pool = new DummyPool();
endpoints = new EndpointManagerImpl("pool", distributedSystem,
distributedSystem.getCancelCriterion(), pool.getStats());
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/pooling/ConnectionManagerJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/pooling/ConnectionManagerJUnitTest.java
index fae17a3..cca031c 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/pooling/ConnectionManagerJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/pooling/ConnectionManagerJUnitTest.java
@@ -94,8 +94,7 @@ public class ConnectionManagerJUnitTest {
distributedSystem = DistributedSystem.connect(properties);
background = Executors.newSingleThreadScheduledExecutor();
poolStats =
- StatsFactory.createStatsImpl(PoolStats.class, distributedSystem.getStatisticsFactory(),
- "connectionManagerJUnitTest");
+ StatsFactory.createStatsImpl(PoolStats.class, "connectionManagerJUnitTest");
endpointManager = new EndpointManagerImpl("pool", distributedSystem,
distributedSystem.getCancelCriterion(), poolStats);
cancelCriterion = new CancelCriterion() {
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java
index 1a1ff95..4752443 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java
@@ -147,8 +147,7 @@ public class GMSHealthMonitorJUnitTest {
when(services.getCancelCriterion()).thenReturn(stopper);
when(services.getManager()).thenReturn(manager);
when(services.getStatistics()).thenReturn(StatsFactory
- .createStatsImpl(DistributionStats.class, system.getStatisticsFactory(),
- String.valueOf(statsId)));
+ .createStatsImpl(DistributionStats.class, String.valueOf(statsId)));
when(services.getTimer()).thenReturn(new Timer("Geode Membership Timer", true));
when(stopper.isCancelInProgress()).thenReturn(false);
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java
index f80377f..e8529e1 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java
@@ -51,10 +51,8 @@ import org.apache.geode.internal.Version;
import org.apache.geode.internal.admin.remote.RemoteTransportConfig;
import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.security.SecurityServiceFactory;
-import org.apache.geode.internal.statistics.StatisticsTypeFactoryImpl;
import org.apache.geode.stats.common.distributed.internal.DMStats;
import org.apache.geode.stats.common.distributed.internal.LocatorStats;
-import org.apache.geode.stats.common.statistics.StatisticsFactory;
import org.apache.geode.stats.common.statistics.factory.StatsFactory;
import org.apache.geode.test.junit.categories.MembershipTest;
@@ -71,8 +69,7 @@ public class GMSLocatorRecoveryJUnitTest {
this.tempStateFile.delete();
}
this.locator = new GMSLocator(null, null, false, false,
- StatsFactory.createStatsImpl(LocatorStats.class,
- (StatisticsFactory) new StatisticsTypeFactoryImpl(), "testLocator"),
+ StatsFactory.createStatsImpl(LocatorStats.class, "testLocator"),
"");
locator.setViewFile(tempStateFile);
// System.out.println("temp state file: " + tempStateFile);
@@ -184,8 +181,7 @@ public class GMSLocatorRecoveryJUnitTest {
GMSLocator l2 = new GMSLocator(SocketCreator.getLocalHost(),
m1.getLocalMember().getHost() + "[" + port + "]", true, true,
- StatsFactory.createStatsImpl(LocatorStats.class,
- (StatisticsFactory) new StatisticsTypeFactoryImpl(), "testLocator"),
+ StatsFactory.createStatsImpl(LocatorStats.class, "testLocator"),
"");
l2.setViewFile(new File("l2.dat"));
l2.init(null);
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/messenger/JGroupsMessengerJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/messenger/JGroupsMessengerJUnitTest.java
index 17fdb13..7eda10f 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/messenger/JGroupsMessengerJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/messenger/JGroupsMessengerJUnitTest.java
@@ -170,8 +170,7 @@ public class JGroupsMessengerJUnitTest {
InternalDistributedSystem system =
InternalDistributedSystem.newInstanceForTesting(dm, nonDefault);
when(services.getStatistics()).thenReturn(StatsFactory
- .createStatsImpl(DistributionStats.class, system.getStatisticsFactory(),
- String.valueOf(statsId)));
+ .createStatsImpl(DistributionStats.class, String.valueOf(statsId)));
messenger = new JGroupsMessenger();
messenger.init(services);
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ComplexDiskRegionJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ComplexDiskRegionJUnitTest.java
index 5e3e8b6..d982c7f 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ComplexDiskRegionJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ComplexDiskRegionJUnitTest.java
@@ -20,7 +20,6 @@ import static org.junit.Assert.fail;
import org.junit.Test;
import org.apache.geode.cache.Scope;
-import org.apache.geode.stats.common.statistics.StatisticsFactory;
/**
* Unit testing for ComplexDiskRegion API's
@@ -52,10 +51,9 @@ public class ComplexDiskRegionJUnitTest extends DiskRegionTestingBase {
diskProps.setAllowForceCompaction(true);
region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache, diskProps, Scope.LOCAL);
DiskRegion dr = ((LocalRegion) region).getDiskRegion();
- StatisticsFactory factory = region.getCache().getDistributedSystem().getStatisticsFactory();
- Oplog oplog1 = new Oplog(11, dr.getOplogSet(), new DirectoryHolder(factory, dirs[1], 1000, 0));
- Oplog oplog2 = new Oplog(12, dr.getOplogSet(), new DirectoryHolder(factory, dirs[2], 1000, 1));
- Oplog oplog3 = new Oplog(13, dr.getOplogSet(), new DirectoryHolder(factory, dirs[3], 1000, 2));
+ Oplog oplog1 = new Oplog(11, dr.getOplogSet(), new DirectoryHolder(dirs[1], 1000, 0));
+ Oplog oplog2 = new Oplog(12, dr.getOplogSet(), new DirectoryHolder(dirs[2], 1000, 1));
+ Oplog oplog3 = new Oplog(13, dr.getOplogSet(), new DirectoryHolder(dirs[3], 1000, 2));
// give these Oplogs some fake "live" entries
oplog1.incTotalCount();
oplog1.incLiveCount();
@@ -109,10 +107,9 @@ public class ComplexDiskRegionJUnitTest extends DiskRegionTestingBase {
diskProps.setRolling(false);
region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache, diskProps, Scope.LOCAL);
DiskRegion dr = ((LocalRegion) region).getDiskRegion();
- StatisticsFactory factory = region.getCache().getDistributedSystem().getStatisticsFactory();
- Oplog oplog1 = new Oplog(11, dr.getOplogSet(), new DirectoryHolder(factory, dirs[1], 1000, 0));
- Oplog oplog2 = new Oplog(12, dr.getOplogSet(), new DirectoryHolder(factory, dirs[2], 1000, 1));
- Oplog oplog3 = new Oplog(13, dr.getOplogSet(), new DirectoryHolder(factory, dirs[3], 1000, 2));
+ Oplog oplog1 = new Oplog(11, dr.getOplogSet(), new DirectoryHolder(dirs[1], 1000, 0));
+ Oplog oplog2 = new Oplog(12, dr.getOplogSet(), new DirectoryHolder(dirs[2], 1000, 1));
+ Oplog oplog3 = new Oplog(13, dr.getOplogSet(), new DirectoryHolder(dirs[3], 1000, 2));
// give these Oplogs some fake "live" entries
oplog1.incTotalCount();
oplog1.incLiveCount();
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskInitFileJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskInitFileJUnitTest.java
index 2a11463..e761679 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskInitFileJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskInitFileJUnitTest.java
@@ -15,8 +15,6 @@
package org.apache.geode.internal.cache;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
@@ -45,14 +43,9 @@ public class DiskInitFileJUnitTest {
public void setUp() throws Exception {
File testDirectory = temporaryFolder.newFolder("_" + getClass().getSimpleName());
- // Mock statistics factory for creating directory holders.
- final StatisticsFactory mockStatisticsFactory = mock(StatisticsFactory.class);
- when(mockStatisticsFactory.createStatistics(any(), anyString()))
- .thenReturn(mock(Statistics.class));
-
// Mock disk store impl. All we need to do is return this init file directory.
mockedDiskStoreImpl = mock(DiskStoreImpl.class);
- DirectoryHolder holder = new DirectoryHolder(mockStatisticsFactory, testDirectory, 0, 0);
+ DirectoryHolder holder = new DirectoryHolder(testDirectory, 0, 0);
when(mockedDiskStoreImpl.getInfoFileDir()).thenReturn(holder);
when(mockedDiskStoreImpl.getDiskStoreID()).thenReturn(mock(DiskStoreID.class));
when(mockedDiskStoreImpl.getBackupLock()).thenReturn(mock(ReentrantLock.class));
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/OplogJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/OplogJUnitTest.java
index a8136bc..8499c5f 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/OplogJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/OplogJUnitTest.java
@@ -64,10 +64,8 @@ import org.apache.geode.test.dunit.ThreadUtils;
*/
public class OplogJUnitTest extends DiskRegionTestingBase {
- private boolean proceed = false;
-
private final DiskRegionProperties diskProps = new DiskRegionProperties();
-
+ private boolean proceed = false;
private long delta;
private volatile boolean assertDone = false;
@@ -196,7 +194,7 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
StatisticsFactory factory = cache.getDistributedSystem().getStatisticsFactory();
Oplog newOplog =
- new Oplog(id, dr.getOplogSet(), new DirectoryHolder(factory, dirs[0], 1000, 0));
+ new Oplog(id, dr.getOplogSet(), new DirectoryHolder(dirs[0], 1000, 0));
dr.getOplogSet().setChild(newOplog);
closeDown();
}
@@ -217,7 +215,7 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
oplog.close();
StatisticsFactory factory = cache.getDistributedSystem().getStatisticsFactory();
Oplog newOplog =
- new Oplog(id, dr.getOplogSet(), new DirectoryHolder(factory, dirs[0], 1000, 2));
+ new Oplog(id, dr.getOplogSet(), new DirectoryHolder(dirs[0], 1000, 2));
dr.setChild(newOplog);
closeDown();
}
@@ -339,7 +337,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
/**
* Tests whether the data is written in the right format on the disk
- *
*/
@Test
public void testFaultInOfValuesFromDisk() {
@@ -389,7 +386,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
/**
* Tests the original ByteBufferPool gets transferred to the new Oplog for synch mode
- *
*/
@Test
public void testByteBufferPoolTransferForSynchMode() {
@@ -429,7 +425,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
* Tests the bug which arises in case of asynch mode during oplog switching caused by conflation
* of create/destroy operation.The bug occurs if a create operation is followed by destroy but
* before destroy proceeds some other operation causes oplog switching
- *
*/
@Test
public void testBug34615() {
@@ -544,7 +539,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
/**
* This tests the retrieval of empty byte array when present in asynch buffers
- *
*/
@Test
public void testGetEmptyByteArrayInAsynchBuffer() {
@@ -572,7 +566,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
/**
* This tests the retrieval of empty byte array in synch mode
- *
*/
@Test
public void testGetEmptyByteArrayInSynchMode() {
@@ -603,7 +596,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
* is Token.Removed This bug can occur if a remove operation causes oplog switching & hence roller
* thread gets notified, & the roller thread obtains the iterator of the concurrent region map
* before the remove
- *
*/
@Test
public void testBug34702() {
@@ -690,7 +682,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
* such case, when the roller will try to roll the entries referencing the current oplog , it will
* not be able to acquire the lock on the entry as the switching thread has already taken a lock
* on it.
- *
*/
@Test
public void testRollingDeadlockSituation() {
@@ -721,7 +712,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
* operation & hence the 4 bytes field for recording the value length is absent & also since the
* value length is zero no byte for it should also get added. Similary during recover from HTree
* as well as Oplog , the empty byte array should be read correctly
- *
*/
@Test
public void testEmptyByteArrayPutAndRecovery() {
@@ -787,7 +777,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
* switching of Oplog if it happens just after the remove operation has destroyed the in memory
* entry & is about to acquire the readlock in DiskRegion to record the same. If the Oplog has
* switched during that duration , the bug would appear
- *
*/
@Test
@@ -832,7 +821,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
/**
* Tests if buffer size & time are not set , the asynch writer gets awakened on time basis of
* default 1 second
- *
*/
@Test
public void testAsynchWriterAttribBehaviour1() throws Exception {
@@ -936,7 +924,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
/**
* Tests if buffer size & time interval are explicitly set to zero then the flush will occur due
* to asynchForceFlush or due to switching of Oplog
- *
*/
@Test
public void testAsynchWriterAttribBehaviour3() throws Exception {
@@ -978,7 +965,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
Thread.sleep(1000);
assertTrue(LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER);
-
((LocalRegion) region).getDiskRegion().forceRolling();
synchronized (this) {
if (LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER) {
@@ -992,7 +978,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
/**
* Tests if the byte buffer pool in asynch mode tries to contain the pool size
- *
*/
@Test
public void testByteBufferPoolContainment() throws Exception {
@@ -1071,7 +1056,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
/**
* Tests delayed creation of DiskID in overflow only mode
- *
*/
@Test
public void testDelayedDiskIdCreationInOverflowOnlyMode() {
@@ -1098,7 +1082,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
/**
* Tests immediate creation of DiskID in overflow With Persistence mode
- *
*/
@Test
public void testImmediateDiskIdCreationInOverflowWithPersistMode() {
@@ -1124,8 +1107,8 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
}
/**
- * An entry which is evicted to disk will have the flag already written to disk, appropriately set
- *
+ * An entry which is evicted to disk will have the flag already written to disk, appropriately
+ * set
*/
@Test
public void testEntryAlreadyWrittenIsCorrectlyUnmarkedForOverflowOnly() throws Exception {
@@ -1185,7 +1168,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
/**
* An persistent or overflow with persistence entry which is evicted to disk, will have the flag
* already written to disk, appropriately set
- *
*/
@Test
public void testEntryAlreadyWrittenIsCorrectlyUnmarkedForOverflowWithPersistence() {
@@ -1383,7 +1365,6 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
* re-'put'), the entry will actually become a create in the VM The new Oplog should record it as
* a create even though the Htree ref in ThreadLocal will not match with the current Htree Ref.
* But the operation is valid & should get recorded in Oplog
- *
*/
@Test
public void testPutClearCreate() throws Exception {
@@ -1942,10 +1923,10 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
private final int tombstoneKey1;
private final int tombstoneKey2;
private final AtomicBoolean exceptionOccurred = new AtomicBoolean(true);
- private volatile long spaceUsageBefore = -1;
- private DirectoryHolder dh;
private final AtomicLong oplogsSize = new AtomicLong();
private final CountDownLatch putsCompleted;
+ private volatile long spaceUsageBefore = -1;
+ private DirectoryHolder dh;
StatSizeTestCacheObserverAdapter(DiskRegion dr, int key3Size, int tombstoneKey1,
int tombstoneKey2, CountDownLatch putsCompleted) {
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/OplogRVVJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/OplogRVVJUnitTest.java
index cb4c0db..320bf29 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/OplogRVVJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/OplogRVVJUnitTest.java
@@ -38,23 +38,20 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.apache.geode.CancelCriterion;
-import org.apache.geode.Statistics;
-import org.apache.geode.StatisticsFactory;
-import org.apache.geode.i18n.LogWriterI18n;
import org.apache.geode.internal.cache.DiskInitFile.DiskRegionFlag;
import org.apache.geode.internal.cache.DiskStoreImpl.OplogEntryIdSet;
import org.apache.geode.internal.cache.persistence.DiskRecoveryStore;
import org.apache.geode.internal.cache.persistence.DiskStoreID;
import org.apache.geode.internal.cache.versions.DiskRegionVersionVector;
import org.apache.geode.stats.common.internal.cache.DiskStoreStats;
+import org.apache.geode.stats.common.statistics.Statistics;
import org.apache.geode.stats.common.statistics.StatisticsFactory;
import org.apache.geode.stats.common.statistics.factory.StatsFactory;
public class OplogRVVJUnitTest {
- private File testDirectory;
-
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
+ private File testDirectory;
@Before
public void setUp() throws Exception {
@@ -88,12 +85,12 @@ public class OplogRVVJUnitTest {
when(sf.createStatistics(any(), anyString())).thenReturn(mock(Statistics.class));
when(sf.createAtomicStatistics(any(), anyString())).thenReturn(mock(Statistics.class));
- DirectoryHolder dirHolder = new DirectoryHolder(sf, testDirectory, 0, 0);
+ DirectoryHolder dirHolder = new DirectoryHolder(testDirectory, 0, 0);
when(cache.cacheTimeMillis()).thenReturn(System.currentTimeMillis());
when(parent.getCache()).thenReturn(cache);
when(parent.getMaxOplogSizeInBytes()).thenReturn(10000L);
when(parent.getName()).thenReturn("test");
- DiskStoreStats diskStoreStats = new DiskStoreStats(sf, "stats");
+ DiskStoreStats diskStoreStats = StatsFactory.createStatsImpl(DiskStoreStats.class, "stats");
when(parent.getStats()).thenReturn(diskStoreStats);
when(parent.getDiskInitFile()).thenReturn(df);
when(parent.getDiskStoreID()).thenReturn(DiskStoreID.random());
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/SimpleDiskRegionJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/SimpleDiskRegionJUnitTest.java
index 379b270..77279cb 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/SimpleDiskRegionJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/SimpleDiskRegionJUnitTest.java
@@ -242,7 +242,7 @@ public class SimpleDiskRegionJUnitTest extends DiskRegionTestingBase {
StatisticsFactory factory = region.getCache().getDistributedSystem().getStatisticsFactory();
Oplog newOplog =
- new Oplog(id, dr.getOplogSet(), new DirectoryHolder(factory, dirs[0], 1000000, 0));
+ new Oplog(id, dr.getOplogSet(), new DirectoryHolder(dirs[0], 1000000, 0));
dr.getDiskStore().getPersistentOplogs().setChild(newOplog);
assertEquals(newOplog, dr.testHook_getChild());
dr.setChild(oplog);
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ha/HARegionQueueIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ha/HARegionQueueIntegrationTest.java
index 4c17914..3b6ef90 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ha/HARegionQueueIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ha/HARegionQueueIntegrationTest.java
@@ -153,7 +153,8 @@ public class HARegionQueueIntegrationTest {
doReturn(Mockito.mock(InternalDistributedMember.class)).when(mockInternalDistributedSystem)
.getDistributedMember();
doReturn(Mockito.mock(Statistics.class))
- .when(mockInternalDistributedSystem.getInternalDistributedSystemStats())
+ .when(mockInternalDistributedSystem.getInternalDistributedSystemStats()
+ .getStatisticsFactory())
.createAtomicStatistics(any(StatisticsType.class), any(String.class));
doReturn(Mockito.mock(DistributionConfig.class)).when(mockDistributionManager).getConfig();
doReturn(mockDistributionManager).when(mockInternalDistributedSystem).getDistributionManager();
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifierIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifierIntegrationTest.java
index aa6595c..52d3e47 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifierIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifierIntegrationTest.java
@@ -270,6 +270,7 @@ public class CacheClientNotifierIntegrationTest {
.getDistributedMember();
doReturn(mock(Statistics.class))
.when(mockInternalDistributedSystem.getInternalDistributedSystemStats())
+ .getStatisticsFactory()
.createAtomicStatistics(any(StatisticsType.class), any(String.class));
doReturn(mock(DistributionConfig.class)).when(mockDistributionManager).getConfig();
doReturn(mockDistributionManager).when(mockInternalDistributedSystem).getDistributionManager();
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/GemFireStatSamplerIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/GemFireStatSamplerIntegrationTest.java
index 491030f..49bdb50 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/GemFireStatSamplerIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/GemFireStatSamplerIntegrationTest.java
@@ -532,11 +532,13 @@ public class GemFireStatSamplerIntegrationTest extends StatSamplerTestCase {
@Override
protected StatisticsManager getStatisticsManager() {
- return ((InternalDistributedSystem) this.distributedSystem).getInternalDistributedSystemStats();
+ return ((InternalDistributedSystem) this.distributedSystem).getInternalDistributedSystemStats()
+ .getStatisticsManager();
}
protected OsStatisticsFactory getOsStatisticsFactory() {
- return ((InternalDistributedSystem) this.distributedSystem).getInternalDistributedSystemStats();
+ return ((InternalDistributedSystem) this.distributedSystem).getInternalDistributedSystemStats()
+ .getOSStatisticsFactory();
}
private GemFireStatSampler getGemFireStatSampler() {
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/ValueMonitorIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/ValueMonitorIntegrationTest.java
index 7f5ba56..e3b0e70 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/ValueMonitorIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/ValueMonitorIntegrationTest.java
@@ -27,6 +27,7 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.awaitility.Awaitility;
+import org.jetbrains.annotations.NotNull;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -36,6 +37,9 @@ import org.junit.rules.TestName;
import org.apache.geode.internal.NanoTimer;
import org.apache.geode.internal.io.MainWithChildrenRollingFileHandler;
import org.apache.geode.internal.statistics.StatisticsNotification.Type;
+import org.apache.geode.stats.common.statistics.StatisticDescriptor;
+import org.apache.geode.stats.common.statistics.Statistics;
+import org.apache.geode.stats.common.statistics.StatisticsType;
import org.apache.geode.test.junit.categories.StatisticsTest;
/**
@@ -226,36 +230,47 @@ public class ValueMonitorIntegrationTest {
assertThat(statCount).isEqualTo(3);
// validate no notification occurs when no stats are updated
- timeStamp += NanoTimer.millisToNanos(1000);
- sampleCollector.sample(timeStamp);
- Awaitility.await().atMost(2, TimeUnit.SECONDS).pollInterval(10, TimeUnit.MILLISECONDS)
- .until(() -> notifications.size() == 0);
- assertThat(notifications.isEmpty()).isTrue();
+ timeStamp = validateTimeStamp(sampleCollector, notifications, timeStamp);
// validate no notification occurs when only other stats are updated
st1_2.incDouble("double_counter_1", 3.3);
st1_2.incInt("int_counter_2", 1);
st1_2.incLong("long_counter_3", 2);
- timeStamp += NanoTimer.millisToNanos(1000);
- sampleCollector.sample(timeStamp);
- Awaitility.await().atMost(2, TimeUnit.SECONDS).pollInterval(10, TimeUnit.MILLISECONDS)
- .until(() -> notifications.size() == 0);
- assertThat(notifications.isEmpty()).isTrue();
+ timeStamp = validateTimeStamp(sampleCollector, notifications, timeStamp);
// validate notification only contains stats added to monitor
st1_1.incInt("int_counter_2", 100);
st1_2.incInt("int_counter_2", 200);
assertThat(sampleCollector.currentHandlersForTesting().size()).isEqualTo(2);
+ notification = validateTimeStamp2(sampleCollector, notifications, timeStamp);
+ expectedValues = new HashMap<>();
+ expectedValues.put("int_counter_2", 104);
+ statCount = assertStatisticsNotification(notification, expectedValues);
+ assertThat(statCount).isEqualTo(1);
+ }
+
+ @NotNull
+ private StatisticsNotification validateTimeStamp2(SampleCollector sampleCollector,
+ List<StatisticsNotification> notifications,
+ long timeStamp) {
+ StatisticsNotification notification;
timeStamp += NanoTimer.millisToNanos(1000);
sampleCollector.sample(timeStamp);
Awaitility.await().atMost(2, TimeUnit.SECONDS).pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> notifications.size() > 0);
assertThat(notifications.size()).isEqualTo(1);
notification = notifications.remove(0);
- assertThat(notification.getType()).isEqualTo(StatisticsNotification.Type.VALUE_CHANGED);
- expectedValues = new HashMap<>();
- expectedValues.put("int_counter_2", 104);
- statCount = assertStatisticsNotification(notification, expectedValues);
- assertThat(statCount).isEqualTo(1);
+ assertThat(notification.getType()).isEqualTo(Type.VALUE_CHANGED);
+ return notification;
+ }
+
+ private long validateTimeStamp(SampleCollector sampleCollector,
+ List<StatisticsNotification> notifications, long timeStamp) {
+ timeStamp += NanoTimer.millisToNanos(1000);
+ sampleCollector.sample(timeStamp);
+ Awaitility.await().atMost(2, TimeUnit.SECONDS).pollInterval(10, TimeUnit.MILLISECONDS)
+ .until(() -> notifications.size() == 0);
+ assertThat(notifications.isEmpty()).isTrue();
+ return timeStamp;
}
}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/beans/ManagementAdapterTest.java b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/beans/ManagementAdapterTest.java
index 970015b..4999782 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/beans/ManagementAdapterTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/beans/ManagementAdapterTest.java
@@ -54,7 +54,7 @@ public class ManagementAdapterTest {
public void before() {
cache = serverRule.getCache();
doReturn(StatsFactory.createStatsImpl(DiskStoreStats.class, "disk-stats")).when(diskStore)
- .getStats();
+ .getStats();
doReturn(new File[] {}).when(diskStore).getDiskDirs();
}
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java
index 17719c2..d5eaf1f 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java
@@ -90,7 +90,6 @@ import org.apache.geode.internal.sequencelog.MembershipLogger;
import org.apache.geode.internal.tcp.Connection;
import org.apache.geode.internal.tcp.ConnectionTable;
import org.apache.geode.internal.tcp.ReenteredConnectException;
-import org.apache.geode.internal.util.concurrent.StoppableReentrantLock;
import org.apache.geode.stats.common.distributed.internal.DMStats;
import org.apache.geode.stats.common.distributed.internal.DistributionStats;
import org.apache.geode.stats.common.statistics.factory.StatsFactory;
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/map/RegionMapDestroyTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/map/RegionMapDestroyTest.java
index f02468d..04e2301 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/map/RegionMapDestroyTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/map/RegionMapDestroyTest.java
@@ -41,7 +41,6 @@ import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.EntryNotFoundException;
import org.apache.geode.cache.Operation;
import org.apache.geode.cache.query.internal.index.IndexManager;
-import org.apache.geode.internal.cache.CachePerfStats;
import org.apache.geode.internal.cache.EntryEventImpl;
import org.apache.geode.internal.cache.InternalRegion;
import org.apache.geode.internal.cache.RegionClearedException;
@@ -53,6 +52,7 @@ import org.apache.geode.internal.cache.versions.ConcurrentCacheModificationExcep
import org.apache.geode.internal.cache.versions.RegionVersionVector;
import org.apache.geode.internal.cache.versions.VersionStamp;
import org.apache.geode.internal.cache.versions.VersionTag;
+import org.apache.geode.stats.common.internal.cache.CachePerfStats;
public class RegionMapDestroyTest {