[ https://issues.apache.org/jira/browse/GEODE-2764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15969175#comment-15969175 ]
ASF GitHub Bot commented on GEODE-2764: --------------------------------------- Github user jhuynh1 commented on a diff in the pull request: https://github.com/apache/geode/pull/449#discussion_r111591894 --- Diff: geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationIndexWithFromClauseDUnitTest.java --- @@ -0,0 +1,120 @@ +/* + * 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.configuration; + + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.management.cli.Result; +import org.apache.geode.management.internal.cli.i18n.CliStrings; +import org.apache.geode.management.internal.cli.result.CommandResult; +import org.apache.geode.management.internal.cli.util.CommandStringBuilder; +import org.apache.geode.test.dunit.rules.GfshShellConnectionRule; +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.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; + +import java.util.Properties; +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; + +@Category(DistributedTest.class) +@RunWith(JUnitParamsRunner.class) +public class ClusterConfigurationIndexWithFromClauseDUnitTest { + + final String REGION_NAME = "region"; + final String INDEX_NAME = "index"; + + protected RegionShortcut[] getPartitionRegionTypes() { + return new RegionShortcut[] {RegionShortcut.PARTITION, RegionShortcut.PARTITION_PERSISTENT, + RegionShortcut.PARTITION_REDUNDANT, RegionShortcut.PARTITION_REDUNDANT_PERSISTENT, + RegionShortcut.REPLICATE, RegionShortcut.REPLICATE_PERSISTENT}; + + } + + @Rule + public LocatorServerStartupRule lsRule = new LocatorServerStartupRule(); + + @Rule + public GfshShellConnectionRule gfshShellConnectionRule = new GfshShellConnectionRule(); + + private MemberVM locator = null; + + @Before + public void before() throws Exception { + locator = lsRule.startLocatorVM(0); + } + + @Test + @Parameters(method = "getPartitionRegionTypes") + public void indexCreatedWithFromClauseMustPersist(RegionShortcut regionShortcut) --- End diff -- maybe change this name to describing the .entrySet() that this was trying to solve? indexCreatedWithEntrySetInFromClauseMustPersist? > Index entry not entered into cluster config xml if region name contains a > function call like entrySet() > ------------------------------------------------------------------------------------------------------- > > Key: GEODE-2764 > URL: https://issues.apache.org/jira/browse/GEODE-2764 > Project: Geode > Issue Type: Bug > Reporter: nabarun > > Steps to recreate the issue type the following in a gfsh instance: > 1. start locator --name=locator > 2. start server --name=server > 3. create region --name=regionName --type=REPLICATE_PERSISTENT > 4. create index --name=regionIndex --region="regionName.entrySet() r" > --expression=r.key > -- this will result in an error message > {noformat} > Failed to create index "regionIndex" due to following reasons > null > {noformat} > Cause: > The index is created but while putting the entry into the clusterconfig it > tries to put the region name as regionName.entrySet() which does not exist. > cache.getRegion(regionName.entrySet()) will result in null and no xml entry > is added to the clusterconfig. So when the server is restarted, there is no > index entry in the cluster config xml hence the index is not re-created. > Solution: > If the region name contains the character '(' and ')' spilt the region name > at the index of '.' and check if the region exists. > If the check returns successful only then enter the entry into the cluster > config. -- This message was sent by Atlassian JIRA (v6.3.15#6346)