use of org.apache.rya.api.client.ListInstances in project incubator-rya by apache.
the class RyaAdminCommandsTest method listInstances.
@Test
public void listInstances() throws RyaClientException, IOException {
// Mock the object that performs the list operation.
final ListInstances mockListInstances = mock(ListInstances.class);
final List<String> instanceNames = Lists.newArrayList("a", "b", "c", "d");
when(mockListInstances.listInstances()).thenReturn(instanceNames);
final RyaClient mockCommands = mock(RyaClient.class);
when(mockCommands.getListInstances()).thenReturn(mockListInstances);
final SharedShellState state = new SharedShellState();
state.connectedToAccumulo(mock(AccumuloConnectionDetails.class), mockCommands);
state.connectedToInstance("b");
// Execute the command.
final RyaAdminCommands commands = new RyaAdminCommands(state, mock(InstallPrompt.class), mock(SparqlPrompt.class), mock(UninstallPrompt.class));
final String message = commands.listInstances();
// Verify a message is returned that lists the the instances.
final String expected = "Rya instance names:\n" + " a\n" + " * b\n" + " c\n" + " d\n";
assertEquals(expected, message);
}
use of org.apache.rya.api.client.ListInstances in project incubator-rya by apache.
the class MongoListInstancesIT method listInstances_hasRyaDetailsTable.
@Test
public void listInstances_hasRyaDetailsTable() throws MongoException, DuplicateInstanceNameException, RyaClientException {
// Install a few instances of Rya using the install command.
final RyaClient ryaClient = MongoRyaClientFactory.build(getConnectionDetails(), getMongoClient());
final Install install = ryaClient.getInstall();
install.install("instance1_", InstallConfiguration.builder().build());
install.install("instance2_", InstallConfiguration.builder().build());
install.install("instance3_", InstallConfiguration.builder().build());
// Fetch the list and verify it matches what is expected.
final ListInstances listInstances = new MongoListInstances(getMongoClient());
final List<String> instances = listInstances.listInstances();
Collections.sort(instances);
final List<String> expected = Lists.newArrayList("instance1_", "instance2_", "instance3_");
assertEquals(expected, instances);
}
use of org.apache.rya.api.client.ListInstances in project incubator-rya by apache.
the class AccumuloListInstancesIT method listInstances_hasRyaDetailsTable.
@Test
public void listInstances_hasRyaDetailsTable() throws AccumuloException, AccumuloSecurityException, RyaClientException {
// Install a few instances of Rya using the install command.
final AccumuloConnectionDetails connectionDetails = new AccumuloConnectionDetails(getUsername(), getPassword().toCharArray(), getInstanceName(), getZookeepers());
final Install install = new AccumuloInstall(connectionDetails, getConnector());
install.install("instance1_", InstallConfiguration.builder().build());
install.install("instance2_", InstallConfiguration.builder().build());
install.install("instance3_", InstallConfiguration.builder().build());
// Fetch the list and verify it matches what is expected.
final ListInstances listInstances = new AccumuloListInstances(connectionDetails, getConnector());
final List<String> instances = listInstances.listInstances();
Collections.sort(instances);
final List<String> expected = Lists.newArrayList("instance1_", "instance2_", "instance3_");
assertEquals(expected, instances);
}
Aggregations