[
https://issues.apache.org/jira/browse/GEODE-3955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16271204#comment-16271204
]
ASF GitHub Bot commented on GEODE-3955:
---------------------------------------
jinmeiliao commented on a change in pull request #1099: GEODE-3955: Add AEQ and
Gateway Sender information to 'describe region' output.
URL: https://github.com/apache/geode/pull/1099#discussion_r153860003
##########
File path:
geode-wan/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeRegionDUnitTest.java
##########
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express
+ * or implied. See the License for the specific language governing permissions
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands;
+
+import static
org.apache.geode.distributed.ConfigurationProperties.DISTRIBUTED_SYSTEM_ID;
+import static
org.apache.geode.distributed.ConfigurationProperties.REMOTE_LOCATORS;
+
+import java.util.Properties;
+
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.EvictionAction;
+import org.apache.geode.cache.EvictionAttributes;
+import org.apache.geode.cache.FixedPartitionAttributes;
+import org.apache.geode.cache.PartitionAttributes;
+import org.apache.geode.cache.PartitionAttributesFactory;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionFactory;
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
+
+@Category(DistributedTest.class)
+public class DescribeRegionDUnitTest {
+ private static final String REGION1 = "region1";
+ private static final String REGION2 = "region2";
+ private static final String REGION3 = "region3";
+ private static final String SUBREGION1A = "subregion1A";
+ private static final String SUBREGION1B = "subregion1B";
+ private static final String SUBREGION1C = "subregion1C";
+ private static final String PR1 = "PR1";
+ private static final String LOCAL_REGION = "LocalRegion";
+
+ private static final String PART1_NAME = "Par1";
+ private static final String PART2_NAME = "Par2";
+
+ @ClassRule
+ public static LocatorServerStartupRule lsRule = new
LocatorServerStartupRule();
+
+ @ClassRule
+ public static GfshCommandRule gfsh = new GfshCommandRule();
+
+ @BeforeClass
+ public static void setupSystem() throws Exception {
+ Properties props = new Properties();
+ props.setProperty(DISTRIBUTED_SYSTEM_ID, "" + 1);
+ MemberVM sending_locator = lsRule.startLocatorVM(1, props);
+
+ props.setProperty(DISTRIBUTED_SYSTEM_ID, "" + 2);
+ props.setProperty(REMOTE_LOCATORS, "localhost[" +
sending_locator.getPort() + "]");
+ lsRule.startLocatorVM(2, props);
+
+ MemberVM server1 = lsRule.startServerVM(3, "group1",
sending_locator.getPort());
+ MemberVM server2 = lsRule.startServerVM(4, "group2",
sending_locator.getPort());
+
+ configureServers(server1, server2);
+
+ gfsh.connectAndVerify(sending_locator);
+ gfsh.executeAndAssertThat("create async-event-queue --id=queue1
--group=group1 "
+ +
"--listener=org.apache.geode.internal.cache.wan.MyAsyncEventListener").statusIsSuccess();
+ gfsh.executeAndAssertThat("create gateway-sender --id=sender1
--remote-distributed-system-id=2")
+ .statusIsSuccess();
+ sending_locator.waitTillAsyncEventQueuesAreReadyOnServers("queue1", 1);
+ sending_locator.waitTilGatewaySendersAreReady(2);
+
+ gfsh.executeAndAssertThat(
+ "create region --name=region4 --type=REPLICATE
--async-event-queue-id=queue1 --gateway-sender-id=sender1")
+ .statusIsSuccess();
+
+ }
+
+ @SuppressWarnings("deprecation")
+ private static void configureServers(MemberVM server1, MemberVM server2) {
+ server1.invoke(() -> {
+ final Cache cache = LocatorServerStartupRule.getCache();
+ RegionFactory<String, Integer> dataRegionFactory =
+ cache.createRegionFactory(RegionShortcut.PARTITION);
+ dataRegionFactory.setConcurrencyLevel(4);
+ EvictionAttributes ea =
+ EvictionAttributes.createLIFOEntryAttributes(100,
EvictionAction.LOCAL_DESTROY);
+ dataRegionFactory.setEvictionAttributes(ea);
+ dataRegionFactory.setEnableAsyncConflation(true);
+
+ FixedPartitionAttributes fpa =
+ FixedPartitionAttributes.createFixedPartition(PART1_NAME, true);
+ PartitionAttributes pa = new
PartitionAttributesFactory().setLocalMaxMemory(100)
+ .setRecoveryDelay(2).setTotalMaxMemory(200).setRedundantCopies(1)
+ .addFixedPartitionAttributes(fpa).create();
+ dataRegionFactory.setPartitionAttributes(pa);
+
+ dataRegionFactory.create(PR1);
+ createLocalRegion(LOCAL_REGION);
+ });
+
+ server2.invoke(() -> {
+ final Cache cache = LocatorServerStartupRule.getCache();
+ RegionFactory<String, Integer> dataRegionFactory =
+ cache.createRegionFactory(RegionShortcut.PARTITION);
+ dataRegionFactory.setConcurrencyLevel(4);
+ EvictionAttributes ea =
+ EvictionAttributes.createLIFOEntryAttributes(100,
EvictionAction.LOCAL_DESTROY);
+ dataRegionFactory.setEvictionAttributes(ea);
+ dataRegionFactory.setEnableAsyncConflation(true);
+
+ FixedPartitionAttributes fpa =
FixedPartitionAttributes.createFixedPartition(PART2_NAME, 4);
+ PartitionAttributes pa = new
PartitionAttributesFactory().setLocalMaxMemory(150)
+ .setRecoveryDelay(4).setTotalMaxMemory(200).setRedundantCopies(1)
+ .addFixedPartitionAttributes(fpa).create();
+ dataRegionFactory.setPartitionAttributes(pa);
+
+ dataRegionFactory.create(PR1);
+ createRegionsWithSubRegions();
+ });
+ }
+
+ @Test
+ public void describeRegionWithGatewayAndAsyncEventQueue() throws Exception {
Review comment:
since we have only one tests here, let's put the system setup in this test.
If any future tests needs to be added, it's up to them to put any common setup
in a @Before tag. This would make it easy to spot what the test is doing.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> The gfsh 'describe region' command doesn't include asyncEventQueueIds or
> gatewaySenderIds
> -----------------------------------------------------------------------------------------
>
> Key: GEODE-3955
> URL: https://issues.apache.org/jira/browse/GEODE-3955
> Project: Geode
> Issue Type: Improvement
> Components: management
> Reporter: Barry Oglesby
> Priority: Minor
> Fix For: 1.4.0
>
> Attachments: geode-3955.diff
>
>
> The {{constructor}} and {{getNonDefaultAttributes}} methods in
> {{org.apache.geode.management.internal.cli.domain.RegionAttributesInfo}}
> class would have to be modified to include the {{asyncEventQueueIds}} and
> {{gatewaySenderIds}}.
> I did a quick modification of this class (attached).
> With these changes, 'describe region' looks like:
> {noformat}
> gfsh>describe region --name=/data
> ..........................................................
> Name : data
> Data Policy : partition
> Hosting Members : ln-1
> Non-Default Attributes Shared By Hosting Members
> Type | Name | Value
> --------- | --------------------- | ---------
> Region | data-policy | PARTITION
> | async-event-queue-ids | db
> | size | 0
> | gateway-sender-ids | ny
> Partition | redundant-copies | 1
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)