You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by dh...@apache.org on 2019/07/22 22:09:24 UTC
[geode] 11/18: Add second region to region entry meter test
This is an automated email from the ASF dual-hosted git repository.
dhemery pushed a commit to branch GEODE-7001-region-entry-count
in repository https://gitbox.apache.org/repos/asf/geode.git
commit c77586a7286c6ca9b30a1e286b3abe0a7e162bdd
Author: Dale Emery <de...@pivotal.io>
AuthorDate: Thu Jul 18 11:15:01 2019 -0700
Add second region to region entry meter test
- Added a second region, and put entries into it, to ensure that the
meter measures only the region of interest.
Co-Authored-By: Mark Hanson <mh...@pivotal.io>
---
.../geode/metrics/RegionEntriesGaugeTest.java | 39 ++++++++--------------
1 file changed, 14 insertions(+), 25 deletions(-)
diff --git a/geode-assembly/src/acceptanceTest/java/org/apache/geode/metrics/RegionEntriesGaugeTest.java b/geode-assembly/src/acceptanceTest/java/org/apache/geode/metrics/RegionEntriesGaugeTest.java
index 00dac99..c66065f 100644
--- a/geode-assembly/src/acceptanceTest/java/org/apache/geode/metrics/RegionEntriesGaugeTest.java
+++ b/geode-assembly/src/acceptanceTest/java/org/apache/geode/metrics/RegionEntriesGaugeTest.java
@@ -69,25 +69,17 @@ public class RegionEntriesGaugeTest {
private File folderForLocator;
private File folderForServer1;
private File folderForServer2;
-
- private int locatorPort;
- private int locatorJmxPort;
- private int locatorHttpPort;
- private int serverPort1;
- private int serverPort2;
private String locatorString;
-
private ClientCache clientCache;
- private Region<String, String> region;
@Before
public void startMembers() throws Exception {
int[] availablePorts = AvailablePortHelper.getRandomAvailableTCPPorts(5);
- locatorPort = availablePorts[0];
- locatorHttpPort = availablePorts[1];
- locatorJmxPort = availablePorts[2];
- serverPort1 = availablePorts[3];
- serverPort2 = availablePorts[4];
+ int locatorPort = availablePorts[0];
+ int locatorHttpPort = availablePorts[1];
+ int locatorJmxPort = availablePorts[2];
+ int serverPort1 = availablePorts[3];
+ int serverPort2 = availablePorts[4];
locatorString = "localhost[" + locatorPort + "]";
@@ -145,24 +137,21 @@ public class RegionEntriesGaugeTest {
stopLocatorCommand);
}
- // TODO: add 2nd region to verify we are reading entries for just one
@Test
public void regionEntriesGaugeShowsCountOfReplicateRegionValuesInServer() {
- String regionName = "replicateRegion";
+ Region<String, String> otherRegion = createRegion(REPLICATE.name(), "otherRegionName");
+ otherRegion.put("other-region-key", "other-region-value");
- createRegion(REPLICATE.name(), regionName);
+ String regionName = "replicateRegion";
+ Region<String, String> regionOfInterest = createRegion(REPLICATE.name(), regionName);
List<String> keys = asList("a", "b", "c", "d", "e", "f", "g", "h");
for (String key : keys) {
- region.put(key, key);
+ regionOfInterest.put(key, key);
}
-
- region.destroy(keys.get(0));
-
+ regionOfInterest.destroy(keys.get(0));
int expectedNumberOfEntries = keys.size() - 1;
- assertThat(region.sizeOnServer()).isEqualTo(expectedNumberOfEntries);
-
String connectToLocatorCommand = "connect --locator=" + locatorString;
String executeFunctionCommand = String.join(SPACE,
"execute function",
@@ -183,7 +172,7 @@ public class RegionEntriesGaugeTest {
public void regionEntriesGaugeShowsCountOfPartitionedRegionValuesInServer() {
String regionName = "partitionedRegion";
- createRegion(PARTITION.name(), regionName);
+ Region<String, String> region = createRegion(PARTITION.name(), regionName);
List<String> keys = asList("a", "b", "c", "d", "e", "f", "g", "h");
for (String key : keys) {
@@ -212,7 +201,7 @@ public class RegionEntriesGaugeTest {
// });
}
- private void createRegion(String regionType, String regionName) {
+ private Region<String, String> createRegion(String regionType, String regionName) {
String connectToLocatorCommand = "connect --locator=" + locatorString;
String createRegionCommand = String.join(SPACE,
@@ -222,7 +211,7 @@ public class RegionEntriesGaugeTest {
gfshRule.execute(connectToLocatorCommand, createRegionCommand);
- region = clientCache.<String, String>createClientRegionFactory(PROXY).create(regionName);
+ return clientCache.<String, String>createClientRegionFactory(PROXY).create(regionName);
}
public static class GetMemberRegionEntriesGaugeFunction implements Function<String[]> {