Search in sources :

Example 11 with AccumuloConnectionDetails

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

the class RyaPromptProviderTest method isConnected_noInstanceName_Accumulo.

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

Example 12 with AccumuloConnectionDetails

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

the class SharedShellStateTest method connectedToInstance.

@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).setAccumuloDetails(connectionDetails).setConnectedCommands(connectedCommands).setRyaInstanceName("instance").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)

Example 13 with AccumuloConnectionDetails

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

the class SharedShellStateTest method disconnected.

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

Example 14 with AccumuloConnectionDetails

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

the class SharedShellStateTest method disconnectedToConnectedToStorage.

@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).setAccumuloDetails(connectionDetails).setConnectedCommands(connectedCommands).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)

Example 15 with AccumuloConnectionDetails

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

the class QueryBenchmarkRunIT method setup.

@BeforeClass
public static void setup() throws Exception {
    // Squash loud logs.
    Logger.getLogger(ClientCnxn.class).setLevel(Level.ERROR);
    // Setup the Mini Accumulo Cluster.
    final File miniDataDir = com.google.common.io.Files.createTempDir();
    final MiniAccumuloConfig cfg = new MiniAccumuloConfig(miniDataDir, ACCUMULO_PASSWORD);
    cluster = new MiniAccumuloCluster(cfg);
    cluster.start();
    // Create a Rya Client connected to the Mini Accumulo Cluster.
    final AccumuloConnectionDetails connDetails = new AccumuloConnectionDetails(ACCUMULO_USER, ACCUMULO_PASSWORD.toCharArray(), cluster.getInstanceName(), cluster.getZooKeepers());
    final Connector connector = cluster.getConnector(ACCUMULO_USER, ACCUMULO_PASSWORD);
    final RyaClient ryaClient = AccumuloRyaClientFactory.build(connDetails, connector);
    // Install an instance of Rya on the mini cluster.
    installRya(ryaClient);
    // Get a Sail object that is backed by the Rya store that is on the mini cluster.
    final AccumuloRdfConfiguration ryaConf = new AccumuloRdfConfiguration();
    ryaConf.setTablePrefix(RYA_INSTANCE_NAME);
    ryaConf.set(ConfigUtils.CLOUDBASE_USER, ACCUMULO_USER);
    ryaConf.set(ConfigUtils.CLOUDBASE_PASSWORD, ACCUMULO_PASSWORD);
    ryaConf.set(ConfigUtils.CLOUDBASE_ZOOKEEPERS, cluster.getZooKeepers());
    ryaConf.set(ConfigUtils.CLOUDBASE_INSTANCE, cluster.getInstanceName());
    ryaConf.set(ConfigUtils.USE_PCJ, "true");
    ryaConf.set(ConfigUtils.PCJ_STORAGE_TYPE, PrecomputedJoinStorageType.ACCUMULO.toString());
    ryaConf.set(ConfigUtils.PCJ_UPDATER_TYPE, PrecomputedJoinUpdaterType.NO_UPDATE.toString());
    sail = RyaSailFactory.getInstance(ryaConf);
    // Load some data into the cluster that will match the query we're testing against.
    loadTestStatements();
    // Add a PCJ to the application that summarizes the query.
    createTestPCJ(ryaClient);
}
Also used : Connector(org.apache.accumulo.core.client.Connector) AccumuloConnectionDetails(org.apache.rya.api.client.accumulo.AccumuloConnectionDetails) MiniAccumuloCluster(org.apache.accumulo.minicluster.MiniAccumuloCluster) MiniAccumuloConfig(org.apache.accumulo.minicluster.MiniAccumuloConfig) RyaClient(org.apache.rya.api.client.RyaClient) ClientCnxn(org.apache.zookeeper.ClientCnxn) File(java.io.File) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration) BeforeClass(org.junit.BeforeClass)

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