use of org.locationtech.geowave.core.cli.parser.ManualOperationParams in project geowave by locationtech.
the class AnalyzeRunnerTest method testExecute.
public void testExecute(final String providerName) throws Exception {
JAIExt.initJAIEXT();
final Sentinel2ImageryProvider provider = Sentinel2ImageryProvider.getProvider(providerName);
if (provider == null) {
throw new RuntimeException("Unable to find '" + providerName + "' Sentinel2 provider");
}
final Sentinel2BasicCommandLineOptions options = new Sentinel2BasicCommandLineOptions();
options.setWorkspaceDir(Tests.WORKSPACE_DIR);
options.setProviderName(providerName);
options.setCollection(provider.collections()[0]);
options.setLocation("T30TWM");
options.setStartDate(DateUtilities.parseISO("2018-01-28T00:00:00Z"));
options.setEndDate(DateUtilities.parseISO("2018-01-30T00:00:00Z"));
options.setCqlFilter("BBOX(shape,-1.8274,42.3253,-1.6256,42.4735) AND location='T30TWM' AND (band='B4' OR band='B8')");
new AnalyzeRunner(options).runInternal(new ManualOperationParams());
final String outputStr = new String(output.toByteArray());
// Scene information
assertThat(outputStr, containsString("Provider Name: "));
assertThat(outputStr, containsString("Acquisition Date: "));
assertThat(outputStr, containsString("Location: "));
assertThat(outputStr, containsString("Product Identifier: "));
assertThat(outputStr, containsString("Product Type: "));
assertThat(outputStr, containsString("Collection: "));
assertThat(outputStr, containsString("Platform: "));
assertThat(outputStr, containsString("Quicklook: "));
assertThat(outputStr, containsString("Thumbnail: "));
assertThat(outputStr, containsString("Cloud Cover: "));
assertThat(outputStr, containsString("Orbit Number: "));
assertThat(outputStr, containsString("Relative Orbit Number: "));
// Totals information
assertThat(outputStr, containsString("<-- Totals -->"));
assertThat(outputStr, containsString("Total Scenes: "));
assertThat(outputStr, containsString("Date Range: "));
assertThat(outputStr, containsString("Cloud Cover Range: "));
assertThat(outputStr, containsString("Average Cloud Cover: "));
assertThat(outputStr, containsString("Latitude Range: "));
assertThat(outputStr, containsString("Longitude Range: "));
assertThat(outputStr, containsString("Processing Levels: "));
}
use of org.locationtech.geowave.core.cli.parser.ManualOperationParams in project geowave by locationtech.
the class DownloadRunnerTest method testExecute.
public void testExecute(final String providerName, final File sceneDir) throws Exception {
JAIExt.initJAIEXT();
final Sentinel2ImageryProvider provider = Sentinel2ImageryProvider.getProvider(providerName);
if (provider == null) {
System.err.println("Unable to find '" + providerName + "' Sentinel2 provider. Check if it is properly setup.");
return;
}
if (!Tests.authenticationSettingsAreValid(providerName)) {
return;
}
final Date[] timePeriodSettings = Tests.timePeriodSettings(providerName);
final Date startDate = timePeriodSettings[0];
final Date endDate = timePeriodSettings[1];
final Sentinel2BasicCommandLineOptions analyzeOptions = new Sentinel2BasicCommandLineOptions();
analyzeOptions.setWorkspaceDir(Tests.WORKSPACE_DIR);
analyzeOptions.setProviderName(providerName);
analyzeOptions.setCollection(provider.collections()[0]);
analyzeOptions.setLocation("T30TXN");
analyzeOptions.setStartDate(startDate);
analyzeOptions.setEndDate(endDate);
analyzeOptions.setCqlFilter("BBOX(shape,-1.8274,42.3253,-1.6256,42.4735) AND location='T30TXN' AND (band='B4' OR band='B8')");
final String[] settings = Tests.authenticationSettings(providerName);
final String iden = settings[0];
final String pass = settings[1];
final Sentinel2DownloadCommandLineOptions downloadOptions = new Sentinel2DownloadCommandLineOptions();
downloadOptions.setOverwriteIfExists(false);
downloadOptions.setUserIdent(iden);
downloadOptions.setPassword(pass);
new DownloadRunner(analyzeOptions, downloadOptions).runInternal(new ManualOperationParams());
assertTrue("scenes directory exists", new File(Tests.WORKSPACE_DIR + "/scenes").isDirectory());
}
use of org.locationtech.geowave.core.cli.parser.ManualOperationParams in project geowave by locationtech.
the class VectorIngestRunnerTest method testIngest.
public void testIngest(final String providerName) throws Exception {
JAIExt.initJAIEXT();
final Sentinel2ImageryProvider provider = Sentinel2ImageryProvider.getProvider(providerName);
if (provider == null) {
throw new RuntimeException("Unable to find '" + providerName + "' Sentinel2 provider");
}
final Date[] timePeriodSettings = Tests.timePeriodSettings(providerName);
final Date startDate = timePeriodSettings[0];
final Date endDate = timePeriodSettings[1];
final Sentinel2BasicCommandLineOptions analyzeOptions = new Sentinel2BasicCommandLineOptions();
analyzeOptions.setWorkspaceDir(Tests.WORKSPACE_DIR);
analyzeOptions.setProviderName(providerName);
analyzeOptions.setCollection(provider.collections()[0]);
analyzeOptions.setLocation("T30TXN");
analyzeOptions.setStartDate(startDate);
analyzeOptions.setEndDate(endDate);
analyzeOptions.setCqlFilter("BBOX(shape,-1.8274,42.3253,-1.6256,42.4735) AND (band='B4' OR band='B8')");
final VectorIngestRunner runner = new VectorIngestRunner(analyzeOptions, Arrays.asList("memorystore", "spatialindex,spatempindex"));
final ManualOperationParams params = new ManualOperationParams();
params.getContext().put(ConfigOptions.PROPERTIES_FILE_CONTEXT, new File(VectorIngestRunnerTest.class.getClassLoader().getResource("geowave-config.properties").toURI()));
createIndices(params);
runner.runInternal(params);
try (CloseableIterator<Object> results = getStorePluginOptions(params).createDataStore().query(QueryBuilder.newBuilder().build())) {
assertTrue("Store is empty when it should have at least one result", results.hasNext());
}
// Not sure what assertions can be made about the indexes.
}
use of org.locationtech.geowave.core.cli.parser.ManualOperationParams in project geowave by locationtech.
the class ConfigCacheIT method before.
@Before
public void before() throws IOException {
configFile = File.createTempFile("test_config", null);
operationParams = new ManualOperationParams();
operationParams.getContext().put(ConfigOptions.PROPERTIES_FILE_CONTEXT, configFile);
GeoWaveStoreFinder.getRegisteredStoreFactoryFamilies().put("memory", new MemoryStoreFactoryFamily());
}
use of org.locationtech.geowave.core.cli.parser.ManualOperationParams 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.");
}
Aggregations