Search in sources :

Example 1 with ListInstances

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);
}
Also used : ListInstances(org.apache.rya.api.client.ListInstances) AccumuloConnectionDetails(org.apache.rya.api.client.accumulo.AccumuloConnectionDetails) SparqlPrompt(org.apache.rya.shell.util.SparqlPrompt) RyaClient(org.apache.rya.api.client.RyaClient) InstallPrompt(org.apache.rya.shell.util.InstallPrompt) UninstallPrompt(org.apache.rya.shell.util.UninstallPrompt) Test(org.junit.Test)

Example 2 with ListInstances

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

Example 3 with ListInstances

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);
}
Also used : ListInstances(org.apache.rya.api.client.ListInstances) Install(org.apache.rya.api.client.Install) Test(org.junit.Test)

Aggregations

ListInstances (org.apache.rya.api.client.ListInstances)3 Test (org.junit.Test)3 Install (org.apache.rya.api.client.Install)2 RyaClient (org.apache.rya.api.client.RyaClient)2 AccumuloConnectionDetails (org.apache.rya.api.client.accumulo.AccumuloConnectionDetails)1 InstallPrompt (org.apache.rya.shell.util.InstallPrompt)1 SparqlPrompt (org.apache.rya.shell.util.SparqlPrompt)1 UninstallPrompt (org.apache.rya.shell.util.UninstallPrompt)1