[ 
https://issues.apache.org/jira/browse/GEODE-3436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16144204#comment-16144204
 ] 

ASF GitHub Bot commented on GEODE-3436:
---------------------------------------

Github user kirklund commented on a diff in the pull request:

    https://github.com/apache/geode/pull/745#discussion_r135605262
  
    --- Diff: 
geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateDefinedIndexesCommand.java
 ---
    @@ -0,0 +1,155 @@
    +/*
    + * 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 java.util.HashMap;
    +import java.util.List;
    +import java.util.Map;
    +import java.util.Set;
    +import java.util.TreeSet;
    +import java.util.concurrent.atomic.AtomicReference;
    +
    +import org.springframework.shell.core.annotation.CliCommand;
    +import org.springframework.shell.core.annotation.CliOption;
    +
    +import org.apache.geode.cache.CacheFactory;
    +import org.apache.geode.cache.execute.ResultCollector;
    +import org.apache.geode.distributed.DistributedMember;
    +import org.apache.geode.management.cli.CliMetaData;
    +import org.apache.geode.management.cli.ConverterHint;
    +import org.apache.geode.management.cli.Result;
    +import org.apache.geode.management.internal.cli.CliUtil;
    +import 
org.apache.geode.management.internal.cli.functions.CliFunctionResult;
    +import 
org.apache.geode.management.internal.cli.functions.CreateDefinedIndexesFunction;
    +import org.apache.geode.management.internal.cli.i18n.CliStrings;
    +import org.apache.geode.management.internal.cli.result.ErrorResultData;
    +import org.apache.geode.management.internal.cli.result.InfoResultData;
    +import org.apache.geode.management.internal.cli.result.ResultBuilder;
    +import org.apache.geode.management.internal.configuration.domain.XmlEntity;
    +import org.apache.geode.management.internal.security.ResourceOperation;
    +import org.apache.geode.security.ResourcePermission;
    +
    +public class CreateDefinedIndexesCommand implements GfshCommand {
    +  private static final CreateDefinedIndexesFunction 
createDefinedIndexesFunction =
    +      new CreateDefinedIndexesFunction();
    +
    +  @CliCommand(value = CliStrings.CREATE_DEFINED_INDEXES, help = 
CliStrings.CREATE_DEFINED__HELP)
    +  @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_REGION, 
CliStrings.TOPIC_GEODE_DATA})
    +  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
    +      operation = ResourcePermission.Operation.MANAGE, target = 
ResourcePermission.Target.QUERY)
    +  // TODO : Add optionContext for indexName
    +  public Result createDefinedIndexes(
    +
    +      @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
    +          optionContext = ConverterHint.MEMBERIDNAME,
    +          help = CliStrings.CREATE_DEFINED_INDEXES__MEMBER__HELP) final 
String[] memberNameOrID,
    +
    +      @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
    +          optionContext = ConverterHint.MEMBERGROUP,
    +          help = CliStrings.CREATE_DEFINED_INDEXES__GROUP__HELP) final 
String[] group) {
    +
    +    Result result;
    +    AtomicReference<XmlEntity> xmlEntity = new AtomicReference<>();
    +
    +    if (IndexDefinition.indexDefinitions.isEmpty()) {
    +      final InfoResultData infoResult = 
ResultBuilder.createInfoResultData();
    +      infoResult.addLine(CliStrings.DEFINE_INDEX__FAILURE__MSG);
    +      return ResultBuilder.buildResult(infoResult);
    +    }
    +
    +    try {
    +      final Set<DistributedMember> targetMembers = 
CliUtil.findMembers(group, memberNameOrID);
    +
    +      if (targetMembers.isEmpty()) {
    +        return 
ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
    +      }
    +
    +      // TODO PSR: is this safe to remove?
    +      CacheFactory.getAnyInstance();
    --- End diff --
    
    I favor removal of all CacheFactory.getAnyInstance() calls anywhere in 
which the return is not used.


> GFSH commands tests are failing after committing refactorings of command 
> classes
> --------------------------------------------------------------------------------
>
>                 Key: GEODE-3436
>                 URL: https://issues.apache.org/jira/browse/GEODE-3436
>             Project: Geode
>          Issue Type: Bug
>          Components: gfsh, tests
>            Reporter: Kirk Lund
>
> Tests failing in geode-core:
> * HelperIntegrationTest.testHelpWithNoInput
> * HelperIntegrationTest.testHintWithNoInput
> * GfshParserConverterTest.testHintConverter
> * CliCommandsSecurityTest.testNoAccess
> * GfshCommandsSecurityTest.testRegionAReader
> * GfshCommandsSecurityTest.testRegionAWriter
> * GfshCommandsSecurityTest.testClusterReader
> * GfshCommandsSecurityTest.testClusterWriter
> * GfshCommandsSecurityTest.testClusterManager
> * GfshCommandsSecurityTest.testDataReader
> * GfshCommandsSecurityTest.testRegionAManager
> * GfshCommandsSecurityTest.testDataWriter
> * AnalyzeSerializablesJUnitTest.testSerializables (ParallelSnapshotFileMapper)
> Stack traces for the geode-core failures:
> {noformat}
> :geode-core:integrationTest
> org.apache.geode.management.internal.cli.help.HelperIntegrationTest > 
> testHelpWithNoInput FAILED
>     java.lang.AssertionError: 
>     Expected size:<2> but was:<4> in:
>     <["help (Available)",
>         "Display syntax and usage information for all commands or list all 
> available commands if <command> isn't specified.",
>         "hint (Available)",
>         "Provide hints for a topic or list all available topics if "topic" 
> isn't specified."]>
>         at 
> org.apache.geode.management.internal.cli.help.HelperIntegrationTest.testHelpWithNoInput(HelperIntegrationTest.java:69)
> org.apache.geode.management.internal.cli.help.HelperIntegrationTest > 
> testHintWithNoInput FAILED
>     java.lang.AssertionError: 
>     Expected size:<21> but was:<22> in:
>     <["Hints are available for the following topics. Use "hint <topic-name>" 
> for a specific hint.",
>         "",
>         "Client",
>         "Cluster Configuration",
>         "Configuration",
>         "Data",
>         "Debug-Utility",
>         "Disk Store",
>         "Function Execution",
>         "GFSH",
>         "Geode",
>         "Help",
>         "JMX",
>         "Lifecycle",
>         "Locator",
>         "Logs",
>         "Management-Monitoring",
>         "Manager",
>         "Region",
>         "Server",
>         "Statistics",
>         "WAN"]>
>         at 
> org.apache.geode.management.internal.cli.help.HelperIntegrationTest.testHintWithNoInput(HelperIntegrationTest.java:96)
> org.apache.geode.management.internal.cli.GfshParserConverterTest > 
> testHintConverter FAILED
>     java.lang.StringIndexOutOfBoundsException: String index out of range: -1
>         at java.lang.String.substring(String.java:1931)
>         at 
> org.apache.geode.management.internal.cli.GfshParser.lambda$completeAdvanced$0(GfshParser.java:265)
>         at java.util.ArrayList.replaceAll(ArrayList.java:1442)
>         at 
> org.apache.geode.management.internal.cli.GfshParser.completeAdvanced(GfshParser.java:264)
>         at 
> org.apache.geode.test.dunit.rules.GfshParserRule.complete(GfshParserRule.java:58)
>         at 
> org.apache.geode.management.internal.cli.GfshParserConverterTest.testHintConverter(GfshParserConverterTest.java:126)
> org.apache.geode.management.internal.security.CliCommandsSecurityTest > 
> testNoAccess FAILED
>     org.assertj.core.api.SoftAssertionError: 
>     The following assertion failed:
>     1) [destroy function --id=InterestCalculations] 
>     Expecting:
>      <"stranger not authorized for CLUSTER:MANAGE:JAR">
>     to contain:
>      <"DATA:MANAGE"> 
>     at CliCommandsSecurityTest.testNoAccess(CliCommandsSecurityTest.java:74)
>         at 
> org.assertj.core.api.SoftAssertions.assertAll(SoftAssertions.java:134)
>         at 
> org.apache.geode.management.internal.security.CliCommandsSecurityTest.testNoAccess(CliCommandsSecurityTest.java:78)
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest > 
> testRegionAReader FAILED
>     org.junit.ComparisonFailure: [destroy function --id=InterestCalculations] 
> expected:<[110]> but was:<[415]>
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)
>         at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>         at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>         at 
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest.runCommandsPermittedAndForbiddenBy(GfshCommandsSecurityTest.java:164)
>         at 
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest.testRegionAReader(GfshCommandsSecurityTest.java:108)
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest > 
> testRegionAWriter FAILED
>     org.junit.ComparisonFailure: [destroy function --id=InterestCalculations] 
> expected:<[110]> but was:<[415]>
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)
>         at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>         at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>         at 
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest.runCommandsPermittedAndForbiddenBy(GfshCommandsSecurityTest.java:164)
>         at 
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest.testRegionAWriter(GfshCommandsSecurityTest.java:114)
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest > 
> testClusterReader FAILED
>     org.junit.ComparisonFailure: [destroy function --id=InterestCalculations] 
> expected:<[110]> but was:<[415]>
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)
>         at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>         at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>         at 
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest.runCommandsPermittedAndForbiddenBy(GfshCommandsSecurityTest.java:164)
>         at 
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest.testClusterReader(GfshCommandsSecurityTest.java:72)
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest > 
> testClusterWriter FAILED
>     org.junit.ComparisonFailure: [destroy function --id=InterestCalculations] 
> expected:<[110]> but was:<[415]>
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)
>         at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>         at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>         at 
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest.runCommandsPermittedAndForbiddenBy(GfshCommandsSecurityTest.java:164)
>         at 
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest.testClusterWriter(GfshCommandsSecurityTest.java:78)
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest > 
> testClusterManager FAILED
>     org.junit.ComparisonFailure: [destroy function --id=InterestCalculations] 
> expected:<[110]> but was:<[415]>
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)
>         at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>         at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>         at 
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest.runCommandsPermittedAndForbiddenBy(GfshCommandsSecurityTest.java:164)
>         at 
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest.testClusterManager(GfshCommandsSecurityTest.java:84)
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest > 
> testDataReader FAILED
>     org.junit.ComparisonFailure: [destroy function --id=InterestCalculations] 
> expected:<[110]> but was:<[415]>
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)
>         at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>         at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>         at 
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest.runCommandsPermittedAndForbiddenBy(GfshCommandsSecurityTest.java:164)
>         at 
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest.testDataReader(GfshCommandsSecurityTest.java:90)
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest > 
> testRegionAManager FAILED
>     org.junit.ComparisonFailure: [destroy function --id=InterestCalculations] 
> expected:<[110]> but was:<[415]>
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)
>         at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>         at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>         at 
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest.runCommandsPermittedAndForbiddenBy(GfshCommandsSecurityTest.java:164)
>         at 
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest.testRegionAManager(GfshCommandsSecurityTest.java:120)
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest > 
> testDataWriter FAILED
>     org.junit.ComparisonFailure: [destroy function --id=InterestCalculations] 
> expected:<[110]> but was:<[415]>
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)
>         at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>         at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>         at 
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest.runCommandsPermittedAndForbiddenBy(GfshCommandsSecurityTest.java:164)
>         at 
> org.apache.geode.management.internal.security.GfshCommandsSecurityTest.testDataWriter(GfshCommandsSecurityTest.java:96)
> org.apache.geode.codeAnalysis.AnalyzeSerializablesJUnitTest > 
> testSerializables FAILED
>     java.lang.AssertionError: New or moved 
> classes----------------------------------------
>     org/apache/geode/internal/cache/snapshot/ParallelSnapshotFileMapper,true,1
>     If the class is not persisted or sent over the wire add it to the file 
>     
> /tmp/build/ae3c03f4/gemfire/open/geode-core/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
>     Otherwise if this doesn't break backward compatibility, copy the file 
>     
> /tmp/build/ae3c03f4/geode/geode-core/build/integrationTest/actualSerializables.dat
>  to 
>     
> /tmp/build/ae3c03f4/gemfire/open/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt.
>         at 
> org.apache.geode.codeAnalysis.AnalyzeSerializablesJUnitTest.testSerializables(AnalyzeSerializablesJUnitTest.java:150)
> 3715 tests completed, 13 failed, 140 skipped
> :geode-core:integrationTest FAILED
> {noformat}
> Tests failing in geode-web:
> * GfshCommandsOverHttpSecurityTest.testRegionAReader
> * GfshCommandsOverHttpSecurityTest.testRegionAWriter
> * GfshCommandsOverHttpSecurityTest.testClusterReader
> * GfshCommandsOverHttpSecurityTest.testClusterWriter
> * GfshCommandsOverHttpSecurityTest.testClusterManager
> * GfshCommandsOverHttpSecurityTest.testDataReader
> * GfshCommandsOverHttpSecurityTest.testRegionAManager
> * GfshCommandsOverHttpSecurityTest.testDataWriter
> Stack traces for the geode-web failures:
> {noformat}
> :geode-web:integrationTest
> org.apache.geode.management.internal.security.GfshCommandsOverHttpSecurityTest
>  > testRegionAReader FAILED
>     org.junit.ComparisonFailure: [destroy function --id=InterestCalculations] 
> expected:<[110]> but was:<[415]>
> org.apache.geode.management.internal.security.GfshCommandsOverHttpSecurityTest
>  > testRegionAWriter FAILED
>     org.junit.ComparisonFailure: [destroy function --id=InterestCalculations] 
> expected:<[110]> but was:<[415]>
> org.apache.geode.management.internal.security.GfshCommandsOverHttpSecurityTest
>  > testClusterReader FAILED
>     org.junit.ComparisonFailure: [destroy function --id=InterestCalculations] 
> expected:<[110]> but was:<[415]>
> org.apache.geode.management.internal.security.GfshCommandsOverHttpSecurityTest
>  > testClusterWriter FAILED
>     org.junit.ComparisonFailure: [destroy function --id=InterestCalculations] 
> expected:<[110]> but was:<[415]>
> org.apache.geode.management.internal.security.GfshCommandsOverHttpSecurityTest
>  > testClusterManager FAILED
>     org.junit.ComparisonFailure: [destroy function --id=InterestCalculations] 
> expected:<[110]> but was:<[415]>
> org.apache.geode.management.internal.security.GfshCommandsOverHttpSecurityTest
>  > testDataReader FAILED
>     org.junit.ComparisonFailure: [destroy function --id=InterestCalculations] 
> expected:<[110]> but was:<[415]>
> org.apache.geode.management.internal.security.GfshCommandsOverHttpSecurityTest
>  > testRegionAManager FAILED
>     org.junit.ComparisonFailure: [destroy function --id=InterestCalculations] 
> expected:<[110]> but was:<[415]>
> org.apache.geode.management.internal.security.GfshCommandsOverHttpSecurityTest
>  > testDataWriter FAILED
>     org.junit.ComparisonFailure: [destroy function --id=InterestCalculations] 
> expected:<[110]> but was:<[415]>
> 30 tests completed, 8 failed
> :geode-web:integrationTest FAILED
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to