Search in sources :

Example 1 with AccumuloStoreTestEnvironment

use of org.locationtech.geowave.test.AccumuloStoreTestEnvironment in project geowave by locationtech.

the class MapReduceIT method testIngestOSMPBF.

@Test
public void testIngestOSMPBF() throws Exception {
    TestUtils.deleteAll(dataStoreOptions);
    // NOTE: This will probably fail unless you bump up the memory for the
    // tablet
    // servers, for whatever reason, using the
    // miniAccumuloConfig.setMemory() function.
    final MapReduceTestEnvironment mrEnv = MapReduceTestEnvironment.getInstance();
    // TODO: for now this only works with accumulo, generalize the data
    // store usage
    final AccumuloStoreTestEnvironment accumuloEnv = AccumuloStoreTestEnvironment.getInstance();
    final String hdfsPath = mrEnv.getHdfsBaseDirectory() + "/osm_stage/";
    final StageOSMToHDFSCommand stage = new StageOSMToHDFSCommand();
    stage.setParameters(TEST_DATA_BASE_DIR, hdfsPath);
    stage.execute(mrEnv.getOperationParams());
    final Connector conn = new ZooKeeperInstance(accumuloEnv.getAccumuloInstance(), accumuloEnv.getZookeeper()).getConnector(accumuloEnv.getAccumuloUser(), new PasswordToken(accumuloEnv.getAccumuloPassword()));
    final Authorizations auth = new Authorizations(new String[] { "public" });
    conn.securityOperations().changeUserAuthorizations(accumuloEnv.getAccumuloUser(), auth);
    final IngestOSMToGeoWaveCommand ingest = new IngestOSMToGeoWaveCommand();
    ingest.setParameters(hdfsPath, "test-store");
    final AddStoreCommand addStore = new AddStoreCommand();
    addStore.setParameters("test-store");
    addStore.setPluginOptions(dataStoreOptions);
    addStore.execute(mrEnv.getOperationParams());
    ingest.getIngestOptions().setJobName("ConversionTest");
    // Execute for node's ways, and relations.
    ingest.getIngestOptions().setMapperType("NODE");
    ingest.execute(mrEnv.getOperationParams());
    System.out.println("finished accumulo ingest Node");
    ingest.getIngestOptions().setMapperType("WAY");
    ingest.execute(mrEnv.getOperationParams());
    System.out.println("finished accumulo ingest Way");
    ingest.getIngestOptions().setMapperType("RELATION");
    ingest.execute(mrEnv.getOperationParams());
    System.out.println("finished accumulo ingest Relation");
}
Also used : Connector(org.apache.accumulo.core.client.Connector) StageOSMToHDFSCommand(org.locationtech.geowave.cli.osm.operations.StageOSMToHDFSCommand) PasswordToken(org.apache.accumulo.core.client.security.tokens.PasswordToken) Authorizations(org.apache.accumulo.core.security.Authorizations) IngestOSMToGeoWaveCommand(org.locationtech.geowave.cli.osm.operations.IngestOSMToGeoWaveCommand) MapReduceTestEnvironment(org.locationtech.geowave.test.mapreduce.MapReduceTestEnvironment) AddStoreCommand(org.locationtech.geowave.core.store.cli.store.AddStoreCommand) AccumuloStoreTestEnvironment(org.locationtech.geowave.test.AccumuloStoreTestEnvironment) ZooKeeperInstance(org.apache.accumulo.core.client.ZooKeeperInstance) Test(org.junit.Test)

Aggregations

Connector (org.apache.accumulo.core.client.Connector)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 Test (org.junit.Test)1 IngestOSMToGeoWaveCommand (org.locationtech.geowave.cli.osm.operations.IngestOSMToGeoWaveCommand)1 StageOSMToHDFSCommand (org.locationtech.geowave.cli.osm.operations.StageOSMToHDFSCommand)1 AddStoreCommand (org.locationtech.geowave.core.store.cli.store.AddStoreCommand)1 AccumuloStoreTestEnvironment (org.locationtech.geowave.test.AccumuloStoreTestEnvironment)1 MapReduceTestEnvironment (org.locationtech.geowave.test.mapreduce.MapReduceTestEnvironment)1