use of org.apache.rya.api.client.RyaClient in project incubator-rya by apache.
the class RyaAdminCommandsTest method createPCJ_cancelledPrompt.
@Test
public void createPCJ_cancelledPrompt() throws InstanceDoesNotExistException, RyaClientException, IOException {
// Mock the object that performs the create operation.
final String instanceName = "unitTest";
final RyaClient mockCommands = mock(RyaClient.class);
final SharedShellState state = new SharedShellState();
state.connectedToAccumulo(mock(AccumuloConnectionDetails.class), mockCommands);
state.connectedToInstance(instanceName);
final SparqlPrompt mockSparqlPrompt = mock(SparqlPrompt.class);
when(mockSparqlPrompt.getSparql()).thenReturn(Optional.absent());
// Execute the command.
final RyaAdminCommands commands = new RyaAdminCommands(state, mock(InstallPrompt.class), mockSparqlPrompt, mock(UninstallPrompt.class));
final String message = commands.createPcj(true, false);
// Verify a message is returned that explains what was created.
final String expected = "";
assertEquals(expected, message);
}
use of org.apache.rya.api.client.RyaClient 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.RyaClient 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.RyaClient 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.RyaClient 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