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