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)));
}
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);
}
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);
}
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());
}
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());
}
Aggregations