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