use of org.apache.rya.api.client.RyaClient in project incubator-rya by apache.
the class AccumuloAddUserIT method addUserTwice.
/**
* Ensure nothing happens if you try to add a user that is already there.
*/
@Test
public void addUserTwice() throws Exception {
final String user = testInstance.createUniqueUser();
final SecurityOperations secOps = super.getConnector().securityOperations();
final RyaClient userAClient = AccumuloRyaClientFactory.build(new AccumuloConnectionDetails(ADMIN_USER, ADMIN_USER.toCharArray(), getInstanceName(), getZookeepers()), super.getClusterInstance().getCluster().getConnector(ADMIN_USER, ADMIN_USER));
// Create the user that will not be added to the instance of Rya, but will try to scan it.
secOps.createLocalUser(user, new PasswordToken(user));
// Install the instance of Rya.
userAClient.getInstall().install(getRyaInstanceName(), InstallConfiguration.builder().build());
// Add the user.
userAClient.getAddUser().get().addUser(getRyaInstanceName(), user);
userAClient.getAddUser().get().addUser(getRyaInstanceName(), user);
// Ensure the Rya instance's details only contain the username of the user who installed the instance.
final ImmutableList<String> expectedUsers = ImmutableList.<String>builder().add(ADMIN_USER).add(user).build();
final RyaDetails details = userAClient.getGetInstanceDetails().getDetails(getRyaInstanceName()).get();
assertEquals(expectedUsers, details.getUsers());
}
use of org.apache.rya.api.client.RyaClient in project incubator-rya by apache.
the class AccumuloSetRyaStreamsConfigurationIT method updatesRyaDetails.
@Test
public void updatesRyaDetails() throws Exception {
final String ryaInstance = getRyaInstanceName();
final AccumuloConnectionDetails connectionDetails = new AccumuloConnectionDetails(getUsername(), getPassword().toCharArray(), getInstanceName(), getZookeepers());
final RyaClient ryaClient = AccumuloRyaClientFactory.build(connectionDetails, getConnector());
// Install an instance of Rya.
final Install installRya = ryaClient.getInstall();
final InstallConfiguration installConf = InstallConfiguration.builder().build();
installRya.install(ryaInstance, installConf);
// Fetch its details and show they do not have any RyaStreamsDetails.
com.google.common.base.Optional<RyaStreamsDetails> streamsDetails = ryaClient.getGetInstanceDetails().getDetails(ryaInstance).get().getRyaStreamsDetails();
assertFalse(streamsDetails.isPresent());
// Set the details.
final RyaStreamsDetails details = new RyaStreamsDetails("localhost", 6);
ryaClient.getSetRyaStreamsConfiguration().setRyaStreamsConfiguration(ryaInstance, details);
// Fetch its details again and show that they are now filled in.
streamsDetails = ryaClient.getGetInstanceDetails().getDetails(ryaInstance).get().getRyaStreamsDetails();
assertEquals(details, streamsDetails.get());
}
use of org.apache.rya.api.client.RyaClient in project incubator-rya by apache.
the class AccumuloSetRyaStreamsConfigurationIT method instanceDoesNotExist.
@Test(expected = InstanceDoesNotExistException.class)
public void instanceDoesNotExist() throws Exception {
final String ryaInstance = getRyaInstanceName();
final AccumuloConnectionDetails connectionDetails = new AccumuloConnectionDetails(getUsername(), getPassword().toCharArray(), getInstanceName(), getZookeepers());
final RyaClient ryaClient = AccumuloRyaClientFactory.build(connectionDetails, getConnector());
// Skip the install step to create error causing situation.
final RyaStreamsDetails details = new RyaStreamsDetails("localhost", 6);
ryaClient.getSetRyaStreamsConfiguration().setRyaStreamsConfiguration(ryaInstance, details);
}
use of org.apache.rya.api.client.RyaClient in project incubator-rya by apache.
the class MongoInstallIT method install_alreadyExists.
@Test(expected = DuplicateInstanceNameException.class)
public void install_alreadyExists() throws DuplicateInstanceNameException, RyaClientException {
// Install an instance of Rya.
final String instanceName = conf.getRyaInstanceName();
final InstallConfiguration installConfig = InstallConfiguration.builder().build();
final MongoConnectionDetails connectionDetails = getConnectionDetails();
final RyaClient ryaClient = MongoRyaClientFactory.build(connectionDetails, getMongoClient());
final Install install = ryaClient.getInstall();
install.install(instanceName, installConfig);
// Install it again throws expected error.
install.install(instanceName, installConfig);
}
use of org.apache.rya.api.client.RyaClient in project incubator-rya by apache.
the class MongoInstallIT method install_withAllIndexers.
@Test
public void install_withAllIndexers() throws DuplicateInstanceNameException, RyaClientException {
// Install an instance of Rya.
final String ryaInstance = conf.getMongoDBName();
// Setup the connection details that were used for the embedded Mongo DB instance we are testing with.
final MongoConnectionDetails connectionDetails = getConnectionDetails();
// Check that the instance does not exist.
final InstanceExists instanceExists = new MongoInstanceExists(getMongoClient());
assertFalse(instanceExists.exists(ryaInstance));
// Install an instance of Rya with all the valid options turned on.
final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(true).setEnableFreeTextIndex(true).setEnableTemporalIndex(true).setEnableEntityCentricIndex(true).setEnableGeoIndex(true).setEnablePcjIndex(true).build();
final RyaClient ryaClient = MongoRyaClientFactory.build(connectionDetails, getMongoClient());
final Install install = ryaClient.getInstall();
install.install(ryaInstance, installConfig);
// Check that the instance exists.
assertTrue(instanceExists.exists(ryaInstance));
// Show that the expected collections were created within the database.
final List<String> expected = Arrays.asList(INSTANCE_DETAILS_COLLECTION_NAME, "rya_triples");
int count = 0;
final List<String> found = new ArrayList<>();
for (final String collection : getMongoClient().getDatabase(conf.getMongoDBName()).listCollectionNames()) {
count += expected.contains(collection) ? 1 : 0;
found.add(collection);
}
assertTrue("Tables missing from:" + expected + " actual:" + found, expected.size() == count);
assertTrue("Instance should exist.", instanceExists.exists(ryaInstance));
}
Aggregations