SLIDER-509 basic registry list operations
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/fe76b640 Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/fe76b640 Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/fe76b640 Branch: refs/heads/develop Commit: fe76b6402b3230792dfc0daf90445a0adf03c163 Parents: 432ef04 Author: Steve Loughran <ste...@apache.org> Authored: Mon Oct 20 15:46:27 2014 +0100 Committer: Steve Loughran <ste...@apache.org> Committed: Tue Oct 21 10:37:45 2014 +0100 ---------------------------------------------------------------------- .../funtest/framework/CommandTestBase.groovy | 8 ++- .../funtest/commands/RegistryCommandIT.groovy | 36 -------------- .../funtest/commands/ResolveCommandIT.groovy | 52 ++++++++++++++++++++ .../funtest/commands/SimpleCommandsIT.groovy | 6 +-- 4 files changed, 61 insertions(+), 41 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/fe76b640/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy index efe3f60..95cf766 100644 --- a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy +++ b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy @@ -377,6 +377,12 @@ abstract class CommandTestBase extends SliderTestUtils { slider(0, [ACTION_THAW, name] + args) } + static SliderShell resolve(int result, Collection<String> commands) { + slider(result, + [ACTION_RESOLVE] + commands + ) + } + static SliderShell registry(int result, Collection<String> commands) { slider(result, [ACTION_REGISTRY] + commands @@ -422,7 +428,7 @@ abstract class CommandTestBase extends SliderTestUtils { } /** - * Assert the exit code is that the cluster is unknown + * Assert the exit code is that the cluster is 0 * @param shell shell */ public static void assertSuccess(SliderShell shell) { http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/fe76b640/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/RegistryCommandIT.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/RegistryCommandIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/RegistryCommandIT.groovy deleted file mode 100644 index 9e9bd7e..0000000 --- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/RegistryCommandIT.groovy +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.slider.funtest.commands - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.slider.funtest.framework.CommandTestBase -import org.junit.BeforeClass -import org.junit.Test - -@CompileStatic -@Slf4j -public class RegistryCommandIT extends CommandTestBase { - - @Test - public void testListAll() throws Throwable { - assertSuccess(list(null)) - } - -} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/fe76b640/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/ResolveCommandIT.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/ResolveCommandIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/ResolveCommandIT.groovy new file mode 100644 index 0000000..f8a9eb1 --- /dev/null +++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/ResolveCommandIT.groovy @@ -0,0 +1,52 @@ +/* + * 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.slider.funtest.commands + +import groovy.transform.CompileStatic +import groovy.util.logging.Slf4j +import org.apache.hadoop.registry.client.api.RegistryConstants + +import static org.apache.slider.common.params.Arguments.* +import org.apache.slider.core.main.LauncherExitCodes +import org.apache.slider.funtest.framework.CommandTestBase +import org.junit.Test + +@CompileStatic +@Slf4j +public class ResolveCommandIT extends CommandTestBase { + + @Test + public void testRegistryIsNotLocalhost() throws Throwable { + def quorum = SLIDER_CONFIG.get(RegistryConstants.KEY_REGISTRY_ZK_QUORUM) + assert quorum != RegistryConstants.DEFAULT_REGISTRY_ZK_QUORUM; + } + + @Test + public void testResolveRoot() throws Throwable { + resolve(0, + [ARG_LIST, ARG_PATH, "/"]) + } + + @Test + public void testResolveRootServiceRecord() throws Throwable { + resolve(LauncherExitCodes.EXIT_NOT_FOUND, + [ARG_PATH, "/"]) + } + +} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/fe76b640/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/SimpleCommandsIT.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/SimpleCommandsIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/SimpleCommandsIT.groovy index a06a406..75d0634 100644 --- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/SimpleCommandsIT.groovy +++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/SimpleCommandsIT.groovy @@ -32,14 +32,12 @@ public class SimpleCommandsIT extends CommandTestBase { @Test public void testVersion() throws Throwable { - Shell shell = slider([SliderActions.ACTION_VERSION]) - assertSuccess(shell) + slider(0, [SliderActions.ACTION_VERSION]) } @Test public void testUsage() throws Throwable { - SliderShell shell = slider(0, [SliderActions.ACTION_HELP]) - assertSuccess(shell) + slider(0, [SliderActions.ACTION_HELP]) } }