You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/12/12 22:36:49 UTC
[46/46] geode git commit: Fix formatting
Fix formatting
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/d261061e
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/d261061e
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/d261061e
Branch: refs/heads/feature/GEODE-1930
Commit: d261061e5208df75d226e9b97e444356e9543eaa
Parents: 681fbe8
Author: Kirk Lund <kl...@apache.org>
Authored: Mon Nov 7 12:33:04 2016 -0800
Committer: Kirk Lund <kl...@apache.org>
Committed: Mon Nov 28 10:57:42 2016 -0800
----------------------------------------------------------------------
.../RestAPIsAndInterOpsDUnitTest.java | 64 ++-
.../org/apache/geode/management/OSMetrics.java | 2 +-
.../internal/SystemManagementService.java | 3 +-
.../DistributedLockServiceDUnitTest.java | 18 +-
.../cache/ConnectDisconnectDUnitTest.java | 26 +-
...gionBucketCreationDistributionDUnitTest.java | 8 +-
.../cache/locks/TXLockServiceDUnitTest.java | 18 +-
.../management/CacheManagementDUnitTest.java | 124 +++---
.../management/ClientHealthStatsDUnitTest.java | 54 ++-
.../management/CompositeTypeTestDUnitTest.java | 16 +-
.../management/DLockManagementDUnitTest.java | 69 ++--
.../management/DiskManagementDUnitTest.java | 44 +--
.../management/DistributedSystemDUnitTest.java | 105 +++--
.../management/LocatorManagementDUnitTest.java | 55 +--
.../geode/management/ManagementTestBase.java | 31 +-
.../geode/management/ManagementTestRule.java | 69 ++--
.../org/apache/geode/management/Manager.java | 22 +-
.../org/apache/geode/management/Member.java | 22 +-
.../management/OffHeapManagementDUnitTest.java | 76 ++--
.../geode/management/QueryDataDUnitTest.java | 254 ++++++++----
.../management/RegionManagementDUnitTest.java | 385 ++++++++++++-------
.../stats/DistributedSystemStatsDUnitTest.java | 12 +-
.../QueryDataFunctionApplyLimitClauseTest.java | 11 +-
.../internal/pulse/TestClientIdsDUnitTest.java | 42 +-
.../pulse/TestSubscriptionsDUnitTest.java | 26 +-
.../geode/test/dunit/AsyncInvocation.java | 29 +-
.../java/org/apache/geode/test/dunit/VM.java | 10 +-
.../geode/test/dunit/rules/DistributedRule.java | 46 ++-
.../test/dunit/rules/DistributedRunRules.java | 28 +-
.../test/dunit/rules/DistributedStatement.java | 23 +-
.../test/dunit/rules/DistributedTestRule.java | 94 ++---
.../DistributedUseJacksonForJsonPathRule.java | 23 +-
.../dunit/rules/DistributedWrapperRule.java | 27 +-
.../apache/geode/test/dunit/rules/WhichVMs.java | 31 +-
.../rules/tests/DistributedTestRuleTest.java | 22 +-
.../test/dunit/standalone/DUnitLauncher.java | 11 +-
.../junit/rules/UseJacksonForJsonPathRule.java | 28 +-
.../SerializableExternalResource.java | 3 +-
.../serializable/SerializableStatement.java | 22 +-
.../management/LuceneManagementDUnitTest.java | 15 +-
40 files changed, 1124 insertions(+), 844 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/d261061e/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
index b989206..1802140 100644
--- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
@@ -85,43 +85,33 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
public static final String PEOPLE_REGION_NAME = "People";
- private static final String findAllPeopleQuery = "/queries?id=findAllPeople&q=SELECT%20*%20FROM%20/People";
- private static final String findPeopleByGenderQuery = "/queries?id=filterByGender&q=SELECT%20*%20from%20/People%20where%20gender=$1";
- private static final String findPeopleByLastNameQuery = "/queries?id=filterByLastName&q=SELECT%20*%20from%20/People%20where%20lastName=$1";
-
- private static final String[] PARAM_QUERY_IDS_ARRAY = { "findAllPeople",
- "filterByGender", "filterByLastName" };
-
- final static String QUERY_ARGS = "["
- + "{"
- + "\"@type\": \"string\","
- + "\"@value\": \"Patel\""
- + "}"
- + "]";
-
- final static String PERSON_AS_JSON_CAS = "{"
- + "\"@old\" :"
- + "{"
- + "\"@type\": \"org.apache.geode.rest.internal.web.controllers.Person\","
- + "\"id\": 101," + " \"firstName\": \"Mithali\","
- + " \"middleName\": \"Dorai\"," + " \"lastName\": \"Raj\","
- + " \"birthDate\": \"12/04/1982\"," + "\"gender\": \"FEMALE\""
- + "},"
- + "\"@new\" :"
- + "{"
- + "\"@type\": \"org.apache.geode.rest.internal.web.controllers.Person\","
- + "\"id\": 1101," + " \"firstName\": \"Virat\","
- + " \"middleName\": \"Premkumar\"," + " \"lastName\": \"Kohli\","
- + " \"birthDate\": \"08/11/1988\"," + "\"gender\": \"MALE\""
- + "}"
- + "}";
-
- final static String PERSON_AS_JSON_REPLACE = "{"
- + "\"@type\": \"org.apache.geode.rest.internal.web.controllers.Person\","
- + "\"id\": 501," + " \"firstName\": \"Barack\","
- + " \"middleName\": \"Hussein\"," + " \"lastName\": \"Obama\","
- + " \"birthDate\": \"04/08/1961\"," + "\"gender\": \"MALE\""
- + "}";
+ private static final String findAllPeopleQuery =
+ "/queries?id=findAllPeople&q=SELECT%20*%20FROM%20/People";
+ private static final String findPeopleByGenderQuery =
+ "/queries?id=filterByGender&q=SELECT%20*%20from%20/People%20where%20gender=$1";
+ private static final String findPeopleByLastNameQuery =
+ "/queries?id=filterByLastName&q=SELECT%20*%20from%20/People%20where%20lastName=$1";
+
+ private static final String[] PARAM_QUERY_IDS_ARRAY =
+ {"findAllPeople", "filterByGender", "filterByLastName"};
+
+ final static String QUERY_ARGS =
+ "[" + "{" + "\"@type\": \"string\"," + "\"@value\": \"Patel\"" + "}" + "]";
+
+ final static String PERSON_AS_JSON_CAS = "{" + "\"@old\" :" + "{"
+ + "\"@type\": \"org.apache.geode.rest.internal.web.controllers.Person\"," + "\"id\": 101,"
+ + " \"firstName\": \"Mithali\"," + " \"middleName\": \"Dorai\"," + " \"lastName\": \"Raj\","
+ + " \"birthDate\": \"12/04/1982\"," + "\"gender\": \"FEMALE\"" + "}," + "\"@new\" :" + "{"
+ + "\"@type\": \"org.apache.geode.rest.internal.web.controllers.Person\"," + "\"id\": 1101,"
+ + " \"firstName\": \"Virat\"," + " \"middleName\": \"Premkumar\","
+ + " \"lastName\": \"Kohli\"," + " \"birthDate\": \"08/11/1988\"," + "\"gender\": \"MALE\""
+ + "}" + "}";
+
+ final static String PERSON_AS_JSON_REPLACE =
+ "{" + "\"@type\": \"org.apache.geode.rest.internal.web.controllers.Person\"," + "\"id\": 501,"
+ + " \"firstName\": \"Barack\"," + " \"middleName\": \"Hussein\","
+ + " \"lastName\": \"Obama\"," + " \"birthDate\": \"04/08/1961\"," + "\"gender\": \"MALE\""
+ + "}";
private static final String PERSON_LIST_AS_JSON = "[" + "{"
+ "\"@type\": \"org.apache.geode.rest.internal.web.controllers.Person\"," + "\"id\": 3,"
http://git-wip-us.apache.org/repos/asf/geode/blob/d261061e/geode-core/src/main/java/org/apache/geode/management/OSMetrics.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/OSMetrics.java b/geode-core/src/main/java/org/apache/geode/management/OSMetrics.java
index e6f27a7..c9de92f 100644
--- a/geode-core/src/main/java/org/apache/geode/management/OSMetrics.java
+++ b/geode-core/src/main/java/org/apache/geode/management/OSMetrics.java
@@ -25,7 +25,7 @@ import java.io.Serializable;
*
*/
public class OSMetrics implements Serializable {
-
+
/**
* Maximum number file descriptor which can be opened
*/
http://git-wip-us.apache.org/repos/asf/geode/blob/d261061e/geode-core/src/main/java/org/apache/geode/management/internal/SystemManagementService.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/SystemManagementService.java b/geode-core/src/main/java/org/apache/geode/management/internal/SystemManagementService.java
index 0d243c7..fe0f59f 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/SystemManagementService.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/SystemManagementService.java
@@ -350,7 +350,8 @@ public final class SystemManagementService extends BaseManagementService {
}
- public <T> T getMBeanProxy(ObjectName objectName, Class<T> interfaceClass) { // TODO: this is too generic
+ public <T> T getMBeanProxy(ObjectName objectName, Class<T> interfaceClass) { // TODO: this is too
+ // generic
if (!isStartedAndOpen()) {
return null;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d261061e/geode-core/src/test/java/org/apache/geode/distributed/DistributedLockServiceDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/DistributedLockServiceDUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/DistributedLockServiceDUnitTest.java
index 7b2dd18..9a889ca 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/DistributedLockServiceDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/DistributedLockServiceDUnitTest.java
@@ -98,15 +98,15 @@ public class DistributedLockServiceDUnitTest extends JUnit4DistributedTestCase {
@Override
public final void preTearDown() throws Exception {
Invoke.invokeInEveryVM(() -> destroyAllDLockServices());
-// invokeInEveryVMAndController(DistributedLockServiceDUnitTest.class,
-// "remoteDumpAllDLockServices");
-
- //InternalDistributedLockService.destroyAll();
-
-// // Disconnects the DistributedSystem in every VM - since
-// // each test randomly chooses whether shared memory is used
-// disconnectAllFromDS();
-
+ // invokeInEveryVMAndController(DistributedLockServiceDUnitTest.class,
+ // "remoteDumpAllDLockServices");
+
+ // InternalDistributedLockService.destroyAll();
+
+ // // Disconnects the DistributedSystem in every VM - since
+ // // each test randomly chooses whether shared memory is used
+ // disconnectAllFromDS();
+
this.lockGrantor = null;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d261061e/geode-core/src/test/java/org/apache/geode/internal/cache/ConnectDisconnectDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ConnectDisconnectDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ConnectDisconnectDUnitTest.java
index 2213700..5213ebc 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ConnectDisconnectDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ConnectDisconnectDUnitTest.java
@@ -40,19 +40,19 @@ public class ConnectDisconnectDUnitTest extends JUnit4CacheTestCase {
// see bugs #50785 and #46438
@Test
public void testManyConnectsAndDisconnects() throws Throwable {
-// invokeInEveryVMAndController(new SerializableRunnable() {
-//
-// @Override
-// public void run() {
-// Log.setLogWriterLevel("info");
-// }
-// });
-
-// uncomment these lines to use stand-alone locators
-// int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(4);
-// setLocatorPorts(ports);
-
- for(int i = 0; i < 20; i++) {
+ // invokeInEveryVMAndController(new SerializableRunnable() {
+ //
+ // @Override
+ // public void run() {
+ // Log.setLogWriterLevel("info");
+ // }
+ // });
+
+ // uncomment these lines to use stand-alone locators
+ // int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(4);
+ // setLocatorPorts(ports);
+
+ for (int i = 0; i < 20; i++) {
LogWriterUtils.getLogWriter().info("Test run: " + i);
runOnce();
tearDown();
http://git-wip-us.apache.org/repos/asf/geode/blob/d261061e/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java
index 0cb6693..82498df 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java
@@ -443,10 +443,10 @@ public class PartitionedRegionBucketCreationDistributionDUnitTest
}
});
-// invokeInEveryVMAndController(new SerializableRunnable("") {
-//
-// }
-
+ // invokeInEveryVMAndController(new SerializableRunnable("") {
+ //
+ // }
+
}
/**
http://git-wip-us.apache.org/repos/asf/geode/blob/d261061e/geode-core/src/test/java/org/apache/geode/internal/cache/locks/TXLockServiceDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/locks/TXLockServiceDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/locks/TXLockServiceDUnitTest.java
index a40de8b..054ab3b 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/locks/TXLockServiceDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/locks/TXLockServiceDUnitTest.java
@@ -89,12 +89,11 @@ public class TXLockServiceDUnitTest extends JUnit4DistributedTestCase {
@Override
public final void preTearDown() throws Exception {
-// invokeInEveryVMAndController(TXLockServiceDUnitTest.class,
-// "remoteDumpAllDLockServices");
-
- Invoke.invokeInEveryVM(TXLockServiceDUnitTest.class,
- "destroyServices");
-
+ // invokeInEveryVMAndController(TXLockServiceDUnitTest.class,
+ // "remoteDumpAllDLockServices");
+
+ Invoke.invokeInEveryVM(TXLockServiceDUnitTest.class, "destroyServices");
+
destroyServices();
// // Disconnects the DistributedSystem in every VM - since
@@ -114,9 +113,10 @@ public class TXLockServiceDUnitTest extends JUnit4DistributedTestCase {
@Test
public void testGetAndDestroy() {
forEachVMInvoke("checkGetAndDestroy", new Object[] {});
- /*invokeInEveryVMAndController(TXLockServiceDUnitTest.class,
- "destroyServices");
- forEachVMInvoke("checkGetAndDestroy", new Object[] {});*/
+ /*
+ * invokeInEveryVMAndController(TXLockServiceDUnitTest.class, "destroyServices");
+ * forEachVMInvoke("checkGetAndDestroy", new Object[] {});
+ */
}
@Test
http://git-wip-us.apache.org/repos/asf/geode/blob/d261061e/geode-core/src/test/java/org/apache/geode/management/CacheManagementDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/CacheManagementDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/CacheManagementDUnitTest.java
index a40bfd1..62d0b9b 100644
--- a/geode-core/src/test/java/org/apache/geode/management/CacheManagementDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/CacheManagementDUnitTest.java
@@ -64,14 +64,16 @@ import org.apache.geode.test.junit.rules.serializable.SerializableTestName;
* This class checks and verifies various data and operations exposed through MemberMXBean
* interface.
* <p>
- * <p>Goal of the Test : MemberMBean gets created once cache is created. Data like
- * config data and stats are of proper value To check proper federation of
- * MemberMBean including remote ops and remote data access
* <p>
- * <p>This test is a mess and needs to be rewritten.
+ * Goal of the Test : MemberMBean gets created once cache is created. Data like config data and
+ * stats are of proper value To check proper federation of MemberMBean including remote ops and
+ * remote data access
+ * <p>
+ * <p>
+ * This test is a mess and needs to be rewritten.
*/
@Category(DistributedTest.class)
-@SuppressWarnings({ "serial", "unused" })
+@SuppressWarnings({"serial", "unused"})
public class CacheManagementDUnitTest implements Serializable {
/** used in memberVMs */
@@ -107,7 +109,8 @@ public class CacheManagementDUnitTest implements Serializable {
Map<DistributedMember, DistributionConfig> configMap = new HashMap<>();
for (VM memberVM : this.memberVMs) {
- Map<DistributedMember, DistributionConfig> configMapMember = memberVM.invoke(() -> verifyConfigData());
+ Map<DistributedMember, DistributionConfig> configMapMember =
+ memberVM.invoke(() -> verifyConfigData());
configMap.putAll(configMapMember);
}
@@ -122,7 +125,8 @@ public class CacheManagementDUnitTest implements Serializable {
int i = 1;
for (VM memberVM : this.memberVMs) {
Properties props = new Properties();
- props.setProperty(LOG_FILE, this.temporaryFolder.newFile(this.testName.getMethodName() + "-VM" + i + ".log").getAbsolutePath());
+ props.setProperty(LOG_FILE, this.temporaryFolder
+ .newFile(this.testName.getMethodName() + "-VM" + i + ".log").getAbsolutePath());
this.managementTestRule.createMember(memberVM, props);
i++;
}
@@ -160,8 +164,7 @@ public class CacheManagementDUnitTest implements Serializable {
}
/**
- * Creates and starts a managerVM.
- * Multiple Managers
+ * Creates and starts a managerVM. Multiple Managers
*/
@Test
public void testManager() throws Exception {
@@ -184,8 +187,7 @@ public class CacheManagementDUnitTest implements Serializable {
}
/**
- * Creates and starts a managerVM.
- * Multiple Managers
+ * Creates and starts a managerVM. Multiple Managers
*/
@Test
public void testManagerShutdown() throws Exception {
@@ -196,7 +198,8 @@ public class CacheManagementDUnitTest implements Serializable {
this.managementTestRule.createManager(this.managerVM, false);
this.managementTestRule.startManager(this.managerVM);
- verifyManagerStarted(this.managerVM, this.managementTestRule.getDistributedMember(this.memberVMs[0]));
+ verifyManagerStarted(this.managerVM,
+ this.managementTestRule.getDistributedMember(this.memberVMs[0]));
this.managementTestRule.stopManager(this.managerVM);
verifyManagerStopped(this.managerVM, this.memberVMs.length);
@@ -265,7 +268,8 @@ public class CacheManagementDUnitTest implements Serializable {
attachListenerToDistributedSystemMXBean(this.managerVM);
// Step : 3 : Verify Notification count, notification region sizes
- verifyNotificationsAndRegionSize(this.memberVMs[0], this.memberVMs[1], this.memberVMs[2], this.managerVM);
+ verifyNotificationsAndRegionSize(this.memberVMs[0], this.memberVMs[1], this.memberVMs[2],
+ this.managerVM);
}
@Test
@@ -283,7 +287,8 @@ public class CacheManagementDUnitTest implements Serializable {
this.managementTestRule.createMember(this.memberVMs[2]);
// Step : 3 : Verify Notification count, notification region sizes
- verifyNotificationsAndRegionSize(this.memberVMs[0], this.memberVMs[1], this.memberVMs[2], this.managerVM);
+ verifyNotificationsAndRegionSize(this.memberVMs[0], this.memberVMs[1], this.memberVMs[2],
+ this.managerVM);
}
@Test
@@ -318,7 +323,8 @@ public class CacheManagementDUnitTest implements Serializable {
assertThat(objectNames.contains(memberMBeanName)).isTrue();
}
- Set<ObjectName> names = service.queryMBeanNames(this.managementTestRule.getDistributedMember());
+ Set<ObjectName> names =
+ service.queryMBeanNames(this.managementTestRule.getDistributedMember());
ObjectName[] arrayOfNames = names.toArray(new ObjectName[names.size()]);
assertThat(superSet).doesNotContain(arrayOfNames); // TODO: what value does this method have?
@@ -357,10 +363,11 @@ public class CacheManagementDUnitTest implements Serializable {
ObjectName memberMBeanName = service.getMemberMBeanName(otherMember);
- await().until(() -> assertThat(service.getMBeanProxy(memberMBeanName, MemberMXBean.class)).isNotNull());
+ await().until(
+ () -> assertThat(service.getMBeanProxy(memberMBeanName, MemberMXBean.class)).isNotNull());
MemberMXBean memberMXBean = service.getMBeanProxy(memberMBeanName, MemberMXBean.class);
- //Ensure Data getting federated from Managing node
+ // Ensure Data getting federated from Managing node
long start = memberMXBean.getMemberUpTime();
await().until(() -> assertThat(memberMXBean.getMemberUpTime()).isGreaterThan(start));
});
@@ -382,7 +389,8 @@ public class CacheManagementDUnitTest implements Serializable {
assertThat(otherMembers).hasSize(otherMembersCount);
for (DistributedMember member : otherMembers) {
- Set<ObjectName> proxyNames = service.getFederatingManager().getProxyFactory().findAllProxies(member);
+ Set<ObjectName> proxyNames =
+ service.getFederatingManager().getProxyFactory().findAllProxies(member);
assertThat(proxyNames).isEmpty();
ObjectName proxyMBeanName = service.getMemberMBeanName(member);
@@ -393,7 +401,8 @@ public class CacheManagementDUnitTest implements Serializable {
private Map<DistributedMember, DistributionConfig> verifyConfigData() {
ManagementService service = this.managementTestRule.getManagementService();
- InternalDistributedSystem ids = (InternalDistributedSystem) this.managementTestRule.getCache().getDistributedSystem();
+ InternalDistributedSystem ids =
+ (InternalDistributedSystem) this.managementTestRule.getCache().getDistributedSystem();
DistributionConfig config = ids.getConfig();
MemberMXBean bean = service.getMemberMXBean();
@@ -409,7 +418,8 @@ public class CacheManagementDUnitTest implements Serializable {
* This is to check whether the config data has been propagated to the Managing node properly or
* not.
*/
- private void verifyConfigDataRemote(final Map<DistributedMember, DistributionConfig> configMap) throws Exception {
+ private void verifyConfigDataRemote(final Map<DistributedMember, DistributionConfig> configMap)
+ throws Exception {
Set<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
for (DistributedMember member : otherMembers) {
@@ -424,7 +434,8 @@ public class CacheManagementDUnitTest implements Serializable {
/**
* Asserts that distribution config and gemfireProperty composite types hold the same values
*/
- private void verifyGemFirePropertiesData(final DistributionConfig config, final GemFireProperties data) {
+ private void verifyGemFirePropertiesData(final DistributionConfig config,
+ final GemFireProperties data) {
assertThat(data.getMemberName()).isEqualTo(config.getName());
// **TODO **
@@ -434,19 +445,23 @@ public class CacheManagementDUnitTest implements Serializable {
assertThat(data.getMcastAddress()).isEqualTo(config.getMcastAddress().getHostAddress());
assertThat(data.getBindAddress()).isEqualTo(config.getBindAddress());
assertThat(data.getTcpPort()).isEqualTo(config.getTcpPort());
- assertThat(removeVMDir(data.getCacheXMLFile())).isEqualTo(removeVMDir(config.getCacheXmlFile().getAbsolutePath()));
+ assertThat(removeVMDir(data.getCacheXMLFile()))
+ .isEqualTo(removeVMDir(config.getCacheXmlFile().getAbsolutePath()));
// **TODO **
assertThat(data.getMcastTTL()).isEqualTo(config.getMcastTtl());
assertThat(data.getServerBindAddress()).isEqualTo(config.getServerBindAddress());
assertThat(data.getLocators()).isEqualTo(config.getLocators());
- //The start locator may contain a directory
- assertThat(removeVMDir(data.getStartLocator())).isEqualTo(removeVMDir(config.getStartLocator()));
- assertThat(removeVMDir(data.getLogFile())).isEqualTo(removeVMDir(config.getLogFile().getAbsolutePath()));
+ // The start locator may contain a directory
+ assertThat(removeVMDir(data.getStartLocator()))
+ .isEqualTo(removeVMDir(config.getStartLocator()));
+ assertThat(removeVMDir(data.getLogFile()))
+ .isEqualTo(removeVMDir(config.getLogFile().getAbsolutePath()));
assertThat(data.getLogLevel()).isEqualTo(config.getLogLevel());
assertThat(data.isStatisticSamplingEnabled()).isEqualTo(config.getStatisticSamplingEnabled());
- assertThat(removeVMDir(data.getStatisticArchiveFile())).isEqualTo(removeVMDir(config.getStatisticArchiveFile().getAbsolutePath()));
+ assertThat(removeVMDir(data.getStatisticArchiveFile()))
+ .isEqualTo(removeVMDir(config.getStatisticArchiveFile().getAbsolutePath()));
// ** TODO **
String includeFile = null;
@@ -460,20 +475,25 @@ public class CacheManagementDUnitTest implements Serializable {
assertThat(data.getClusterSSLCiphers()).isEqualTo(config.getClusterSSLCiphers());
assertThat(data.getClusterSSLProtocols()).isEqualTo(config.getClusterSSLProtocols());
- assertThat(data.isClusterSSLRequireAuthentication()).isEqualTo(config.getClusterSSLRequireAuthentication());
+ assertThat(data.isClusterSSLRequireAuthentication())
+ .isEqualTo(config.getClusterSSLRequireAuthentication());
assertThat(data.getSocketLeaseTime()).isEqualTo(config.getSocketLeaseTime());
assertThat(data.getSocketBufferSize()).isEqualTo(config.getSocketBufferSize());
assertThat(data.getMcastSendBufferSize()).isEqualTo(config.getMcastSendBufferSize());
assertThat(data.getMcastRecvBufferSize()).isEqualTo(config.getMcastRecvBufferSize());
- assertThat(data.getMcastByteAllowance()).isEqualTo(config.getMcastFlowControl().getByteAllowance());
- assertThat(data.getMcastRechargeThreshold()).isEqualTo(config.getMcastFlowControl().getRechargeThreshold());
- assertThat(data.getMcastRechargeBlockMs()).isEqualTo(config.getMcastFlowControl().getRechargeBlockMs());
+ assertThat(data.getMcastByteAllowance())
+ .isEqualTo(config.getMcastFlowControl().getByteAllowance());
+ assertThat(data.getMcastRechargeThreshold())
+ .isEqualTo(config.getMcastFlowControl().getRechargeThreshold());
+ assertThat(data.getMcastRechargeBlockMs())
+ .isEqualTo(config.getMcastFlowControl().getRechargeBlockMs());
assertThat(data.getUdpFragmentSize()).isEqualTo(config.getUdpFragmentSize());
assertThat(data.getUdpSendBufferSize()).isEqualTo(config.getUdpSendBufferSize());
assertThat(data.getUdpRecvBufferSize()).isEqualTo(config.getUdpRecvBufferSize());
assertThat(data.isDisableTcp()).isEqualTo(config.getDisableTcp());
assertThat(data.isEnableTimeStatistics()).isEqualTo(config.getEnableTimeStatistics());
- assertThat(data.isEnableNetworkPartitionDetection()).isEqualTo(config.getEnableNetworkPartitionDetection());
+ assertThat(data.isEnableNetworkPartitionDetection())
+ .isEqualTo(config.getEnableNetworkPartitionDetection());
assertThat(data.getMemberTimeout()).isEqualTo(config.getMemberTimeout());
assertThat(data.getMembershipPortRange()).containsExactly(config.getMembershipPortRange());
@@ -488,15 +508,19 @@ public class CacheManagementDUnitTest implements Serializable {
assertThat(data.getDurableClientId()).isEqualTo(config.getDurableClientId());
assertThat(data.getDurableClientTimeout()).isEqualTo(config.getDurableClientTimeout());
assertThat(data.getSecurityClientAuthInit()).isEqualTo(config.getSecurityClientAuthInit());
- assertThat(data.getSecurityClientAuthenticator()).isEqualTo(config.getSecurityClientAuthenticator());
+ assertThat(data.getSecurityClientAuthenticator())
+ .isEqualTo(config.getSecurityClientAuthenticator());
assertThat(data.getSecurityClientDHAlgo()).isEqualTo(config.getSecurityClientDHAlgo());
assertThat(data.getSecurityPeerAuthInit()).isEqualTo(config.getSecurityPeerAuthInit());
- assertThat(data.getSecurityClientAuthenticator()).isEqualTo(config.getSecurityPeerAuthenticator());
+ assertThat(data.getSecurityClientAuthenticator())
+ .isEqualTo(config.getSecurityPeerAuthenticator());
assertThat(data.getSecurityClientAccessor()).isEqualTo(config.getSecurityClientAccessor());
assertThat(data.getSecurityClientAccessorPP()).isEqualTo(config.getSecurityClientAccessorPP());
assertThat(data.getSecurityLogLevel()).isEqualTo(config.getSecurityLogLevel());
- assertThat(removeVMDir(data.getSecurityLogFile())).isEqualTo(removeVMDir(config.getSecurityLogFile().getAbsolutePath()));
- assertThat(data.getSecurityPeerMembershipTimeout()).isEqualTo(config.getSecurityPeerMembershipTimeout());
+ assertThat(removeVMDir(data.getSecurityLogFile()))
+ .isEqualTo(removeVMDir(config.getSecurityLogFile().getAbsolutePath()));
+ assertThat(data.getSecurityPeerMembershipTimeout())
+ .isEqualTo(config.getSecurityPeerMembershipTimeout());
assertThat(data.isRemoveUnresponsiveClient()).isEqualTo(config.getRemoveUnresponsiveClient());
assertThat(data.isDeltaPropagation()).isEqualTo(config.getDeltaPropagation());
assertThat(data.getRedundancyZone()).isEqualTo(config.getRedundancyZone());
@@ -557,8 +581,10 @@ public class CacheManagementDUnitTest implements Serializable {
}
private void verifyExpectedMembers(final int otherMembersCount) {
- String alias = "awaiting " + this.managementTestRule.getOtherNormalMembers() + " to have size " + otherMembersCount;
- await(alias).until(() -> assertThat(this.managementTestRule.getOtherNormalMembers()).hasSize(otherMembersCount));
+ String alias = "awaiting " + this.managementTestRule.getOtherNormalMembers() + " to have size "
+ + otherMembersCount;
+ await(alias).until(() -> assertThat(this.managementTestRule.getOtherNormalMembers())
+ .hasSize(otherMembersCount));
}
private void invokeRemoteMemberMXBeanOps() throws Exception {
@@ -574,9 +600,9 @@ public class CacheManagementDUnitTest implements Serializable {
// TODO: need assertions
- //("<ExpectedString> JVMMetrics is " + metrics.toString() + "</ExpectedString> ");
- //("<ExpectedString> OSMetrics is " + metrics.toString() + "</ExpectedString> ");
- //("<ExpectedString> Boolean Data Check " + bean.isManager() + "</ExpectedString> ");
+ // ("<ExpectedString> JVMMetrics is " + metrics.toString() + "</ExpectedString> ");
+ // ("<ExpectedString> OSMetrics is " + metrics.toString() + "</ExpectedString> ");
+ // ("<ExpectedString> Boolean Data Check " + bean.isManager() + "</ExpectedString> ");
}
}
@@ -591,11 +617,13 @@ public class CacheManagementDUnitTest implements Serializable {
}
};
- ManagementFactory.getPlatformMBeanServer().addNotificationListener(MBeanJMXAdapter.getDistributedSystemName(), listener, null, null);
+ ManagementFactory.getPlatformMBeanServer().addNotificationListener(
+ MBeanJMXAdapter.getDistributedSystemName(), listener, null, null);
});
}
- private void verifyNotificationsAndRegionSize(final VM memberVM1, final VM memberVM2, final VM memberVM3, final VM managerVM) {
+ private void verifyNotificationsAndRegionSize(final VM memberVM1, final VM memberVM2,
+ final VM memberVM3, final VM managerVM) {
DistributedMember member1 = this.managementTestRule.getDistributedMember(memberVM1);
DistributedMember member2 = this.managementTestRule.getDistributedMember(memberVM2);
DistributedMember member3 = this.managementTestRule.getDistributedMember(memberVM3);
@@ -628,15 +656,18 @@ public class CacheManagementDUnitTest implements Serializable {
private void createNotificationRegion(final String memberId) {
SystemManagementService service = this.managementTestRule.getSystemManagementService();
- Map<ObjectName, NotificationHubListener> notificationHubListenerMap = service.getNotificationHub().getListenerObjectMap();
+ Map<ObjectName, NotificationHubListener> notificationHubListenerMap =
+ service.getNotificationHub().getListenerObjectMap();
await().until(() -> assertThat(notificationHubListenerMap.size()).isEqualTo(1));
- RegionFactory regionFactory = this.managementTestRule.getCache().createRegionFactory(RegionShortcut.REPLICATE);
+ RegionFactory regionFactory =
+ this.managementTestRule.getCache().createRegionFactory(RegionShortcut.REPLICATE);
for (int i = 1; i <= 15; i++) {
regionFactory.create(NOTIFICATION_REGION_NAME + i);
}
- Region region = this.managementTestRule.getCache().getRegion(ManagementConstants.NOTIFICATION_REGION + "_" + memberId);
+ Region region = this.managementTestRule.getCache()
+ .getRegion(ManagementConstants.NOTIFICATION_REGION + "_" + memberId);
assertThat(region).isEmpty();
}
@@ -646,7 +677,8 @@ public class CacheManagementDUnitTest implements Serializable {
ObjectName objectName = service.getMemberMBeanName(member);
String alias = "awaiting MemberMXBean proxy for " + member;
- await(alias).until(() -> assertThat(service.getMBeanProxy(objectName, MemberMXBean.class)).isNotNull());
+ await(alias)
+ .until(() -> assertThat(service.getMBeanProxy(objectName, MemberMXBean.class)).isNotNull());
return service.getMBeanProxy(objectName, MemberMXBean.class);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d261061e/geode-core/src/test/java/org/apache/geode/management/ClientHealthStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/ClientHealthStatsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/ClientHealthStatsDUnitTest.java
index d6c0f0a..cebfddc 100644
--- a/geode-core/src/test/java/org/apache/geode/management/ClientHealthStatsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/ClientHealthStatsDUnitTest.java
@@ -58,7 +58,7 @@ import org.apache.geode.test.junit.categories.DistributedTest;
* Client health stats check
*/
@Category(DistributedTest.class)
-@SuppressWarnings({ "serial", "unused" })
+@SuppressWarnings({"serial", "unused"})
public class ClientHealthStatsDUnitTest implements Serializable {
private static final int NUMBER_PUTS = 100;
@@ -68,7 +68,8 @@ public class ClientHealthStatsDUnitTest implements Serializable {
private static final String VALUE1 = "VALUE1";
private static final String VALUE2 = "VALUE2";
- private static final String REGION_NAME = ClientHealthStatsDUnitTest.class.getSimpleName() + "_Region";
+ private static final String REGION_NAME =
+ ClientHealthStatsDUnitTest.class.getSimpleName() + "_Region";
// client1VM and client2VM VM fields
private static ClientCache clientCache;
@@ -174,19 +175,28 @@ public class ClientHealthStatsDUnitTest implements Serializable {
public void testStatsMatchWithSize() throws Exception {
int port = this.serverVM.invoke(() -> createServerCache()); // start a serverVM
- this.client1VM.invoke(() -> createClientCache(this.hostName, port, 1, true)); // create durable client1VM, with durable RI
+ this.client1VM.invoke(() -> createClientCache(this.hostName, port, 1, true)); // create durable
+ // client1VM, with
+ // durable RI
- this.serverVM.invoke(() -> doPuts()); // do puts on serverVM from three different threads, pause after 500 puts each.
+ this.serverVM.invoke(() -> doPuts()); // do puts on serverVM from three different threads, pause
+ // after 500 puts each.
this.client1VM.invoke(() -> clientCache.close(true)); // close durable client1VM
- this.serverVM.invoke(() -> await().atMost(2, MINUTES).until(() -> cacheClientProxyHasBeenPause()));
+ this.serverVM
+ .invoke(() -> await().atMost(2, MINUTES).until(() -> cacheClientProxyHasBeenPause()));
this.serverVM.invoke(() -> resumePuts()); // resume puts on serverVM, add another 100.
- this.client1VM.invoke(() -> createClientCache(this.hostName, port, 1, true)); // start durable client1VM
+ this.client1VM.invoke(() -> createClientCache(this.hostName, port, 1, true)); // start durable
+ // client1VM
- this.client1VM.invoke(() -> await().atMost(1, MINUTES).until(() -> lastKeyReceived)); // wait for full queue dispatch
+ this.client1VM.invoke(() -> await().atMost(1, MINUTES).until(() -> lastKeyReceived)); // wait
+ // for
+ // full
+ // queue
+ // dispatch
this.serverVM.invoke(() -> verifyStats(port)); // verify the stats
}
@@ -196,11 +206,12 @@ public class ClientHealthStatsDUnitTest implements Serializable {
*/
private boolean cacheClientProxyHasBeenPause() {
CacheClientNotifier clientNotifier = CacheClientNotifier.getInstance(); // TODO
- //CacheClientNotifier clientNotifier = ((CacheServerImpl)this.managementTestRule.getCache().getCacheServers().get(0)).getAcceptor().getCacheClientNotifier();
+ // CacheClientNotifier clientNotifier =
+ // ((CacheServerImpl)this.managementTestRule.getCache().getCacheServers().get(0)).getAcceptor().getCacheClientNotifier();
Collection<CacheClientProxy> clientProxies = clientNotifier.getClientProxies();
- for (CacheClientProxy clientProxy: clientProxies) {
+ for (CacheClientProxy clientProxy : clientProxies) {
if (clientProxy.isPaused()) {
return true;
}
@@ -214,7 +225,8 @@ public class ClientHealthStatsDUnitTest implements Serializable {
private int createServerCache() throws Exception {
Cache cache = this.managementTestRule.getCache();
- RegionFactory<String, String> regionFactory = cache.createRegionFactory(RegionShortcut.REPLICATE);
+ RegionFactory<String, String> regionFactory =
+ cache.createRegionFactory(RegionShortcut.REPLICATE);
regionFactory.setConcurrencyChecksEnabled(false);
regionFactory.create(REGION_NAME);
@@ -227,10 +239,8 @@ public class ClientHealthStatsDUnitTest implements Serializable {
/**
* Invoked in client1VM and client2VM
*/
- private void createClientCache(final String hostName,
- final Integer port,
- final int clientNum,
- final boolean subscriptionEnabled) throws Exception {
+ private void createClientCache(final String hostName, final Integer port, final int clientNum,
+ final boolean subscriptionEnabled) throws Exception {
Properties props = new Properties();
props.setProperty(STATISTIC_SAMPLING_ENABLED, "true");
@@ -247,7 +257,8 @@ public class ClientHealthStatsDUnitTest implements Serializable {
cacheFactory.addPoolServer(hostName, port);
clientCache = cacheFactory.create();
- ClientRegionFactory<String, String> regionFactory = clientCache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY);
+ ClientRegionFactory<String, String> regionFactory =
+ clientCache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY);
regionFactory.setConcurrencyChecksEnabled(false);
regionFactory.addCacheListener(new CacheListenerAdapter<String, String>() {
@@ -325,7 +336,8 @@ public class ClientHealthStatsDUnitTest implements Serializable {
/**
* Invoked in managerVM
*/
- private void verifyClientStats(final DistributedMember serverMember, final int serverPort, final int numSubscriptions) throws Exception {
+ private void verifyClientStats(final DistributedMember serverMember, final int serverPort,
+ final int numSubscriptions) throws Exception {
ManagementService service = this.managementTestRule.getManagementService();
CacheServerMXBean cacheServerMXBean = awaitCacheServerMXBean(serverMember, serverPort);
@@ -350,7 +362,7 @@ public class ClientHealthStatsDUnitTest implements Serializable {
* Invoked in client1VM and client2VM
*/
private void put() throws Exception {
- Cache cache = (Cache)clientCache;
+ Cache cache = (Cache) clientCache;
Region<String, String> region = cache.getRegion(Region.SEPARATOR + REGION_NAME);
region.put(KEY1, VALUE1);
@@ -382,14 +394,16 @@ public class ClientHealthStatsDUnitTest implements Serializable {
assertThat(clientProxy.getQueueSizeStat()).isEqualTo(clientProxy.getQueueSize());
ClientQueueDetail queueDetails = serverBean.showClientQueueDetails()[0];
- assertThat(clientProxy.getQueueSizeStat()).isEqualTo((int)queueDetails.getQueueSize());
+ assertThat(clientProxy.getQueueSizeStat()).isEqualTo((int) queueDetails.getQueueSize());
}
- private CacheServerMXBean awaitCacheServerMXBean(final DistributedMember serverMember, final int port) {
+ private CacheServerMXBean awaitCacheServerMXBean(final DistributedMember serverMember,
+ final int port) {
SystemManagementService service = this.managementTestRule.getSystemManagementService();
ObjectName objectName = service.getCacheServerMBeanName(port, serverMember);
- await().until(() -> assertThat(service.getMBeanProxy(objectName, CacheServerMXBean.class)).isNotNull());
+ await().until(
+ () -> assertThat(service.getMBeanProxy(objectName, CacheServerMXBean.class)).isNotNull());
return service.getMBeanProxy(objectName, CacheServerMXBean.class);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d261061e/geode-core/src/test/java/org/apache/geode/management/CompositeTypeTestDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/CompositeTypeTestDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/CompositeTypeTestDUnitTest.java
index 3176bda..cdb55a9 100644
--- a/geode-core/src/test/java/org/apache/geode/management/CompositeTypeTestDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/CompositeTypeTestDUnitTest.java
@@ -33,7 +33,7 @@ import org.apache.geode.test.dunit.VM;
import org.apache.geode.test.junit.categories.DistributedTest;
@Category(DistributedTest.class)
-@SuppressWarnings({ "serial", "unused" })
+@SuppressWarnings({"serial", "unused"})
public class CompositeTypeTestDUnitTest implements Serializable {
@Manager
@@ -46,7 +46,7 @@ public class CompositeTypeTestDUnitTest implements Serializable {
public ManagementTestRule managementTestRule = ManagementTestRule.builder().start(true).build();
@Test
- public void testCompositeTypeGetters() throws Exception{
+ public void testCompositeTypeGetters() throws Exception {
registerMBeanWithCompositeTypeGetters(this.memberVM);
String memberName = MBeanJMXAdapter.makeCompliantName(getMemberId(this.memberVM));
@@ -65,14 +65,17 @@ public class CompositeTypeTestDUnitTest implements Serializable {
});
}
- private void verifyMBeanWithCompositeTypeGetters(final VM managerVM, final String memberId) throws Exception {
+ private void verifyMBeanWithCompositeTypeGetters(final VM managerVM, final String memberId)
+ throws Exception {
managerVM.invoke("verifyMBeanWithCompositeTypeGetters", () -> {
SystemManagementService service = this.managementTestRule.getSystemManagementService();
- ObjectName objectName = new ObjectName("GemFire:service=custom,type=composite,member=" + memberId);
+ ObjectName objectName =
+ new ObjectName("GemFire:service=custom,type=composite,member=" + memberId);
await().until(() -> service.getMBeanInstance(objectName, CompositeTestMXBean.class) != null);
- CompositeTestMXBean compositeTestMXBean = service.getMBeanInstance(objectName, CompositeTestMXBean.class);
+ CompositeTestMXBean compositeTestMXBean =
+ service.getMBeanInstance(objectName, CompositeTestMXBean.class);
assertThat(compositeTestMXBean).isNotNull();
CompositeStats listCompositeStatsData = compositeTestMXBean.listCompositeStats();
@@ -90,7 +93,8 @@ public class CompositeTypeTestDUnitTest implements Serializable {
}
private String getMemberId(final VM memberVM) {
- return memberVM.invoke("getMemberId", () -> this.managementTestRule.getDistributedMember().getId());
+ return memberVM.invoke("getMemberId",
+ () -> this.managementTestRule.getDistributedMember().getId());
}
private ConditionFactory await() {
http://git-wip-us.apache.org/repos/asf/geode/blob/d261061e/geode-core/src/test/java/org/apache/geode/management/DLockManagementDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/DLockManagementDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/DLockManagementDUnitTest.java
index 9c8e5c9..cc8e611 100644
--- a/geode-core/src/test/java/org/apache/geode/management/DLockManagementDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/DLockManagementDUnitTest.java
@@ -40,12 +40,13 @@ import org.apache.geode.test.dunit.VM;
import org.apache.geode.test.junit.categories.DistributedTest;
@Category(DistributedTest.class)
-@SuppressWarnings({ "serial", "unused" })
+@SuppressWarnings({"serial", "unused"})
public class DLockManagementDUnitTest implements Serializable {
private static final int MAX_WAIT_MILLIS = 120 * 1000; // 2 MINUTES
- private static final String LOCK_SERVICE_NAME = DLockManagementDUnitTest.class.getSimpleName() + "_testLockService";
+ private static final String LOCK_SERVICE_NAME =
+ DLockManagementDUnitTest.class.getSimpleName() + "_testLockService";
@Manager
private VM managerVM;
@@ -54,7 +55,8 @@ public class DLockManagementDUnitTest implements Serializable {
private VM[] memberVMs;
@Rule
- public ManagementTestRule managementTestRule = ManagementTestRule.builder().managersFirst(false).start(true).build();
+ public ManagementTestRule managementTestRule =
+ ManagementTestRule.builder().managersFirst(false).start(true).build();
@Test
public void testLockServiceMXBean() throws Throwable {
@@ -103,7 +105,8 @@ public class DLockManagementDUnitTest implements Serializable {
for (final DistributedMember member : otherMembers) {
ObjectName objectName = service.getRegionMBeanName(member, LOCK_SERVICE_NAME);
- await().until(() -> assertThat(service.getMBeanProxy(objectName, LockServiceMXBean.class)).isNull());
+ await().until(
+ () -> assertThat(service.getMBeanProxy(objectName, LockServiceMXBean.class)).isNull());
}
});
}
@@ -112,7 +115,8 @@ public class DLockManagementDUnitTest implements Serializable {
memberVM.invoke("createLockServiceGrantor", () -> {
assertThat(DistributedLockService.getServiceNamed(LOCK_SERVICE_NAME)).isNull();
- DLockService lockService = (DLockService) DistributedLockService.create(LOCK_SERVICE_NAME, this.managementTestRule.getCache().getDistributedSystem());
+ DLockService lockService = (DLockService) DistributedLockService.create(LOCK_SERVICE_NAME,
+ this.managementTestRule.getCache().getDistributedSystem());
DistributedMember grantor = lockService.getLockGrantorId().getLockGrantorMember();
assertThat(grantor).isNotNull();
@@ -122,7 +126,8 @@ public class DLockManagementDUnitTest implements Serializable {
assertThat(lockServiceMXBean.isDistributed()).isTrue();
assertThat(lockServiceMXBean.getName()).isEqualTo(LOCK_SERVICE_NAME);
assertThat(lockServiceMXBean.isLockGrantor()).isTrue();
- assertThat(lockServiceMXBean.fetchGrantorMember()).isEqualTo(this.managementTestRule.getDistributedMember().getId());
+ assertThat(lockServiceMXBean.fetchGrantorMember())
+ .isEqualTo(this.managementTestRule.getDistributedMember().getId());
});
}
@@ -130,7 +135,8 @@ public class DLockManagementDUnitTest implements Serializable {
anyVM.invoke("createLockService", () -> {
assertThat(DistributedLockService.getServiceNamed(LOCK_SERVICE_NAME)).isNull();
- DistributedLockService.create(LOCK_SERVICE_NAME, this.managementTestRule.getCache().getDistributedSystem());
+ DistributedLockService.create(LOCK_SERVICE_NAME,
+ this.managementTestRule.getCache().getDistributedSystem());
LockServiceMXBean lockServiceMXBean = awaitLockServiceMXBean(LOCK_SERVICE_NAME);
@@ -155,7 +161,8 @@ public class DLockManagementDUnitTest implements Serializable {
private void verifyLockServiceMXBeanInMember(final VM memberVM) {
memberVM.invoke("verifyLockServiceMXBeanInManager", () -> {
- DistributedLockService lockService = DistributedLockService.getServiceNamed(LOCK_SERVICE_NAME);
+ DistributedLockService lockService =
+ DistributedLockService.getServiceNamed(LOCK_SERVICE_NAME);
lockService.lock("lockObject_" + identifyPid(), MAX_WAIT_MILLIS, -1);
ManagementService service = this.managementTestRule.getManagementService();
@@ -178,7 +185,8 @@ public class DLockManagementDUnitTest implements Serializable {
Set<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
for (DistributedMember member : otherMembers) {
- LockServiceMXBean lockServiceMXBean = awaitLockServiceMXBeanProxy(member, LOCK_SERVICE_NAME);
+ LockServiceMXBean lockServiceMXBean =
+ awaitLockServiceMXBeanProxy(member, LOCK_SERVICE_NAME);
assertThat(lockServiceMXBean).isNotNull();
String[] listHeldLock = lockServiceMXBean.listHeldLocks();
@@ -195,11 +203,16 @@ public class DLockManagementDUnitTest implements Serializable {
ManagementService service = this.managementTestRule.getManagementService();
DistributedSystemMXBean distributedSystemMXBean = awaitDistributedSystemMXBean();
- ObjectName distributedLockServiceMXBeanName = MBeanJMXAdapter.getDistributedLockServiceName(LOCK_SERVICE_NAME);
- assertThat(distributedSystemMXBean.fetchDistributedLockServiceObjectName(LOCK_SERVICE_NAME)).isEqualTo(distributedLockServiceMXBeanName);
-
- ObjectName lockServiceMXBeanName = MBeanJMXAdapter.getLockServiceMBeanName(member.getId(), LOCK_SERVICE_NAME);
- assertThat(distributedSystemMXBean.fetchLockServiceObjectName(member.getId(), LOCK_SERVICE_NAME)).isEqualTo(lockServiceMXBeanName);
+ ObjectName distributedLockServiceMXBeanName =
+ MBeanJMXAdapter.getDistributedLockServiceName(LOCK_SERVICE_NAME);
+ assertThat(distributedSystemMXBean.fetchDistributedLockServiceObjectName(LOCK_SERVICE_NAME))
+ .isEqualTo(distributedLockServiceMXBeanName);
+
+ ObjectName lockServiceMXBeanName =
+ MBeanJMXAdapter.getLockServiceMBeanName(member.getId(), LOCK_SERVICE_NAME);
+ assertThat(
+ distributedSystemMXBean.fetchLockServiceObjectName(member.getId(), LOCK_SERVICE_NAME))
+ .isEqualTo(lockServiceMXBeanName);
});
}
@@ -211,11 +224,13 @@ public class DLockManagementDUnitTest implements Serializable {
ManagementService service = this.managementTestRule.getManagementService();
if (memberCount == 0) {
- await().until(() -> assertThat(service.getDistributedLockServiceMXBean(LOCK_SERVICE_NAME)).isNull());
+ await().until(
+ () -> assertThat(service.getDistributedLockServiceMXBean(LOCK_SERVICE_NAME)).isNull());
return;
}
- DistributedLockServiceMXBean distributedLockServiceMXBean = awaitDistributedLockServiceMXBean(LOCK_SERVICE_NAME, memberCount);
+ DistributedLockServiceMXBean distributedLockServiceMXBean =
+ awaitDistributedLockServiceMXBean(LOCK_SERVICE_NAME, memberCount);
assertThat(distributedLockServiceMXBean).isNotNull();
assertThat(distributedLockServiceMXBean.getName()).isEqualTo(LOCK_SERVICE_NAME);
});
@@ -230,29 +245,32 @@ public class DLockManagementDUnitTest implements Serializable {
}
/**
- * Await and return a DistributedRegionMXBean proxy with specified member
- * count.
+ * Await and return a DistributedRegionMXBean proxy with specified member count.
*/
- private DistributedLockServiceMXBean awaitDistributedLockServiceMXBean(final String lockServiceName, final int memberCount) {
+ private DistributedLockServiceMXBean awaitDistributedLockServiceMXBean(
+ final String lockServiceName, final int memberCount) {
ManagementService service = this.managementTestRule.getManagementService();
await().until(() -> {
assertThat(service.getDistributedLockServiceMXBean(lockServiceName)).isNotNull();
- assertThat(service.getDistributedLockServiceMXBean(lockServiceName).getMemberCount()).isEqualTo(memberCount);
+ assertThat(service.getDistributedLockServiceMXBean(lockServiceName).getMemberCount())
+ .isEqualTo(memberCount);
});
return service.getDistributedLockServiceMXBean(lockServiceName);
}
/**
- * Await and return a LockServiceMXBean proxy for a specific member and
- * lockServiceName.
+ * Await and return a LockServiceMXBean proxy for a specific member and lockServiceName.
*/
- private LockServiceMXBean awaitLockServiceMXBeanProxy(final DistributedMember member, final String lockServiceName) {
+ private LockServiceMXBean awaitLockServiceMXBeanProxy(final DistributedMember member,
+ final String lockServiceName) {
SystemManagementService service = this.managementTestRule.getSystemManagementService();
ObjectName lockServiceMXBeanName = service.getLockServiceMBeanName(member, lockServiceName);
- await().until(() -> assertThat(service.getMBeanProxy(lockServiceMXBeanName, LockServiceMXBean.class)).isNotNull());
+ await().until(
+ () -> assertThat(service.getMBeanProxy(lockServiceMXBeanName, LockServiceMXBean.class))
+ .isNotNull());
return service.getMBeanProxy(lockServiceMXBeanName, LockServiceMXBean.class);
}
@@ -269,8 +287,7 @@ public class DLockManagementDUnitTest implements Serializable {
}
/**
- * Await destruction of local LockServiceMXBean for specified
- * lockServiceName.
+ * Await destruction of local LockServiceMXBean for specified lockServiceName.
*/
private void awaitLockServiceMXBeanIsNull(final String lockServiceName) {
SystemManagementService service = this.managementTestRule.getSystemManagementService();
http://git-wip-us.apache.org/repos/asf/geode/blob/d261061e/geode-core/src/test/java/org/apache/geode/management/DiskManagementDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/DiskManagementDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/DiskManagementDUnitTest.java
index bfeebea..50533d3 100644
--- a/geode-core/src/test/java/org/apache/geode/management/DiskManagementDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/DiskManagementDUnitTest.java
@@ -54,14 +54,14 @@ import org.apache.geode.test.junit.categories.DistributedTest;
import org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder;
/**
- * Test cases to cover all test cases which pertains to disk from Management
- * layer
+ * Test cases to cover all test cases which pertains to disk from Management layer
*/
@Category(DistributedTest.class)
-@SuppressWarnings({ "serial", "unused" })
+@SuppressWarnings({"serial", "unused"})
public class DiskManagementDUnitTest implements Serializable {
- private static final String REGION_NAME = DiskManagementDUnitTest.class.getSimpleName() + "_region";
+ private static final String REGION_NAME =
+ DiskManagementDUnitTest.class.getSimpleName() + "_region";
private File diskDir;
@@ -83,8 +83,8 @@ public class DiskManagementDUnitTest implements Serializable {
}
/**
- * Tests Disk Compaction from a MemberMXBean which is at cache level. All the
- * disks which belong to the cache should be compacted.
+ * Tests Disk Compaction from a MemberMXBean which is at cache level. All the disks which belong
+ * to the cache should be compacted.
*/
@Test
public void testDiskCompact() throws Exception {
@@ -99,8 +99,8 @@ public class DiskManagementDUnitTest implements Serializable {
}
/**
- * Tests Disk Compaction from a MemberMXBean which is at cache level. All the
- * disks which belong to the cache should be compacted.
+ * Tests Disk Compaction from a MemberMXBean which is at cache level. All the disks which belong
+ * to the cache should be compacted.
*/
@Test
public void testDiskCompactRemote() throws Exception {
@@ -137,8 +137,7 @@ public class DiskManagementDUnitTest implements Serializable {
}
/**
- * Checks the test case of missing disks and revoking them through MemberMXBean
- * interfaces
+ * Checks the test case of missing disks and revoking them through MemberMXBean interfaces
*/
@Test
public void testMissingMembers() throws Exception {
@@ -166,14 +165,12 @@ public class DiskManagementDUnitTest implements Serializable {
AsyncInvocation creatingPersistentRegionAsync = createPersistentRegionAsync(memberVM1);
- memberVM1.invoke(() ->
- await().until(() -> {
- GemFireCacheImpl cache = (GemFireCacheImpl) this.managementTestRule.getCache();
- PersistentMemberManager persistentMemberManager = cache.getPersistentMemberManager();
- Map<String, Set<PersistentMemberID>> regions = persistentMemberManager.getWaitingRegions();
- return !regions.isEmpty();
- })
- );
+ memberVM1.invoke(() -> await().until(() -> {
+ GemFireCacheImpl cache = (GemFireCacheImpl) this.managementTestRule.getCache();
+ PersistentMemberManager persistentMemberManager = cache.getPersistentMemberManager();
+ Map<String, Set<PersistentMemberID>> regions = persistentMemberManager.getWaitingRegions();
+ return !regions.isEmpty();
+ }));
assertThat(creatingPersistentRegionAsync.isAlive()).isTrue();
@@ -346,7 +343,8 @@ public class DiskManagementDUnitTest implements Serializable {
});
}
- private void createPersistentRegion(final VM memberVM) throws InterruptedException, ExecutionException, TimeoutException {
+ private void createPersistentRegion(final VM memberVM)
+ throws InterruptedException, ExecutionException, TimeoutException {
await(createPersistentRegionAsync(memberVM));
}
@@ -357,7 +355,7 @@ public class DiskManagementDUnitTest implements Serializable {
Cache cache = this.managementTestRule.getCache();
DiskStoreFactory diskStoreFactory = cache.createDiskStoreFactory();
- diskStoreFactory.setDiskDirs(new File[] { dir });
+ diskStoreFactory.setDiskDirs(new File[] {dir});
diskStoreFactory.setMaxOplogSize(1);
diskStoreFactory.setAllowForceCompaction(true);
diskStoreFactory.setAutoCompact(false);
@@ -392,11 +390,13 @@ public class DiskManagementDUnitTest implements Serializable {
private MemberMXBean awaitMemberMXBeanProxy(final DistributedMember member) {
SystemManagementService service = this.managementTestRule.getSystemManagementService();
ObjectName objectName = service.getMemberMBeanName(member);
- await().until(() -> assertThat(service.getMBeanProxy(objectName, MemberMXBean.class)).isNotNull());
+ await()
+ .until(() -> assertThat(service.getMBeanProxy(objectName, MemberMXBean.class)).isNotNull());
return service.getMBeanProxy(objectName, MemberMXBean.class);
}
- private void await(final AsyncInvocation createPersistentRegionAsync) throws InterruptedException, ExecutionException, TimeoutException {
+ private void await(final AsyncInvocation createPersistentRegionAsync)
+ throws InterruptedException, ExecutionException, TimeoutException {
createPersistentRegionAsync.await(2, MINUTES);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d261061e/geode-core/src/test/java/org/apache/geode/management/DistributedSystemDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/DistributedSystemDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/DistributedSystemDUnitTest.java
index cd05cde..79a4ce4 100644
--- a/geode-core/src/test/java/org/apache/geode/management/DistributedSystemDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/DistributedSystemDUnitTest.java
@@ -64,15 +64,11 @@ import org.apache.geode.test.junit.categories.DistributedTest;
/**
* Distributed System management tests
* <p>
- * a) For all the notifications
- * i) gemfire.distributedsystem.member.joined
- * ii) gemfire.distributedsystem.member.left
- * iii) gemfire.distributedsystem.member.suspect
- * iv ) All notifications emitted by member mbeans
- * vi) Alerts
+ * a) For all the notifications i) gemfire.distributedsystem.member.joined ii)
+ * gemfire.distributedsystem.member.left iii) gemfire.distributedsystem.member.suspect iv ) All
+ * notifications emitted by member mbeans vi) Alerts
* <p>
- * b) Concurrently modify proxy list by removing member and accessing the
- * distributed system MBean
+ * b) Concurrently modify proxy list by removing member and accessing the distributed system MBean
* <p>
* c) Aggregate Operations like shutDownAll
* <p>
@@ -81,7 +77,7 @@ import org.apache.geode.test.junit.categories.DistributedTest;
* e ) Statistics
*/
@Category(DistributedTest.class)
-@SuppressWarnings({ "serial", "unused" })
+@SuppressWarnings({"serial", "unused"})
public class DistributedSystemDUnitTest implements Serializable {
private static final Logger logger = LogService.getLogger();
@@ -145,9 +141,11 @@ public class DistributedSystemDUnitTest implements Serializable {
addAlertListener(this.managerVM);
verifyAlertCount(this.managerVM, 0, 0);
- DistributedMember managerDistributedMember = this.managementTestRule.getDistributedMember(this.managerVM);
+ DistributedMember managerDistributedMember =
+ this.managementTestRule.getDistributedMember(this.managerVM);
- // Before we start we need to ensure that the initial (implicit) SEVERE alert has propagated everywhere.
+ // Before we start we need to ensure that the initial (implicit) SEVERE alert has propagated
+ // everywhere.
for (VM memberVM : this.memberVMs) {
verifyAlertAppender(memberVM, managerDistributedMember, Alert.SEVERE);
}
@@ -228,7 +226,8 @@ public class DistributedSystemDUnitTest implements Serializable {
for (ObjectName objectName : distributedSystemMXBean.listMemberObjectNames()) {
NotificationHubTestListener listener = new NotificationHubTestListener();
- ManagementFactory.getPlatformMBeanServer().addNotificationListener(objectName, listener, null, null);
+ ManagementFactory.getPlatformMBeanServer().addNotificationListener(objectName, listener,
+ null, null);
notificationListenerMap.put(objectName, listener);
}
});
@@ -239,26 +238,30 @@ public class DistributedSystemDUnitTest implements Serializable {
memberVM.invoke("checkNotificationHubListenerCount", () -> {
SystemManagementService service = this.managementTestRule.getSystemManagementService();
NotificationHub notificationHub = service.getNotificationHub();
- Map<ObjectName, NotificationHubListener> listenerMap = notificationHub.getListenerObjectMap();
+ Map<ObjectName, NotificationHubListener> listenerMap =
+ notificationHub.getListenerObjectMap();
assertThat(listenerMap.keySet()).hasSize(1);
- ObjectName memberMBeanName = MBeanJMXAdapter.getMemberMBeanName(this.managementTestRule.getDistributedMember());
+ ObjectName memberMBeanName =
+ MBeanJMXAdapter.getMemberMBeanName(this.managementTestRule.getDistributedMember());
NotificationHubListener listener = listenerMap.get(memberMBeanName);
/*
- * Counter of listener should be 2 . One for default Listener which is
- * added for each member mbean by distributed system mbean One for the
- * added listener in test
+ * Counter of listener should be 2 . One for default Listener which is added for each member
+ * mbean by distributed system mbean One for the added listener in test
*/
assertThat(listener.getNumCounter()).isEqualTo(2);
// Raise some notifications
NotificationBroadcasterSupport notifier = (MemberMBean) service.getMemberMXBean();
- String memberSource = MBeanJMXAdapter.getMemberNameOrId(this.managementTestRule.getDistributedMember());
+ String memberSource =
+ MBeanJMXAdapter.getMemberNameOrId(this.managementTestRule.getDistributedMember());
// Only a dummy notification , no actual region is created
- Notification notification = new Notification(JMXNotificationType.REGION_CREATED, memberSource, SequenceNumber.next(), System.currentTimeMillis(), ManagementConstants.REGION_CREATED_PREFIX + "/test");
+ Notification notification = new Notification(JMXNotificationType.REGION_CREATED,
+ memberSource, SequenceNumber.next(), System.currentTimeMillis(),
+ ManagementConstants.REGION_CREATED_PREFIX + "/test");
notifier.sendNotification(notification);
});
}
@@ -283,12 +286,13 @@ public class DistributedSystemDUnitTest implements Serializable {
Map<ObjectName, NotificationHubListener> listenerObjectMap = hub.getListenerObjectMap();
assertThat(listenerObjectMap.keySet().size()).isEqualTo(1);
- ObjectName memberMBeanName = MBeanJMXAdapter.getMemberMBeanName(this.managementTestRule.getDistributedMember());
+ ObjectName memberMBeanName =
+ MBeanJMXAdapter.getMemberMBeanName(this.managementTestRule.getDistributedMember());
NotificationHubListener listener = listenerObjectMap.get(memberMBeanName);
/*
- * Counter of listener should be 1 for the default Listener which is
- * added for each member mbean by distributed system mbean.
+ * Counter of listener should be 1 for the default Listener which is added for each member
+ * mbean by distributed system mbean.
*/
assertThat(listener.getNumCounter()).isEqualTo(1);
});
@@ -303,9 +307,11 @@ public class DistributedSystemDUnitTest implements Serializable {
for (ObjectName objectName : distributedSystemMXBean.listMemberObjectNames()) {
NotificationHubTestListener listener = new NotificationHubTestListener();
try {
- ManagementFactory.getPlatformMBeanServer().removeNotificationListener(objectName, listener); // because new instance!!
+ ManagementFactory.getPlatformMBeanServer().removeNotificationListener(objectName,
+ listener); // because new instance!!
} catch (ListenerNotFoundException e) {
- // TODO: [old] apparently there is never a notification listener on any these mbeans at this point [fix this]
+ // TODO: [old] apparently there is never a notification listener on any these mbeans at
+ // this point [fix this]
// fix this test so it doesn't hit these unexpected exceptions -- getLogWriter().error(e);
}
}
@@ -320,7 +326,9 @@ public class DistributedSystemDUnitTest implements Serializable {
for (ObjectName objectName : notificationListenerMap.keySet()) {
NotificationListener listener = notificationListenerMap.get(objectName);
- assertThatThrownBy(() -> ManagementFactory.getPlatformMBeanServer().removeNotificationListener(objectName, listener)).isExactlyInstanceOf(ListenerNotFoundException.class);
+ assertThatThrownBy(() -> ManagementFactory.getPlatformMBeanServer()
+ .removeNotificationListener(objectName, listener))
+ .isExactlyInstanceOf(ListenerNotFoundException.class);
}
});
}
@@ -335,7 +343,8 @@ public class DistributedSystemDUnitTest implements Serializable {
addAlertListener(this.managerVM);
resetAlertCounts(this.managerVM);
- DistributedMember managerDistributedMember = this.managementTestRule.getDistributedMember(this.managerVM);
+ DistributedMember managerDistributedMember =
+ this.managementTestRule.getDistributedMember(this.managerVM);
generateWarningAlert(this.managerVM);
generateSevereAlert(this.managerVM);
@@ -376,16 +385,23 @@ public class DistributedSystemDUnitTest implements Serializable {
verifyAlertCount(this.managerVM, 0, 0);
}
- private void verifyAlertAppender(final VM memberVM, final DistributedMember member, final int alertLevel) {
- memberVM.invoke("verifyAlertAppender", () -> await().until(() -> assertThat(AlertAppender.getInstance().hasAlertListener(member, alertLevel)).isTrue()));
+ private void verifyAlertAppender(final VM memberVM, final DistributedMember member,
+ final int alertLevel) {
+ memberVM.invoke("verifyAlertAppender",
+ () -> await().until(
+ () -> assertThat(AlertAppender.getInstance().hasAlertListener(member, alertLevel))
+ .isTrue()));
}
- private void verifyAlertCount(final VM managerVM, final int expectedSevereAlertCount, final int expectedWarningAlertCount) {
+ private void verifyAlertCount(final VM managerVM, final int expectedSevereAlertCount,
+ final int expectedWarningAlertCount) {
managerVM.invoke("verifyAlertCount", () -> {
AlertNotificationListener listener = AlertNotificationListener.getInstance();
- await().until(() -> assertThat(listener.getSevereAlertCount()).isEqualTo(expectedSevereAlertCount));
- await().until(() -> assertThat(listener.getWarningAlertCount()).isEqualTo(expectedWarningAlertCount));
+ await().until(
+ () -> assertThat(listener.getSevereAlertCount()).isEqualTo(expectedSevereAlertCount));
+ await().until(
+ () -> assertThat(listener.getWarningAlertCount()).isEqualTo(expectedWarningAlertCount));
});
}
@@ -399,7 +415,8 @@ public class DistributedSystemDUnitTest implements Serializable {
private void generateWarningAlert(final VM anyVM) {
anyVM.invoke("generateWarningAlert", () -> {
- IgnoredException ignoredException = IgnoredException.addIgnoredException(WARNING_LEVEL_MESSAGE);
+ IgnoredException ignoredException =
+ IgnoredException.addIgnoredException(WARNING_LEVEL_MESSAGE);
logger.warn(WARNING_LEVEL_MESSAGE);
ignoredException.remove();
});
@@ -414,7 +431,8 @@ public class DistributedSystemDUnitTest implements Serializable {
private void generateSevereAlert(final VM anyVM) {
anyVM.invoke("generateSevereAlert", () -> {
- IgnoredException ignoredException = IgnoredException.addIgnoredException(SEVERE_LEVEL_MESSAGE);
+ IgnoredException ignoredException =
+ IgnoredException.addIgnoredException(SEVERE_LEVEL_MESSAGE);
logger.fatal(SEVERE_LEVEL_MESSAGE);
ignoredException.remove();
});
@@ -425,9 +443,11 @@ public class DistributedSystemDUnitTest implements Serializable {
AlertNotificationListener listener = AlertNotificationListener.getInstance();
listener.resetCount();
- NotificationFilter notificationFilter = (Notification notification) -> notification.getType().equals(JMXNotificationType.SYSTEM_ALERT);
+ NotificationFilter notificationFilter = (Notification notification) -> notification.getType()
+ .equals(JMXNotificationType.SYSTEM_ALERT);
- ManagementFactory.getPlatformMBeanServer().addNotificationListener(MBeanJMXAdapter.getDistributedSystemName(), listener, notificationFilter, null);
+ ManagementFactory.getPlatformMBeanServer().addNotificationListener(
+ MBeanJMXAdapter.getDistributedSystemName(), listener, notificationFilter, null);
});
}
@@ -455,7 +475,8 @@ public class DistributedSystemDUnitTest implements Serializable {
assertThat(distributedSystemMXBean).isNotNull();
DistributedSystemNotificationListener listener = new DistributedSystemNotificationListener();
- ManagementFactory.getPlatformMBeanServer().addNotificationListener(MBeanJMXAdapter.getDistributedSystemName(), listener, null, null);
+ ManagementFactory.getPlatformMBeanServer().addNotificationListener(
+ MBeanJMXAdapter.getDistributedSystemName(), listener, null, null);
});
}
@@ -474,7 +495,8 @@ public class DistributedSystemDUnitTest implements Serializable {
ManagementService service = this.managementTestRule.getManagementService();
DistributedSystemMXBean distributedSystemMXBean = service.getDistributedSystemMXBean();
- await().until(() -> assertThat(distributedSystemMXBean.listMemberObjectNames()).hasSize(memberCount));
+ await().until(
+ () -> assertThat(distributedSystemMXBean.listMemberObjectNames()).hasSize(memberCount));
String memberId = this.managementTestRule.getDistributedMember().getId();
ObjectName thisMemberName = MBeanJMXAdapter.getMemberMBeanName(memberId);
@@ -508,16 +530,19 @@ public class DistributedSystemDUnitTest implements Serializable {
}
@Override
- public synchronized void handleNotification(final Notification notification, final Object handback) {
+ public synchronized void handleNotification(final Notification notification,
+ final Object handback) {
assertThat(notification).isNotNull();
Map<String, String> notificationUserData = (Map<String, String>) notification.getUserData();
- if (notificationUserData.get(JMXNotificationUserData.ALERT_LEVEL).equalsIgnoreCase("warning")) {
+ if (notificationUserData.get(JMXNotificationUserData.ALERT_LEVEL)
+ .equalsIgnoreCase("warning")) {
assertThat(notification.getMessage()).isEqualTo(WARNING_LEVEL_MESSAGE);
warningAlertCount++;
}
- if (notificationUserData.get(JMXNotificationUserData.ALERT_LEVEL).equalsIgnoreCase("severe")) {
+ if (notificationUserData.get(JMXNotificationUserData.ALERT_LEVEL)
+ .equalsIgnoreCase("severe")) {
assertThat(notification.getMessage()).isEqualTo(SEVERE_LEVEL_MESSAGE);
severeAlertCount++;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d261061e/geode-core/src/test/java/org/apache/geode/management/LocatorManagementDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/LocatorManagementDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/LocatorManagementDUnitTest.java
index 1a2e3d7..a574815 100644
--- a/geode-core/src/test/java/org/apache/geode/management/LocatorManagementDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/LocatorManagementDUnitTest.java
@@ -53,7 +53,7 @@ import org.apache.geode.test.junit.rules.serializable.SerializableTestName;
* Distributed tests for managing {@code Locator} with {@link LocatorMXBean}.
*/
@Category(DistributedTest.class)
-@SuppressWarnings({ "serial", "unused" })
+@SuppressWarnings({"serial", "unused"})
public class LocatorManagementDUnitTest implements Serializable {
private static final int MAX_WAIT_MILLIS = 120 * 1000;
@@ -80,8 +80,8 @@ public class LocatorManagementDUnitTest implements Serializable {
@Before
public void before() throws Exception {
-// this.managerVM = managingNode;
-// this.membersVM = getManagedNodeList().toArray(new VM[getManagedNodeList().size()]);
+ // this.managerVM = managingNode;
+ // this.membersVM = getManagedNodeList().toArray(new VM[getManagedNodeList().size()]);
this.locatorVM = this.membersVM[0];
this.hostName = getServerHostName(getHost(0));
this.port = getRandomAvailableTCPPort();
@@ -112,13 +112,14 @@ public class LocatorManagementDUnitTest implements Serializable {
this.managementTestRule.createManager(this.managerVM, props, false);
this.managementTestRule.startManager(this.managerVM);
- verifyRemoteLocatorMXBeanProxy(this.managerVM, this.managementTestRule.getDistributedMember(this.locatorVM));
+ verifyRemoteLocatorMXBeanProxy(this.managerVM,
+ this.managementTestRule.getDistributedMember(this.locatorVM));
}
@Test
public void testPeerLocationWithPortZero() throws Exception {
this.port = startLocator(this.locatorVM, true, ZERO);
- //this.locatorVM.invoke(() -> this.managementTestRule.getCache());
+ // this.locatorVM.invoke(() -> this.managementTestRule.getCache());
this.locatorVM.invoke(() -> assertHasCache());
@@ -135,7 +136,8 @@ public class LocatorManagementDUnitTest implements Serializable {
this.managementTestRule.createManager(this.managerVM, props, false);
this.managementTestRule.startManager(this.managerVM);
- verifyRemoteLocatorMXBeanProxy(this.managerVM, this.managementTestRule.getDistributedMember(this.locatorVM));
+ verifyRemoteLocatorMXBeanProxy(this.managerVM,
+ this.managementTestRule.getDistributedMember(this.locatorVM));
}
private void assertHasCache() {
@@ -219,8 +221,7 @@ public class LocatorManagementDUnitTest implements Serializable {
}
/**
- * Starts a locator with given configuration.
- * If DS is already started it will use the same DS
+ * Starts a locator with given configuration. If DS is already started it will use the same DS
*/
private int startLocator(final VM locatorVM, final boolean isPeer, final int port) {
return locatorVM.invoke("startLocator", () -> {
@@ -231,8 +232,10 @@ public class LocatorManagementDUnitTest implements Serializable {
properties.setProperty(LOCATORS, "");
InetAddress bindAddress = InetAddress.getByName(this.hostName);
- File logFile = this.temporaryFolder.newFile(testName.getMethodName() + "-locator-" + port + ".log");
- Locator locator = Locator.startLocatorAndDS(port, logFile, bindAddress, properties, isPeer, true, null);
+ File logFile =
+ this.temporaryFolder.newFile(testName.getMethodName() + "-locator-" + port + ".log");
+ Locator locator =
+ Locator.startLocatorAndDS(port, logFile, bindAddress, properties, isPeer, true, null);
assertThat(InternalLocator.hasLocator()).isTrue();
@@ -249,7 +252,7 @@ public class LocatorManagementDUnitTest implements Serializable {
private void verifyLocalLocatorMXBean(final VM locatorVM, final int port, final boolean isPeer) {
locatorVM.invoke("verifyLocalLocatorMXBean", () -> {
- //ManagementService service = this.managementTestRule.getExistingManagementService();
+ // ManagementService service = this.managementTestRule.getExistingManagementService();
GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
ManagementService service = ManagementService.getExistingManagementService(cache);
assertThat(service).isNotNull();
@@ -258,16 +261,17 @@ public class LocatorManagementDUnitTest implements Serializable {
assertThat(locatorMXBean).isNotNull();
assertThat(locatorMXBean.getPort()).isEqualTo(port);
- // LogWriterUtils.getLogWriter().info("Log of Locator" + bean.viewLog());
- // LogWriterUtils.getLogWriter().info("BindAddress" + bean.getBindAddress());
+ // LogWriterUtils.getLogWriter().info("Log of Locator" + bean.viewLog());
+ // LogWriterUtils.getLogWriter().info("BindAddress" + bean.getBindAddress());
assertThat(locatorMXBean.isPeerLocator()).isEqualTo(isPeer);
});
}
- private void verifyRemoteLocatorMXBeanProxy(final VM managerVM, final DistributedMember locatorMember) {
+ private void verifyRemoteLocatorMXBeanProxy(final VM managerVM,
+ final DistributedMember locatorMember) {
managerVM.invoke("verifyRemoteLocatorMXBeanProxy", () -> {
- //ManagementService service = this.managementTestRule.getExistingManagementService();
+ // ManagementService service = this.managementTestRule.getExistingManagementService();
GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
ManagementService service = ManagementService.getExistingManagementService(cache);
assertThat(service).isNotNull();
@@ -276,14 +280,14 @@ public class LocatorManagementDUnitTest implements Serializable {
LocatorMXBean locatorMXBean = awaitLockServiceMXBeanProxy(locatorMember);
assertThat(locatorMXBean).isNotNull();
- // LogWriterUtils.getLogWriter().info("Log of Locator" + bean.viewLog());
- // LogWriterUtils.getLogWriter().info("BindAddress" + bean.getBindAddress());
+ // LogWriterUtils.getLogWriter().info("Log of Locator" + bean.viewLog());
+ // LogWriterUtils.getLogWriter().info("BindAddress" + bean.getBindAddress());
});
}
private void verifyListManagers(final VM locatorVM) {
locatorVM.invoke("verifyListManagers", () -> {
- //ManagementService service = this.managementTestRule.getExistingManagementService();
+ // ManagementService service = this.managementTestRule.getExistingManagementService();
GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
ManagementService service = ManagementService.getExistingManagementService(cache);
assertThat(service).isNotNull();
@@ -297,16 +301,17 @@ public class LocatorManagementDUnitTest implements Serializable {
private void verifyListPotentialManagers(final VM locatorVM) {
locatorVM.invoke("verifyListPotentialManagers", () -> {
- //ManagementService service = this.managementTestRule.getExistingManagementService();
+ // ManagementService service = this.managementTestRule.getExistingManagementService();
GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
ManagementService service = ManagementService.getExistingManagementService(cache);
assertThat(service).isNotNull();
- //LocatorMXBean locatorMXBean = service.getLocalLocatorMXBean();
+ // LocatorMXBean locatorMXBean = service.getLocalLocatorMXBean();
LocatorMXBean locatorMXBean = awaitLockServiceMXBean();
assertThat(locatorMXBean).isNotNull();
- await("listPotentialManagers has size 3").until(() -> assertThat(locatorMXBean.listPotentialManagers()).hasSize(3));
+ await("listPotentialManagers has size 3")
+ .until(() -> assertThat(locatorMXBean.listPotentialManagers()).hasSize(3));
});
}
@@ -325,7 +330,8 @@ public class LocatorManagementDUnitTest implements Serializable {
SystemManagementService service = this.managementTestRule.getSystemManagementService();
ObjectName locatorMBeanName = service.getLocatorMBeanName(member);
- await().until(() -> assertThat(service.getMBeanProxy(locatorMBeanName, LocatorMXBean.class)).isNotNull());
+ await().until(
+ () -> assertThat(service.getMBeanProxy(locatorMBeanName, LocatorMXBean.class)).isNotNull());
return service.getMBeanProxy(locatorMBeanName, LocatorMXBean.class);
}
@@ -342,7 +348,8 @@ public class LocatorManagementDUnitTest implements Serializable {
}
public static String getServerHostName(Host host) {
- return System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "server-bind-address") != null ?
- System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "server-bind-address") : host.getHostName();
+ return System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "server-bind-address") != null
+ ? System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "server-bind-address")
+ : host.getHostName();
}
}