http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/rya.console/src/test/java/org/apache/rya/shell/RyaConnectionCommandsIT.java ---------------------------------------------------------------------- diff --git a/extras/rya.console/src/test/java/org/apache/rya/shell/RyaConnectionCommandsIT.java b/extras/rya.console/src/test/java/org/apache/rya/shell/RyaConnectionCommandsIT.java deleted file mode 100644 index f424c49..0000000 --- a/extras/rya.console/src/test/java/org/apache/rya/shell/RyaConnectionCommandsIT.java +++ /dev/null @@ -1,250 +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.rya.shell; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; - -import java.io.IOException; - -import org.apache.accumulo.minicluster.MiniAccumuloCluster; -import org.apache.rya.api.client.Install.InstallConfiguration; -import org.apache.rya.shell.SharedShellState.ConnectionState; -import org.apache.rya.shell.SharedShellState.ShellState; -import org.apache.rya.shell.util.InstallPrompt; -import org.apache.rya.shell.util.PasswordPrompt; -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.shell.Bootstrap; -import org.springframework.shell.core.CommandResult; -import org.springframework.shell.core.JLineShellComponent; - -/** - * Integration tests the methods of {@link RyaConnectionCommands}. - */ -public class RyaConnectionCommandsIT extends RyaShellITBase { - - @Test - public void connectAccumulo() throws IOException { - final MiniAccumuloCluster cluster = getCluster(); - final Bootstrap bootstrap = getTestBootstrap(); - final JLineShellComponent shell = getTestShell(); - - // Mock the user entering the correct password. - final ApplicationContext context = bootstrap.getApplicationContext(); - final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class ); - when(mockPrompt.getPassword()).thenReturn("password".toCharArray()); - - // Execute the connect command. - final String cmd = - RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " + - "--username root " + - "--instanceName " + cluster.getInstanceName() + " "+ - "--zookeepers " + cluster.getZooKeepers(); - - final CommandResult connectResult = shell.executeCommand(cmd); - - // Ensure the connection was successful. - assertTrue( connectResult.isSuccess() ); - } - - @Test - public void connectAccumulo_noAuths() throws IOException { - final MiniAccumuloCluster cluster = getCluster(); - final Bootstrap bootstrap = getTestBootstrap(); - final JLineShellComponent shell = getTestShell(); - - // Mock the user entering the correct password. - final ApplicationContext context = bootstrap.getApplicationContext(); - final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class ); - when(mockPrompt.getPassword()).thenReturn("password".toCharArray()); - - // Execute the command - final String cmd = - RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " + - "--username root " + - "--instanceName " + cluster.getInstanceName() + " "+ - "--zookeepers " + cluster.getZooKeepers(); - - final CommandResult connectResult = shell.executeCommand(cmd); - - // Ensure the connection was successful. - assertTrue( connectResult.isSuccess() ); - } - - @Test - public void connectAccumulo_wrongCredentials() throws IOException { - final MiniAccumuloCluster cluster = getCluster(); - final Bootstrap bootstrap = getTestBootstrap(); - final JLineShellComponent shell = getTestShell(); - - // Mock the user entering the wrong password. - final ApplicationContext context = bootstrap.getApplicationContext(); - final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class ); - when(mockPrompt.getPassword()).thenReturn("asjifo[ijwa".toCharArray()); - - // Execute the command - final String cmd = - RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " + - "--username root " + - "--instanceName " + cluster.getInstanceName() + " "+ - "--zookeepers " + cluster.getZooKeepers(); - - final CommandResult connectResult = shell.executeCommand(cmd); - - // Ensure the command failed. - assertFalse( connectResult.isSuccess() ); - } - - @Test - public void printConnectionDetails_notConnected() { - final JLineShellComponent shell = getTestShell(); - - // Run the print connection details command. - final CommandResult printResult = shell.executeCommand( RyaConnectionCommands.PRINT_CONNECTION_DETAILS_CMD ); - final String msg = (String) printResult.getResult(); - - final String expected = "The shell is not connected to anything."; - assertEquals(expected, msg); - } - - @Test - public void printConnectionDetails_connectedToAccumulo() throws IOException { - final MiniAccumuloCluster cluster = getCluster(); - final Bootstrap bootstrap = getTestBootstrap(); - final JLineShellComponent shell = getTestShell(); - - // Mock the user entering the correct password. - final ApplicationContext context = bootstrap.getApplicationContext(); - final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class ); - when(mockPrompt.getPassword()).thenReturn("password".toCharArray()); - - // Connect to the mini accumulo instance. - final String cmd = - RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " + - "--username root " + - "--instanceName " + cluster.getInstanceName() + " "+ - "--zookeepers " + cluster.getZooKeepers(); - shell.executeCommand(cmd); - - // Run the print connection details command. - final CommandResult printResult = shell.executeCommand( RyaConnectionCommands.PRINT_CONNECTION_DETAILS_CMD ); - final String msg = (String) printResult.getResult(); - - final String expected = - "The shell is connected to an instance of Accumulo using the following parameters:\n" + - " Username: root\n" + - " Instance Name: " + cluster.getInstanceName() + "\n" + - " Zookeepers: " + cluster.getZooKeepers(); - assertEquals(expected, msg); - } - - @Test - public void connectToInstance() throws IOException { - final MiniAccumuloCluster cluster = getCluster(); - final Bootstrap bootstrap = getTestBootstrap(); - final JLineShellComponent shell = getTestShell(); - - // Mock the user entering the correct password. - final ApplicationContext context = bootstrap.getApplicationContext(); - final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class ); - when(mockPrompt.getPassword()).thenReturn("password".toCharArray()); - - // Connect to the mini accumulo instance. - String cmd = - RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " + - "--username root " + - "--instanceName " + cluster.getInstanceName() + " "+ - "--zookeepers " + cluster.getZooKeepers(); - CommandResult result = shell.executeCommand(cmd); - - // Install an instance of rya. - final String instanceName = "testInstance"; - final InstallConfiguration installConf = InstallConfiguration.builder().build(); - - final InstallPrompt installPrompt = context.getBean( InstallPrompt.class ); - when(installPrompt.promptInstanceName()).thenReturn("testInstance"); - when(installPrompt.promptInstallConfiguration("testInstance")).thenReturn( installConf ); - when(installPrompt.promptVerified(instanceName, installConf)).thenReturn(true); - - result = shell.executeCommand( RyaAdminCommands.INSTALL_CMD ); - assertTrue( result.isSuccess() ); - - // Connect to the instance that was just installed. - cmd = RyaConnectionCommands.CONNECT_INSTANCE_CMD + " --instance " + instanceName; - result = shell.executeCommand(cmd); - assertTrue( result.isSuccess() ); - - // Verify the shell state indicates it is connected to an instance. - final SharedShellState sharedState = context.getBean( SharedShellState.class ); - final ShellState state = sharedState.getShellState(); - assertEquals(ConnectionState.CONNECTED_TO_INSTANCE, state.getConnectionState()); - } - - @Test - public void connectToInstance_instanceDoesNotExist() throws IOException { - final MiniAccumuloCluster cluster = getCluster(); - final Bootstrap bootstrap = getTestBootstrap(); - final JLineShellComponent shell = getTestShell(); - - // Mock the user entering the correct password. - final ApplicationContext context = bootstrap.getApplicationContext(); - final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class ); - when(mockPrompt.getPassword()).thenReturn("password".toCharArray()); - - // Connect to the mini accumulo instance. - String cmd = - RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " + - "--username root " + - "--instanceName " + cluster.getInstanceName() + " "+ - "--zookeepers " + cluster.getZooKeepers(); - shell.executeCommand(cmd); - - // Try to connect to a non-existing instance. - cmd = RyaConnectionCommands.CONNECT_INSTANCE_CMD + " --instance doesNotExist"; - final CommandResult result = shell.executeCommand(cmd); - assertFalse( result.isSuccess() ); - } - - @Test - public void disconnect() throws IOException { - final MiniAccumuloCluster cluster = getCluster(); - final Bootstrap bootstrap = getTestBootstrap(); - final JLineShellComponent shell = getTestShell(); - - // Mock the user entering the correct password. - final ApplicationContext context = bootstrap.getApplicationContext(); - final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class ); - when(mockPrompt.getPassword()).thenReturn("password".toCharArray()); - - // Connect to the mini accumulo instance. - final String cmd = - RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " + - "--username root " + - "--instanceName " + cluster.getInstanceName() + " "+ - "--zookeepers " + cluster.getZooKeepers(); - shell.executeCommand(cmd); - - // Disconnect from it. - final CommandResult disconnectResult = shell.executeCommand( RyaConnectionCommands.DISCONNECT_COMMAND_NAME_CMD ); - assertTrue( disconnectResult.isSuccess() ); - } -} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/rya.console/src/test/java/org/apache/rya/shell/RyaPromptProviderTest.java ---------------------------------------------------------------------- diff --git a/extras/rya.console/src/test/java/org/apache/rya/shell/RyaPromptProviderTest.java b/extras/rya.console/src/test/java/org/apache/rya/shell/RyaPromptProviderTest.java deleted file mode 100644 index d3eaa4e..0000000 --- a/extras/rya.console/src/test/java/org/apache/rya/shell/RyaPromptProviderTest.java +++ /dev/null @@ -1,80 +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.rya.shell; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; - -import org.junit.Test; - -import org.apache.rya.api.client.RyaClient; -import org.apache.rya.api.client.accumulo.AccumuloConnectionDetails; - -/** - * Tests the methods of {@link RyaPromptProvider}. - */ -public class RyaPromptProviderTest { - - @Test - public void notConnected() { - // Create a shared state that is disconnected. - final SharedShellState sharedState = new SharedShellState(); - sharedState.disconnected(); - - // Create the prompt. - final String prompt = new RyaPromptProvider(sharedState).getPrompt(); - - // Verify the prompt is formatted correctly. - final String expected = "rya> "; - assertEquals(expected, prompt); - } - - @Test - public void isConnected_noInstanceName() { - // Create a shared state that is connected to a storage, but not a rya instance. - final SharedShellState sharedState = new SharedShellState(); - - final AccumuloConnectionDetails connectionDetails = new AccumuloConnectionDetails("", new char[]{}, "testInstance", ""); - sharedState.connectedToAccumulo(connectionDetails, mock(RyaClient.class)); - - // Create a prompt. - final String prompt = new RyaPromptProvider(sharedState).getPrompt(); - - // Verify the prompt is formatted correctly. - final String expected = "rya/testInstance> "; - assertEquals(expected, prompt); - } - - @Test - public void isConnected_hasInstanceName() { - // Create a shared state that is connected to a specific instance. - final SharedShellState sharedState = new SharedShellState(); - - final AccumuloConnectionDetails connectionDetails = new AccumuloConnectionDetails("", new char[]{}, "testInstance", ""); - sharedState.connectedToAccumulo(connectionDetails, mock(RyaClient.class)); - sharedState.connectedToInstance("testRya"); - - // Create a prompt. - final String prompt = new RyaPromptProvider(sharedState).getPrompt(); - - // Verify the prompt is formatted correctly. - final String expected = "rya/testInstance:testRya> "; - assertEquals(expected, prompt); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/rya.console/src/test/java/org/apache/rya/shell/RyaShellITBase.java ---------------------------------------------------------------------- diff --git a/extras/rya.console/src/test/java/org/apache/rya/shell/RyaShellITBase.java b/extras/rya.console/src/test/java/org/apache/rya/shell/RyaShellITBase.java deleted file mode 100644 index bcbaa5b..0000000 --- a/extras/rya.console/src/test/java/org/apache/rya/shell/RyaShellITBase.java +++ /dev/null @@ -1,102 +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.rya.shell; - -import java.io.IOException; - -import org.apache.accumulo.core.client.AccumuloException; -import org.apache.accumulo.core.client.AccumuloSecurityException; -import org.apache.accumulo.minicluster.MiniAccumuloCluster; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.apache.rya.accumulo.MiniAccumuloSingleton; -import org.apache.rya.accumulo.RyaTestInstanceRule; -import org.apache.zookeeper.ClientCnxn; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.springframework.shell.Bootstrap; -import org.springframework.shell.core.JLineShellComponent; - -import org.apache.rya.accumulo.MiniAccumuloClusterInstance; - -/** - * All Rya Shell integration tests should extend this one. It provides startup - * and shutdown hooks for a Mini Accumulo Cluster when you start and stop testing. - * It also creates a new shell to test with between each test. - */ -public class RyaShellITBase { - - /** - * The bootstrap that was used to initialize the Shell that will be tested. - */ - private Bootstrap bootstrap; - - /** - * The shell that will be tested. - */ - private JLineShellComponent shell; - - @Rule - public RyaTestInstanceRule testInstance = new RyaTestInstanceRule(false); - - @BeforeClass - public static void killLoudLogs() { - Logger.getLogger(ClientCnxn.class).setLevel(Level.ERROR); - } - - @Before - public void startShell() throws IOException, InterruptedException, AccumuloException, AccumuloSecurityException { - // Bootstrap the shell with the test bean configuration. - bootstrap = new Bootstrap(new String[]{}, new String[]{"file:src/test/resources/RyaShellTest-context.xml"}); - shell = bootstrap.getJLineShellComponent(); - } - - @After - public void stopShell() throws IOException, InterruptedException { - shell.stop(); - } - - /** - * @return The bootstrap that was used to initialize the Shell that will be tested. - */ - public Bootstrap getTestBootstrap() { - return bootstrap; - } - - /** - * @return The shell that will be tested. - */ - public JLineShellComponent getTestShell() { - return shell; - } - - /** - * @return The cluster that is hosting the test. - */ - public MiniAccumuloCluster getCluster() { - return MiniAccumuloSingleton.getInstance().getCluster(); - } - - public String getInstanceName() { - return testInstance.getRyaInstanceName(); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/rya.console/src/test/java/org/apache/rya/shell/SharedShellStateTest.java ---------------------------------------------------------------------- diff --git a/extras/rya.console/src/test/java/org/apache/rya/shell/SharedShellStateTest.java b/extras/rya.console/src/test/java/org/apache/rya/shell/SharedShellStateTest.java deleted file mode 100644 index e79d186..0000000 --- a/extras/rya.console/src/test/java/org/apache/rya/shell/SharedShellStateTest.java +++ /dev/null @@ -1,167 +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.rya.shell; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; - -import org.junit.Test; - -import org.apache.rya.api.client.RyaClient; -import org.apache.rya.api.client.accumulo.AccumuloConnectionDetails; -import org.apache.rya.shell.SharedShellState.ConnectionState; -import org.apache.rya.shell.SharedShellState.ShellState; - -/** - * Tests the methods of {@link SharedShellState}. - */ -public class SharedShellStateTest { - - @Test - public void initialStateIsDisconnected() { - final SharedShellState state = new SharedShellState(); - - // Verify disconnected and no values are set. - final ShellState expected = ShellState.builder() - .setConnectionState(ConnectionState.DISCONNECTED) - .build(); - - assertEquals(expected, state.getShellState()); - } - - @Test - public void disconnectedToConnectedToStorage() { - final SharedShellState state = new SharedShellState(); - - // Connect to Accumulo. - final AccumuloConnectionDetails connectionDetails = mock(AccumuloConnectionDetails.class); - final RyaClient connectedCommands = mock(RyaClient.class); - state.connectedToAccumulo(connectionDetails, connectedCommands); - - // Verify the state. - final ShellState expected = ShellState.builder() - .setConnectionState(ConnectionState.CONNECTED_TO_STORAGE) - .setAccumuloConnectionDetails(connectionDetails) - .setConnectedCommands(connectedCommands) - .build(); - - assertEquals(expected, state.getShellState()); - } - - @Test(expected = IllegalStateException.class) - public void connectToStorageAgain() { - final SharedShellState state = new SharedShellState(); - - // Connect to Accumulo. - final AccumuloConnectionDetails connectionDetails = mock(AccumuloConnectionDetails.class); - final RyaClient connectedCommands = mock(RyaClient.class); - state.connectedToAccumulo(connectionDetails, connectedCommands); - - // Try to set the information again. - state.connectedToAccumulo(connectionDetails, connectedCommands); - } - - @Test - public void connectedToInstance() { - final SharedShellState state = new SharedShellState(); - - // Connect to Accumulo. - final AccumuloConnectionDetails connectionDetails = mock(AccumuloConnectionDetails.class); - final RyaClient connectedCommands = mock(RyaClient.class); - state.connectedToAccumulo(connectionDetails, connectedCommands); - - // Connect to an Instance. - state.connectedToInstance("instance"); - - // Verify the state. - final ShellState expected = ShellState.builder() - .setConnectionState(ConnectionState.CONNECTED_TO_INSTANCE) - .setAccumuloConnectionDetails(connectionDetails) - .setConnectedCommands(connectedCommands) - .setRyaInstanceName("instance") - .build(); - - assertEquals(expected, state.getShellState()); - } - - @Test - public void ConnectedToInstanceAgain() { - final SharedShellState state = new SharedShellState(); - - // Connect to Accumulo. - final AccumuloConnectionDetails connectionDetails = mock(AccumuloConnectionDetails.class); - final RyaClient connectedCommands = mock(RyaClient.class); - state.connectedToAccumulo(connectionDetails, connectedCommands); - - // Connect to an Instance. - state.connectedToInstance("instance"); - - // Connect to another instance. - state.connectedToInstance("secondInstance"); - - // Verify the state. - final ShellState expected = ShellState.builder() - .setConnectionState(ConnectionState.CONNECTED_TO_INSTANCE) - .setAccumuloConnectionDetails(connectionDetails) - .setConnectedCommands(connectedCommands) - .setRyaInstanceName("secondInstance") - .build(); - assertEquals(expected, state.getShellState()); - } - - @Test(expected = IllegalStateException.class) - public void connectedToInstanceWhileDisconnectedFromStorage() { - final SharedShellState state = new SharedShellState(); - - state.connectedToInstance("instance"); - } - - @Test - public void disconnected() { - final SharedShellState state = new SharedShellState(); - - // Connect to Accumulo and an instance. - final AccumuloConnectionDetails connectionDetails = mock(AccumuloConnectionDetails.class); - final RyaClient connectedCommands = mock(RyaClient.class); - state.connectedToAccumulo(connectionDetails, connectedCommands); - state.connectedToInstance("instance"); - - // Disconnect. - state.disconnected(); - - // Verify the state. - final ShellState expected = ShellState.builder() - .setConnectionState(ConnectionState.DISCONNECTED) - .build(); - assertEquals(expected, state.getShellState()); - } - - @Test - public void disconnectedAgain() { - // Indicate we have diconnected while already in the disconnected state. - final SharedShellState state = new SharedShellState(); - state.disconnected(); - - // Verify the state. - final ShellState expected = ShellState.builder() - .setConnectionState(ConnectionState.DISCONNECTED) - .build(); - assertEquals(expected, state.getShellState()); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/rya.console/src/test/java/org/apache/rya/shell/util/ConnectorFactoryIT.java ---------------------------------------------------------------------- diff --git a/extras/rya.console/src/test/java/org/apache/rya/shell/util/ConnectorFactoryIT.java b/extras/rya.console/src/test/java/org/apache/rya/shell/util/ConnectorFactoryIT.java deleted file mode 100644 index c3a5e74..0000000 --- a/extras/rya.console/src/test/java/org/apache/rya/shell/util/ConnectorFactoryIT.java +++ /dev/null @@ -1,57 +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.rya.shell.util; - -import java.nio.CharBuffer; - -import org.apache.accumulo.core.client.AccumuloException; -import org.apache.accumulo.core.client.AccumuloSecurityException; -import org.junit.Test; - -import org.apache.rya.accumulo.AccumuloITBase; - -/** - * Tests the methods of {@link ConnectorFactory}. - */ -public class ConnectorFactoryIT extends AccumuloITBase { - - @Test - public void connect_successful() throws AccumuloException, AccumuloSecurityException { - // Setup the values that will be tested with. - final CharSequence password = CharBuffer.wrap( getPassword() ); - - final ConnectorFactory ac = new ConnectorFactory(); - ac.connect(getUsername(), - password, - getInstanceName(), - getZookeepers()); - } - - @Test(expected = AccumuloSecurityException.class) - public void connect_wrongCredentials() throws AccumuloException, AccumuloSecurityException { - // Setup the values that will be tested with. - final CharSequence password = CharBuffer.wrap( new char[] {'w','r','o','n','g','p','a','s','s'} ); - - final ConnectorFactory ac = new ConnectorFactory(); - ac.connect(getUsername(), - password, - getInstanceName(), - getZookeepers()); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/rya.console/src/test/java/org/apache/rya/shell/util/InstanceNamesFormatterTest.java ---------------------------------------------------------------------- diff --git a/extras/rya.console/src/test/java/org/apache/rya/shell/util/InstanceNamesFormatterTest.java b/extras/rya.console/src/test/java/org/apache/rya/shell/util/InstanceNamesFormatterTest.java deleted file mode 100644 index d6e23df..0000000 --- a/extras/rya.console/src/test/java/org/apache/rya/shell/util/InstanceNamesFormatterTest.java +++ /dev/null @@ -1,81 +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.rya.shell.util; - -import static org.junit.Assert.assertEquals; - -import java.util.List; - -import org.junit.Test; - -import com.beust.jcommander.internal.Lists; - -/** - * Tests an instance of {@link InstanceNamesFormatter}. - */ -public class InstanceNamesFormatterTest { - - @Test - public void format_withConnectedName() { - final List<String> instanceNames = Lists.newArrayList("a", "b", "c", "d"); - - final String formatted = new InstanceNamesFormatter().format(instanceNames, "c"); - - final String expected = - "Rya instance names:\n" + - " a\n" + - " b\n" + - " * c\n" + - " d\n"; - - assertEquals(expected, formatted); - } - - @Test - public void format_connectedNameNotInList() { - final List<String> instanceNames = Lists.newArrayList("a", "b", "c", "d"); - - final String formatted = new InstanceNamesFormatter().format(instanceNames, "not_in_list"); - - final String expected = - "Rya instance names:\n" + - " a\n" + - " b\n" + - " c\n" + - " d\n"; - - assertEquals(expected, formatted); - } - - @Test - public void format() { - final List<String> instanceNames = Lists.newArrayList("a", "b", "c", "d"); - - final String formatted = new InstanceNamesFormatter().format(instanceNames); - - final String expected = - "Rya instance names:\n" + - " a\n" + - " b\n" + - " c\n" + - " d\n"; - - assertEquals(expected, formatted); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/rya.console/src/test/java/org/apache/rya/shell/util/RyaDetailsFormatterTest.java ---------------------------------------------------------------------- diff --git a/extras/rya.console/src/test/java/org/apache/rya/shell/util/RyaDetailsFormatterTest.java b/extras/rya.console/src/test/java/org/apache/rya/shell/util/RyaDetailsFormatterTest.java deleted file mode 100644 index 9e45a4f..0000000 --- a/extras/rya.console/src/test/java/org/apache/rya/shell/util/RyaDetailsFormatterTest.java +++ /dev/null @@ -1,111 +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.rya.shell.util; - -import static org.junit.Assert.assertEquals; - -import java.util.Date; -import java.util.TimeZone; - -import org.apache.rya.api.instance.RyaDetails; -import org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails; -import org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails; -import org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails; -import org.apache.rya.api.instance.RyaDetails.PCJIndexDetails; -import org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.FluoDetails; -import org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.PCJDetails; -import org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.PCJDetails.PCJUpdateStrategy; -import org.apache.rya.api.instance.RyaDetails.ProspectorDetails; -import org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails; -import org.junit.Test; - -import com.google.common.base.Optional; - -/** - * Tests the methods of {@link RyaDetailsFormatter}. - */ -public class RyaDetailsFormatterTest { - - @Test - public void format() { - // This test failed if the default timezone was not EST, so now it's fixed at EST. - TimeZone.setDefault(TimeZone.getTimeZone("America/New_York")); - // Create the object that will be formatted. - final RyaDetails details = RyaDetails.builder().setRyaInstanceName("test_instance") - .setRyaVersion("1.2.3.4") - .addUser("alice") - .addUser("bob") - .addUser("charlie") - .setEntityCentricIndexDetails( new EntityCentricIndexDetails(true) ) - //RYA-215 .setGeoIndexDetails( new GeoIndexDetails(true) ) - .setTemporalIndexDetails( new TemporalIndexDetails(true) ) - .setFreeTextDetails( new FreeTextIndexDetails(true) ) - .setPCJIndexDetails( - PCJIndexDetails.builder() - .setEnabled(true) - .setFluoDetails( new FluoDetails("test_instance_rya_pcj_updater") ) - .addPCJDetails( - PCJDetails.builder() - .setId("pcj 1") - .setUpdateStrategy(PCJUpdateStrategy.BATCH) - .setLastUpdateTime( new Date(1252521351L) )) - .addPCJDetails( - PCJDetails.builder() - .setId("pcj 2") - .setUpdateStrategy(PCJUpdateStrategy.INCREMENTAL))) - .setProspectorDetails( new ProspectorDetails(Optional.of(new Date(12525211L))) ) - .setJoinSelectivityDetails( new JoinSelectivityDetails(Optional.of(new Date(125221351L))) ) - .build(); - - final String formatted = new RyaDetailsFormatter().format(details); - - // Verify the created object matches the expected result. - final String expected = - "General Metadata:\n" + - " Instance Name: test_instance\n" + - " RYA Version: 1.2.3.4\n" + - " Users: alice, bob, charlie\n" + - "Secondary Indicies:\n" + - " Entity Centric Index:\n" + - " Enabled: true\n" + - //RYA-215 " Geospatial Index:\n" + - //RYA-215 " Enabled: true\n" + - " Free Text Index:\n" + - " Enabled: true\n" + - " Temporal Index:\n" + - " Enabled: true\n" + - " PCJ Index:\n" + - " Enabled: true\n" + - " Fluo App Name: test_instance_rya_pcj_updater\n" + - " PCJs:\n" + - " ID: pcj 1\n" + - " Update Strategy: BATCH\n" + - " Last Update Time: Thu Jan 15 06:55:21 EST 1970\n" + - " ID: pcj 2\n" + - " Update Strategy: INCREMENTAL\n" + - " Last Update Time: unavailable\n" + - "Statistics:\n" + - " Prospector:\n" + - " Last Update Time: Wed Dec 31 22:28:45 EST 1969\n" + - " Join Selectivity:\n" + - " Last Updated Time: Fri Jan 02 05:47:01 EST 1970\n"; - - assertEquals(expected, formatted); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/rya.console/src/test/resources/Query1.sparql ---------------------------------------------------------------------- diff --git a/extras/rya.console/src/test/resources/Query1.sparql b/extras/rya.console/src/test/resources/Query1.sparql deleted file mode 100644 index 555607e..0000000 --- a/extras/rya.console/src/test/resources/Query1.sparql +++ /dev/null @@ -1,20 +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. -# - -SELECT * WHERE { ?person <http://isA> ?noun } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/rya.console/src/test/resources/RyaShellTest-context.xml ---------------------------------------------------------------------- diff --git a/extras/rya.console/src/test/resources/RyaShellTest-context.xml b/extras/rya.console/src/test/resources/RyaShellTest-context.xml deleted file mode 100644 index f7ffe0f..0000000 --- a/extras/rya.console/src/test/resources/RyaShellTest-context.xml +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - 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. - ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:context="http://www.springframework.org/schema/context" - xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> - - <!-- Tell Spring where it can find all of the Command components. --> - <context:component-scan base-package="org.apache.rya.shell"/> - - <!-- Define the shell state bean that will be shared across all of the commands. --> - <bean id="sharedShellState" class="org.apache.rya.shell.SharedShellState" /> - - <!-- We use a mock Password Prompt here to simulate a user entering a password. --> - <bean id="passwordPrompt" class="org.mockito.Mockito" factory-method="mock"> - <constructor-arg value="org.apache.rya.shell.util.PasswordPrompt" /> - </bean> - - <!-- We use a mock Install Prompt here to simulate a user entering the installation configuration. --> - <bean id="installPrompt" class="org.mockito.Mockito" factory-method="mock"> - <constructor-arg value="org.apache.rya.shell.util.InstallPrompt"/> - </bean> - - <!-- We use a mock SPARQL Prompt here to simulate a user entering the installation configuration. --> - <bean id="sparqlPrompt" class="org.mockito.Mockito" factory-method="mock"> - <constructor-arg value="org.apache.rya.shell.util.SparqlPrompt"/> - </bean> - - <!-- We use a mock ConsolePrintert here to simulate console output to the user. --> - <bean id="consolePrinter" class="org.mockito.Mockito" factory-method="mock"> - <constructor-arg value="org.apache.rya.shell.util.ConsolePrinter"/> - </bean> - - <!-- We use a mock Uninstall Prompt here to simulate a user entering the installation configuration. --> - <bean id="uninstallPrompt" class="org.mockito.Mockito" factory-method="mock"> - <constructor-arg value="org.apache.rya.shell.util.UninstallPrompt"/> - </bean> - - <!-- Define each of the beans that hold onto commands used by the shell. --> - <bean id="ryaConnectionCommands" class="org.apache.rya.shell.RyaConnectionCommands" /> - <bean id="ryaCommands" class="org.apache.rya.shell.RyaCommands" /> - <bean id="ryaAdminCommands" class="org.apache.rya.shell.RyaAdminCommands" /> -</beans> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/shell/.gitignore ---------------------------------------------------------------------- diff --git a/extras/shell/.gitignore b/extras/shell/.gitignore new file mode 100644 index 0000000..5d1172a --- /dev/null +++ b/extras/shell/.gitignore @@ -0,0 +1,8 @@ +/.classpath +/.project +.settings/ +target/ +/log.roo +*.log + +/bin/ http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/shell/pom.xml ---------------------------------------------------------------------- diff --git a/extras/shell/pom.xml b/extras/shell/pom.xml new file mode 100644 index 0000000..37a5503 --- /dev/null +++ b/extras/shell/pom.xml @@ -0,0 +1,223 @@ +<?xml version='1.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. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.rya</groupId> + <artifactId>rya.extras</artifactId> + <version>3.2.11-incubating-SNAPSHOT</version> + </parent> + + <artifactId>rya.shell</artifactId> + <name>Apache Rya Shell</name> + + <dependencies> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.rya</groupId> + <artifactId>rya.api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.rya</groupId> + <artifactId>accumulo.rya</artifactId> + <exclusions> + <exclusion> + <groupId>jline</groupId> + <artifactId>jline</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.rya</groupId> + <artifactId>rya.indexing</artifactId> + </dependency> + <dependency> + <groupId>org.apache.rya</groupId> + <artifactId>rya.pcj.fluo.api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.fluo</groupId> + <artifactId>fluo-core</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.shell</groupId> + <artifactId>spring-shell</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-web</artifactId> + <version>4.1.0.RELEASE</version> + </dependency> + + <!-- testing dependencies --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.accumulo</groupId> + <artifactId>accumulo-minicluster</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.fluo</groupId> + <artifactId>fluo-mini</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.rya</groupId> + <artifactId>accumulo.rya</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + </dependencies> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <configuration> + <excludes> + <exclude>spring-shell.log</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <!-- Automatically place Apache 2 license headers at the top of all of the project's Java files. + Rat runs during the 'validate' lifecycle step, so it will fail the build before this one + executes if any of the headers are missing. Run the build with rat turned off to add + missing headers to the Java files. --> + <plugin> + <groupId>com.mycila</groupId> + <artifactId>license-maven-plugin</artifactId> + <version>2.6</version> + <configuration> + <!-- We use a custome Apache 2.0 license because we do not include a copywrite section. --> + <header>src/main/resources/LICENSE.txt</header> + </configuration> + <executions> + <execution> + <phase>process-sources</phase> + <goals> + <goal>format</goal> + </goals> + </execution> + </executions> + </plugin> + + <!-- Create an executable jar file for the shell. --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <transformers> + <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> + <resource>META-INF/spring.handlers</resource> + </transformer> + <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> + <resource>META-INF/spring.schemas</resource> + </transformer> + <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/> + <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> + <mainClass>org.springframework.shell.Bootstrap</mainClass> + </transformer> + </transformers> + <filters> + <filter> + <!-- + Shading signed JARs will fail without this. + http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar + --> + <artifact>*:*</artifact> + <excludes> + <exclude>META-INF/*.SF</exclude> + <exclude>META-INF/*.DSA</exclude> + <exclude>META-INF/*.RSA</exclude> + </excludes> + </filter> + </filters> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>create-binary-distribution</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <descriptors> + <descriptor>src/main/assembly/binary-release.xml</descriptor> + </descriptors> + </configuration> + </execution> + </executions> + </plugin> + + <!-- Generate Code Coverage report. --> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <executions> + <execution> + <id>default-prepare-agent</id> + <goals> + <goal>prepare-agent</goal> + </goals> + </execution> + <execution> + <id>default-report</id> + <phase>prepare-package</phase> + <goals> + <goal>report</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/shell/src/main/assembly/binary-release.xml ---------------------------------------------------------------------- diff --git a/extras/shell/src/main/assembly/binary-release.xml b/extras/shell/src/main/assembly/binary-release.xml new file mode 100644 index 0000000..374213f --- /dev/null +++ b/extras/shell/src/main/assembly/binary-release.xml @@ -0,0 +1,33 @@ +<!-- + + 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. + +--> +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> + <id>bin</id> + <formats> + <format>tar.gz</format> + </formats> + <includeBaseDirectory>true</includeBaseDirectory> + <componentDescriptors> + <componentDescriptor>src/main/assembly/component-release.xml</componentDescriptor> + </componentDescriptors> +</assembly> http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/shell/src/main/assembly/component-release.xml ---------------------------------------------------------------------- diff --git a/extras/shell/src/main/assembly/component-release.xml b/extras/shell/src/main/assembly/component-release.xml new file mode 100644 index 0000000..72c74d1 --- /dev/null +++ b/extras/shell/src/main/assembly/component-release.xml @@ -0,0 +1,90 @@ +<!-- + + 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. + +--> +<component + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.3" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.3 http://maven.apache.org/xsd/component-1.1.3.xsd"> + <fileSets> + <fileSet> + <directory>src/main/config</directory> + <outputDirectory>conf</outputDirectory> + <directoryMode>0755</directoryMode> + <fileMode>0644</fileMode> + <lineEnding>unix</lineEnding> + <filtered>false</filtered> + <includes> + <include>*.properties</include> + </includes> + </fileSet> + <fileSet> + <directory>src/main/scripts</directory> + <outputDirectory>bin</outputDirectory> + <directoryMode>0755</directoryMode> + <fileMode>0755</fileMode> + <includes> + <include>rya</include> + </includes> + <lineEnding>unix</lineEnding> + <filtered>true</filtered> + </fileSet> + <fileSet> + <directory>src/main/scripts</directory> + <outputDirectory>bin</outputDirectory> + <directoryMode>0755</directoryMode> + <fileMode>0644</fileMode> + <includes> + <include>*.bat</include> + </includes> + <lineEnding>dos</lineEnding> + <filtered>true</filtered> + </fileSet> + <fileSet> + <directory>src/main/examples</directory> + <outputDirectory>examples</outputDirectory> + <directoryMode>0755</directoryMode> + <fileMode>0644</fileMode> + <!-- <includes> <include>*.script</include> </includes> --> + <lineEnding>unix</lineEnding> + <filtered>false</filtered> + </fileSet> + + <!-- create an empty directory for log files --> + <fileSet> + <directory>src/main/assembly</directory> + <outputDirectory>logs</outputDirectory> + <directoryMode>755</directoryMode> + <excludes> + <exclude>*</exclude> + </excludes> + </fileSet> + + + <fileSet> + <directory>${project.build.directory}</directory> + <outputDirectory>lib</outputDirectory> + <directoryMode>755</directoryMode> + <fileMode>0644</fileMode> + <includes> + <include>${project.artifactId}-${project.version}-shaded.jar</include> + </includes> + </fileSet> + </fileSets> +</component> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/shell/src/main/config/log4j.properties ---------------------------------------------------------------------- diff --git a/extras/shell/src/main/config/log4j.properties b/extras/shell/src/main/config/log4j.properties new file mode 100644 index 0000000..49d6822 --- /dev/null +++ b/extras/shell/src/main/config/log4j.properties @@ -0,0 +1,35 @@ +# +# 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. +# + +# Valid levels: +# TRACE, DEBUG, INFO, WARN, ERROR and FATAL +log4j.rootCategory=INFO, LOGFILE + +# LOGFILE is set to be a File appender using a PatternLayout. +log4j.appender.LOGFILE=org.apache.log4j.FileAppender +log4j.appender.LOGFILE.File=${rya.shell.home}logs/rya-shell.log +#log4j.appender.LOGFILE.Threshold=DEBUG +log4j.appender.LOGFILE.Append=true + +log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout +log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c - %m%n + +#log4j.appender.LOGFILE.layout=org.apache.log4j.EnhancedPatternLayout +#log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c{1.} - %m%n + http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/shell/src/main/examples/Query1.sparql ---------------------------------------------------------------------- diff --git a/extras/shell/src/main/examples/Query1.sparql b/extras/shell/src/main/examples/Query1.sparql new file mode 100644 index 0000000..33619fb --- /dev/null +++ b/extras/shell/src/main/examples/Query1.sparql @@ -0,0 +1,24 @@ +# +# 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. +# + +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> +SELECT ?thing ?name WHERE { + ?thing <http://predicates#name> ?name . + ?thing rdf:type <http://types#Monkey> . +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/shell/src/main/examples/example.script ---------------------------------------------------------------------- diff --git a/extras/shell/src/main/examples/example.script b/extras/shell/src/main/examples/example.script new file mode 100644 index 0000000..529ea61 --- /dev/null +++ b/extras/shell/src/main/examples/example.script @@ -0,0 +1,26 @@ +# +# 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. +# + +connect-accumulo --username accumulo_user --instanceName accumulo_instance --zookeepers zoo1,zoo2,zoo3,zoo4,zoo5 +install-with-parameters --instanceName rya_example_ +connect-rya --instance rya_example_ +#load-data --file examples/ontology.owl +load-data --file examples/triples.nt +sparql-query --file examples/Query1.sparql +# uninstall \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/shell/src/main/examples/triples.nt ---------------------------------------------------------------------- diff --git a/extras/shell/src/main/examples/triples.nt b/extras/shell/src/main/examples/triples.nt new file mode 100644 index 0000000..38b6c6f --- /dev/null +++ b/extras/shell/src/main/examples/triples.nt @@ -0,0 +1,25 @@ +# +# 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. +# + +<http://Thing1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://types#Monkey> . +<http://Thing1> <http://predicates#name> "Thing 1". +<http://Thing2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://types#Gorilla> . +<http://Thing2> <http://predicates#name> "Thing 2". +<http://Thing3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://types#Monkey> . +<http://Thing3> <http://predicates#name> "Thing 3". http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2564ac0a/extras/shell/src/main/java/org/apache/rya/shell/RyaAdminCommands.java ---------------------------------------------------------------------- diff --git a/extras/shell/src/main/java/org/apache/rya/shell/RyaAdminCommands.java b/extras/shell/src/main/java/org/apache/rya/shell/RyaAdminCommands.java new file mode 100644 index 0000000..9239dc7 --- /dev/null +++ b/extras/shell/src/main/java/org/apache/rya/shell/RyaAdminCommands.java @@ -0,0 +1,388 @@ +/** + * 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.rya.shell; + +import static java.util.Objects.requireNonNull; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; + +import org.apache.rya.api.client.GetInstanceDetails; +import org.apache.rya.api.client.Install.DuplicateInstanceNameException; +import org.apache.rya.api.client.Install.InstallConfiguration; +import org.apache.rya.api.client.InstanceDoesNotExistException; +import org.apache.rya.api.client.RyaClient; +import org.apache.rya.api.client.RyaClientException; +import org.apache.rya.api.instance.RyaDetails; +import org.apache.rya.shell.SharedShellState.ConnectionState; +import org.apache.rya.shell.SharedShellState.ShellState; +import org.apache.rya.shell.util.InstallPrompt; +import org.apache.rya.shell.util.InstanceNamesFormatter; +import org.apache.rya.shell.util.RyaDetailsFormatter; +import org.apache.rya.shell.util.SparqlPrompt; +import org.apache.rya.shell.util.UninstallPrompt; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.shell.core.CommandMarker; +import org.springframework.shell.core.annotation.CliAvailabilityIndicator; +import org.springframework.shell.core.annotation.CliCommand; +import org.springframework.shell.core.annotation.CliOption; +import org.springframework.stereotype.Component; + +import com.google.common.base.Optional; + +/** + * Rya Shell commands that have to do with administrative tasks. + */ +@Component +public class RyaAdminCommands implements CommandMarker { + + public static final String CREATE_PCJ_CMD = "create-pcj"; + public static final String DELETE_PCJ_CMD = "delete-pcj"; + public static final String PRINT_INSTANCE_DETAILS_CMD = "print-instance-details"; + public static final String INSTALL_CMD = "install"; + public static final String INSTALL_PARAMETERS_CMD = "install-with-parameters"; + public static final String LIST_INSTANCES_CMD = "list-instances"; + public static final String UNINSTALL_CMD = "uninstall"; + public static final String ADD_USER_CMD = "add-user"; + public static final String REMOVE_USER_CMD = "remove-user"; + + private final SharedShellState state; + private final InstallPrompt installPrompt; + private final SparqlPrompt sparqlPrompt; + private final UninstallPrompt uninstallPrompt; + + /** + * Constructs an instance of {@link RyaAdminCommands}. + * + * @param state - Holds shared state between all of the command classes. (not null) + * @param installPrompt - Prompts a user for installation details. (not null) + * @param sparqlPrompt - Prompts a user for a SPARQL query. (not null) + * @param uninstallPrompt - Prompts a user when uninstalling. (not null) + */ + @Autowired + public RyaAdminCommands( + final SharedShellState state, + final InstallPrompt installPrompt, + final SparqlPrompt sparqlPrompt, + final UninstallPrompt uninstallPrompt) { + this.state = requireNonNull( state ); + this.installPrompt = requireNonNull(installPrompt); + this.sparqlPrompt = requireNonNull(sparqlPrompt); + this.uninstallPrompt = requireNonNull(uninstallPrompt); + } + + /** + * Enables commands that only become available once the Shell has been connected to a Rya Storage. + */ + @CliAvailabilityIndicator({ + LIST_INSTANCES_CMD, + INSTALL_CMD }) + public boolean areStorageCommandsAvailable() { + switch(state.getShellState().getConnectionState()) { + case CONNECTED_TO_STORAGE: + case CONNECTED_TO_INSTANCE: + return true; + default: + return false; + } + } + + /** + * Enables commands that are always available once the Shell is connected to a Rya Instance. + */ + @CliAvailabilityIndicator({ + PRINT_INSTANCE_DETAILS_CMD, + UNINSTALL_CMD, + ADD_USER_CMD, + REMOVE_USER_CMD}) + public boolean areInstanceCommandsAvailable() { + switch(state.getShellState().getConnectionState()) { + case CONNECTED_TO_INSTANCE: + return true; + default: + return false; + } + } + + /** + * Enables commands that are available when the Shell is connected to a Rya Instance that supports PCJ Indexing. + */ + @CliAvailabilityIndicator({ + CREATE_PCJ_CMD, + DELETE_PCJ_CMD }) + public boolean arePCJCommandsAvailable() { + // The PCJ commands are only available if the Shell is connected to an instance of Rya + // that is new enough to use the RyaDetailsRepository and is configured to maintain PCJs. + final ShellState shellState = state.getShellState(); + if(shellState.getConnectionState() == ConnectionState.CONNECTED_TO_INSTANCE) { + final GetInstanceDetails getInstanceDetails = shellState.getConnectedCommands().get().getGetInstanceDetails(); + final String ryaInstanceName = state.getShellState().getRyaInstanceName().get(); + try { + final Optional<RyaDetails> instanceDetails = getInstanceDetails.getDetails( ryaInstanceName ); + if(instanceDetails.isPresent()) { + return instanceDetails.get().getPCJIndexDetails().isEnabled(); + } + } catch (final RyaClientException e) { + return false; + } + } + return false; + } + + @CliCommand(value = LIST_INSTANCES_CMD, help = "List the names of the installed Rya instances.") + public String listInstances() { + // Fetch the command that is connected to the store. + final ShellState shellState = state.getShellState(); + final RyaClient commands = shellState.getConnectedCommands().get(); + final Optional<String> ryaInstance = shellState.getRyaInstanceName(); + + try { + // Sort the names alphabetically. + final List<String> instanceNames = commands.getListInstances().listInstances(); + Collections.sort( instanceNames ); + + final String report; + final InstanceNamesFormatter formatter = new InstanceNamesFormatter(); + if(ryaInstance.isPresent()) { + report = formatter.format(instanceNames, ryaInstance.get()); + } else { + report = formatter.format(instanceNames); + } + return report; + + } catch (final RyaClientException e) { + throw new RuntimeException("Can not list the Rya instances. Reason: " + e.getMessage(), e); + } + } + + @CliCommand(value = INSTALL_CMD, help = "Create a new instance of Rya interactively.") + public String install() { + // Fetch the commands that are connected to the store. + final RyaClient commands = state.getShellState().getConnectedCommands().get(); + + String instanceName = null; + InstallConfiguration installConfig = null; + try { + boolean verified = false; + while(!verified) { + // Use the install prompt to fetch the user's installation options. + instanceName = installPrompt.promptInstanceName(); + installConfig = installPrompt.promptInstallConfiguration(instanceName); + + // Verify the configuration is what the user actually wants to do. + verified = installPrompt.promptVerified(instanceName, installConfig); + } + + // Execute the command. + commands.getInstall().install(instanceName, installConfig); + return String.format("The Rya instance named '%s' has been installed.", instanceName); + + } catch(final DuplicateInstanceNameException e) { + throw new RuntimeException(String.format("A Rya instance named '%s' already exists. Try again with a different name.", instanceName), e); + } catch (final IOException | RyaClientException e) { + throw new RuntimeException("Could not install a new instance of Rya. Reason: " + e.getMessage(), e); + } + } + + @CliCommand(value = INSTALL_PARAMETERS_CMD, help = "Create a new instance of Rya with command line parameters.") + public String installWithParameters( + @CliOption(key = {"instanceName"}, mandatory = true, help = "The name of the Rya instance to create.") + final String instanceName, + + @CliOption(key = {"enableTableHashPrefix"}, mandatory = false, help = "Use Shard Balancing (improves streamed input write speeds).", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") + final boolean enableTableHashPrefix, + + @CliOption(key = {"enableEntityCentricIndex"}, mandatory = false, help = "Use Entity Centric Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") + final boolean enableEntityCentricIndex, + + @CliOption(key = {"enableFreeTextIndex"}, mandatory = false, help = "Use Free Text Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") + final boolean enableFreeTextIndex, + + @CliOption(key = {"enableGeospatialIndex"}, mandatory = false, help = "Use Geospatial Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") + final boolean enableGeospatialIndex, + + @CliOption(key = {"enableTemporalIndex"}, mandatory = false, help = "Use Temporal Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") + final boolean enableTemporalIndex, + + @CliOption(key = {"enablePcjIndex"}, mandatory = false, help = "Use Precomputed Join (PCJ) Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") + final boolean enablePcjIndex, + + @CliOption(key = {"fluoPcjAppName"}, mandatory = false, help = "Fluo Application Name for PCJ Index Updater (fluo app must be initialized and enablePcjIndex=true).") + final String fluoPcjAppName + ) { + + // Fetch the commands that are connected to the store. + final RyaClient commands = state.getShellState().getConnectedCommands().get(); + + try { + final InstallConfiguration installConfig = InstallConfiguration.builder() + .setEnableTableHashPrefix(enableTableHashPrefix) + .setEnableEntityCentricIndex(enableEntityCentricIndex) + .setEnableFreeTextIndex(enableFreeTextIndex) + .setEnableGeoIndex(enableGeospatialIndex) + .setEnableTemporalIndex(enableTemporalIndex) + .setEnablePcjIndex(enablePcjIndex) + .setFluoPcjAppName(fluoPcjAppName) + .build(); + + // Verify the configuration is what the user actually wants to do. + if (!installPrompt.promptVerified(instanceName, installConfig)) { + return "Skipping Installation."; + } + + // Execute the command. + commands.getInstall().install(instanceName, installConfig); + return String.format("The Rya instance named '%s' has been installed.", instanceName); + + } catch(final DuplicateInstanceNameException e) { + throw new RuntimeException(String.format("A Rya instance named '%s' already exists. Try again with a different name.", instanceName), e); + } catch (final IOException | RyaClientException e) { + throw new RuntimeException("Could not install a new instance of Rya. Reason: " + e.getMessage(), e); + } + } + + @CliCommand(value = PRINT_INSTANCE_DETAILS_CMD, help = "Print information about how the Rya instance is configured.") + public String printInstanceDetails() { + // Fetch the command that is connected to the store. + final ShellState shellState = state.getShellState(); + final RyaClient commands = shellState.getConnectedCommands().get(); + final String ryaInstance = shellState.getRyaInstanceName().get(); + + try { + final Optional<RyaDetails> details = commands.getGetInstanceDetails().getDetails(ryaInstance); + if(details.isPresent()) { + return new RyaDetailsFormatter().format(details.get()); + } else { + return "This instance of Rya does not have a Rya Details table. Consider migrating to a newer version of Rya."; + } + } catch(final InstanceDoesNotExistException e) { + throw new RuntimeException(String.format("A Rya instance named '%s' does not exist.", ryaInstance), e); + } catch (final RyaClientException e) { + throw new RuntimeException("Could not get the instance details. Reason: " + e.getMessage(), e); + } + } + + @CliCommand(value = CREATE_PCJ_CMD, help = "Creates and starts the maintenance of a new PCJ using a Fluo application.") + public String createPcj() { + // Fetch the command that is connected to the store. + final ShellState shellState = state.getShellState(); + final RyaClient commands = shellState.getConnectedCommands().get(); + final String ryaInstance = shellState.getRyaInstanceName().get(); + + try { + // Prompt the user for the SPARQL. + final Optional<String> sparql = sparqlPrompt.getSparql(); + if (sparql.isPresent()) { + // Execute the command. + final String pcjId = commands.getCreatePCJ().createPCJ(ryaInstance, sparql.get()); + // Return a message that indicates the ID of the newly created ID. + return String.format("The PCJ has been created. Its ID is '%s'.", pcjId); + } else { + return ""; // user aborted the SPARQL prompt. + } + } catch (final InstanceDoesNotExistException e) { + throw new RuntimeException(String.format("A Rya instance named '%s' does not exist.", ryaInstance), e); + } catch (final IOException | RyaClientException e) { + throw new RuntimeException("Could not create the PCJ. Provided reasons: " + e.getMessage(), e); + } + } + + @CliCommand(value = DELETE_PCJ_CMD, help = "Deletes and halts maintenance of a PCJ.") + public String deletePcj( + @CliOption(key = {"pcjId"}, mandatory = true, help = "The ID of the PCJ that will be deleted.") + final String pcjId) { + // Fetch the command that is connected to the store. + final ShellState shellState = state.getShellState(); + final RyaClient commands = shellState.getConnectedCommands().get(); + final String ryaInstance = shellState.getRyaInstanceName().get(); + + try { + // Execute the command. + commands.getDeletePCJ().deletePCJ(ryaInstance, pcjId); + return "The PCJ has been deleted."; + + } catch (final InstanceDoesNotExistException e) { + throw new RuntimeException(String.format("A Rya instance named '%s' does not exist.", ryaInstance), e); + } catch (final RyaClientException e) { + throw new RuntimeException("The PCJ could not be deleted. Provided reason: " + e.getMessage(), e); + } + } + + @CliCommand(value = ADD_USER_CMD, help = "Adds an authorized user to the Rya instance.") + public void addUser( + @CliOption(key = {"username"}, mandatory = true, help = "The username of the user that will be granted access.") + final String username) { + // Fetch the Rya client that is connected to the store. + final ShellState shellState = state.getShellState(); + final RyaClient ryaClient = shellState.getConnectedCommands().get(); + final String ryaInstance = shellState.getRyaInstanceName().get(); + + try { + ryaClient.getAddUser().addUser(ryaInstance, username); + } catch (final InstanceDoesNotExistException e) { + throw new RuntimeException(String.format("A Rya instance named '%s' does not exist.", ryaInstance), e); + } catch (final RyaClientException e) { + throw new RuntimeException("The user's access could not be granted. Provided reason: " + e.getMessage(), e); + } + } + + @CliCommand(value = REMOVE_USER_CMD, help = "Removes an authorized user from the Rya instance.") + public void removeUser( + @CliOption(key = {"username"}, mandatory = true, help = "The username of the user whose access will be revoked.") + final String username) { + // Fetch the Rya client that is connected to the store. + final ShellState shellState = state.getShellState(); + final RyaClient ryaClient = shellState.getConnectedCommands().get(); + final String ryaInstance = shellState.getRyaInstanceName().get(); + + try { + ryaClient.getRemoveUser().removeUser(ryaInstance, username); + } catch (final InstanceDoesNotExistException e) { + throw new RuntimeException(String.format("A Rya instance named '%s' does not exist.", ryaInstance), e); + } catch (final RyaClientException e) { + throw new RuntimeException("The user's access could not be revoked. Provided reason: " + e.getMessage(), e); + } + } + + @CliCommand(value = UNINSTALL_CMD, help = "Uninstall an instance of Rya.") + public String uninstall() { + // Fetch the command that is connected to the store. + final ShellState shellState = state.getShellState(); + final RyaClient commands = shellState.getConnectedCommands().get(); + final String ryaInstanceName = shellState.getRyaInstanceName().get(); + + try { + // Make sure the user meant to uninstall the Rya instance. + if(!uninstallPrompt.promptAreYouSure(ryaInstanceName)) { + return "Cancelled."; + } + + // Perform the uninstall. + commands.getUninstall().uninstall(ryaInstanceName); + + } catch (final InstanceDoesNotExistException e) { + throw new RuntimeException(String.format("A Rya instance named '%s' does not exist.", ryaInstanceName), e); + } catch (final IOException | RyaClientException e) { + throw new RuntimeException("The Rya instance could not be uninstalled. Provided reason: " + e.getMessage(), e); + } + + return "The Rya instance named '" + ryaInstanceName +"' has been uninstalled."; + } +} \ No newline at end of file
