Search in sources :

Example 1 with CopyCommand

use of org.locationtech.geowave.mapreduce.operations.CopyCommand in project geowave by locationtech.

the class StoreCopyIT method testStoreCopy.

@Test
public void testStoreCopy() throws Exception {
    // Load some test data
    LOGGER.warn("Loading input data...");
    TestUtils.testLocalIngest(inputDataStorePluginOptions, DimensionalityType.SPATIAL, HAIL_SHAPEFILE_FILE, 1);
    LOGGER.warn("Querying input data...");
    // Query the input store
    try {
        testQuery(new File(TEST_BOX_FILTER_FILE).toURI().toURL(), new URL[] { new File(HAIL_EXPECTED_BOX_FILTER_RESULTS_FILE).toURI().toURL() }, TestUtils.DEFAULT_SPATIAL_INDEX, "bounding box constraint only");
    } catch (final Exception e) {
        e.printStackTrace();
        TestUtils.deleteAll(inputDataStorePluginOptions);
        Assert.fail("Error occurred while querying the input store: '" + e.getLocalizedMessage() + "'");
    }
    LOGGER.warn("Execute storecopy job...");
    try {
        final MapReduceTestEnvironment env = MapReduceTestEnvironment.getInstance();
        // Set up the copy command
        final CopyCommand command = new CopyCommand();
        final File configFile = File.createTempFile("test_stats", null);
        final ManualOperationParams params = new ManualOperationParams();
        params.getContext().put(ConfigOptions.PROPERTIES_FILE_CONTEXT, configFile);
        final AddStoreCommand addStore = new AddStoreCommand();
        addStore.setParameters("test-store-in");
        addStore.setPluginOptions(inputDataStorePluginOptions);
        addStore.execute(params);
        addStore.setParameters("test-store-out");
        addStore.setPluginOptions(outputDataStorePluginOptions);
        addStore.execute(params);
        command.setParameters("test-store-in", "test-store-out");
        command.getOptions().setHdfsHostPort(env.getHdfs());
        command.getOptions().setJobTrackerOrResourceManHostPort(env.getJobtracker());
        command.getOptions().setMinSplits(MapReduceTestUtils.MIN_INPUT_SPLITS);
        command.getOptions().setMaxSplits(MapReduceTestUtils.MAX_INPUT_SPLITS);
        command.getOptions().setNumReducers(8);
        ToolRunner.run(command.createRunner(params), new String[] {});
    } catch (final Exception e) {
        e.printStackTrace();
        TestUtils.deleteAll(inputDataStorePluginOptions);
        Assert.fail("Error occurred while copying the datastore: '" + e.getLocalizedMessage() + "'");
    }
    LOGGER.warn("Querying output data...");
    // Query the copy store
    testOutput = true;
    try {
        testQuery(new File(TEST_BOX_FILTER_FILE).toURI().toURL(), new URL[] { new File(HAIL_EXPECTED_BOX_FILTER_RESULTS_FILE).toURI().toURL() }, TestUtils.DEFAULT_SPATIAL_INDEX, "bounding box constraint only");
    } catch (final Exception e) {
        e.printStackTrace();
        TestUtils.deleteAll(outputDataStorePluginOptions);
        Assert.fail("Error occurred while querying the output store: '" + e.getLocalizedMessage() + "'");
    }
    LOGGER.warn("Copy complete.");
}
Also used : CopyCommand(org.locationtech.geowave.mapreduce.operations.CopyCommand) AddStoreCommand(org.locationtech.geowave.core.store.cli.store.AddStoreCommand) File(java.io.File) ManualOperationParams(org.locationtech.geowave.core.cli.parser.ManualOperationParams) Test(org.junit.Test)

Example 2 with CopyCommand

use of org.locationtech.geowave.mapreduce.operations.CopyCommand in project geowave by locationtech.

the class StoreCopyJobRunner method main.

public static void main(final String[] args) throws Exception {
    final ConfigOptions opts = new ConfigOptions();
    final OperationParser parser = new OperationParser();
    parser.addAdditionalObject(opts);
    final CopyCommand command = new CopyCommand();
    final CommandLineOperationParams params = parser.parse(command, args);
    opts.prepare(params);
    final int res = ToolRunner.run(new Configuration(), command.createRunner(params), args);
    System.exit(res);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) CopyCommand(org.locationtech.geowave.mapreduce.operations.CopyCommand) CommandLineOperationParams(org.locationtech.geowave.core.cli.parser.CommandLineOperationParams) OperationParser(org.locationtech.geowave.core.cli.parser.OperationParser) ConfigOptions(org.locationtech.geowave.core.cli.operations.config.options.ConfigOptions)

Aggregations

CopyCommand (org.locationtech.geowave.mapreduce.operations.CopyCommand)2 File (java.io.File)1 Configuration (org.apache.hadoop.conf.Configuration)1 Test (org.junit.Test)1 ConfigOptions (org.locationtech.geowave.core.cli.operations.config.options.ConfigOptions)1 CommandLineOperationParams (org.locationtech.geowave.core.cli.parser.CommandLineOperationParams)1 ManualOperationParams (org.locationtech.geowave.core.cli.parser.ManualOperationParams)1 OperationParser (org.locationtech.geowave.core.cli.parser.OperationParser)1 AddStoreCommand (org.locationtech.geowave.core.store.cli.store.AddStoreCommand)1