Search in sources :

Example 1 with AccumuloConnectionDetails

use of org.apache.rya.api.client.accumulo.AccumuloConnectionDetails in project incubator-rya by apache.

the class CommonOptions method buildRyaClient.

public RyaClient buildRyaClient() throws AccumuloException, AccumuloSecurityException {
    final Instance instance = new ZooKeeperInstance(accumuloInstance, zookeepers);
    final AccumuloConnectionDetails accumuloDetails = new AccumuloConnectionDetails(username, password.toCharArray(), accumuloInstance, zookeepers);
    return AccumuloRyaClientFactory.build(accumuloDetails, instance.getConnector(username, new PasswordToken(password)));
}
Also used : PasswordToken(org.apache.accumulo.core.client.security.tokens.PasswordToken) Instance(org.apache.accumulo.core.client.Instance) ZooKeeperInstance(org.apache.accumulo.core.client.ZooKeeperInstance) AccumuloConnectionDetails(org.apache.rya.api.client.accumulo.AccumuloConnectionDetails) ZooKeeperInstance(org.apache.accumulo.core.client.ZooKeeperInstance)

Example 2 with AccumuloConnectionDetails

use of org.apache.rya.api.client.accumulo.AccumuloConnectionDetails in project incubator-rya by apache.

the class RyaPromptProviderTest method isConnected_hasInstanceName.

@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);
}
Also used : AccumuloConnectionDetails(org.apache.rya.api.client.accumulo.AccumuloConnectionDetails) RyaClient(org.apache.rya.api.client.RyaClient) Test(org.junit.Test)

Example 3 with AccumuloConnectionDetails

use of org.apache.rya.api.client.accumulo.AccumuloConnectionDetails in project incubator-rya by apache.

the class SharedShellStateTest method connectToStorageAgain.

@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);
}
Also used : AccumuloConnectionDetails(org.apache.rya.api.client.accumulo.AccumuloConnectionDetails) RyaClient(org.apache.rya.api.client.RyaClient) Test(org.junit.Test)

Example 4 with AccumuloConnectionDetails

use of org.apache.rya.api.client.accumulo.AccumuloConnectionDetails in project incubator-rya by apache.

the class SharedShellStateTest method connectedToRyaStreams.

@Test
public void connectedToRyaStreams() {
    // Create a shell state.
    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 Rya Streams for the instance.
    final RyaStreamsClient streamsClient = mock(RyaStreamsClient.class);
    state.connectedToRyaStreams(streamsClient);
    // Verify the state.
    assertEquals(streamsClient, state.getShellState().getRyaStreamsCommands().get());
}
Also used : RyaStreamsClient(org.apache.rya.streams.api.RyaStreamsClient) AccumuloConnectionDetails(org.apache.rya.api.client.accumulo.AccumuloConnectionDetails) RyaClient(org.apache.rya.api.client.RyaClient) Test(org.junit.Test)

Example 5 with AccumuloConnectionDetails

use of org.apache.rya.api.client.accumulo.AccumuloConnectionDetails in project incubator-rya by apache.

the class SharedShellStateTest method ConnectedToInstanceAgain.

@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).setAccumuloDetails(connectionDetails).setConnectedCommands(connectedCommands).setRyaInstanceName("secondInstance").build();
    assertEquals(expected, state.getShellState());
}
Also used : AccumuloConnectionDetails(org.apache.rya.api.client.accumulo.AccumuloConnectionDetails) ShellState(org.apache.rya.shell.SharedShellState.ShellState) RyaClient(org.apache.rya.api.client.RyaClient) Test(org.junit.Test)

Aggregations

AccumuloConnectionDetails (org.apache.rya.api.client.accumulo.AccumuloConnectionDetails)17 RyaClient (org.apache.rya.api.client.RyaClient)15 Test (org.junit.Test)8 Connector (org.apache.accumulo.core.client.Connector)5 MiniAccumuloCluster (org.apache.accumulo.minicluster.MiniAccumuloCluster)4 ShellState (org.apache.rya.shell.SharedShellState.ShellState)4 Instance (org.apache.accumulo.core.client.Instance)3 File (java.io.File)2 MiniAccumuloConfig (org.apache.accumulo.minicluster.MiniAccumuloConfig)2 AccumuloRdfConfiguration (org.apache.rya.accumulo.AccumuloRdfConfiguration)2 Sail (org.openrdf.sail.Sail)2 CliCommand (org.springframework.shell.core.annotation.CliCommand)2 IOException (java.io.IOException)1 AccumuloException (org.apache.accumulo.core.client.AccumuloException)1 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)1 ZooKeeperInstance (org.apache.accumulo.core.client.ZooKeeperInstance)1 PasswordToken (org.apache.accumulo.core.client.security.tokens.PasswordToken)1 Authorizations (org.apache.accumulo.core.security.Authorizations)1 AlreadyInitializedException (org.apache.fluo.api.client.FluoAdmin.AlreadyInitializedException)1 TableExistsException (org.apache.fluo.api.client.FluoAdmin.TableExistsException)1