Search in sources :

Example 1 with ManualOperationParams

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: "));
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ManualOperationParams(org.locationtech.geowave.core.cli.parser.ManualOperationParams)

Example 2 with ManualOperationParams

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());
}
Also used : File(java.io.File) Date(java.util.Date) ManualOperationParams(org.locationtech.geowave.core.cli.parser.ManualOperationParams)

Example 3 with ManualOperationParams

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.
}
Also used : File(java.io.File) Date(java.util.Date) ManualOperationParams(org.locationtech.geowave.core.cli.parser.ManualOperationParams)

Example 4 with ManualOperationParams

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());
}
Also used : MemoryStoreFactoryFamily(org.locationtech.geowave.core.store.memory.MemoryStoreFactoryFamily) ManualOperationParams(org.locationtech.geowave.core.cli.parser.ManualOperationParams) Before(org.junit.Before)

Example 5 with ManualOperationParams

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

Aggregations

ManualOperationParams (org.locationtech.geowave.core.cli.parser.ManualOperationParams)81 File (java.io.File)76 OperationParams (org.locationtech.geowave.core.cli.api.OperationParams)58 FieldDescriptor (com.google.protobuf.Descriptors.FieldDescriptor)57 StringResponseProtos (org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.StringResponseProtos)35 RepeatedStringResponseProtos (org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.RepeatedStringResponseProtos)27 VoidResponseProtos (org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.VoidResponseProtos)19 AddStoreCommand (org.locationtech.geowave.core.store.cli.store.AddStoreCommand)10 Test (org.junit.Test)7 IndexPluginOptions (org.locationtech.geowave.core.store.index.IndexPluginOptions)6 IndexStore (org.locationtech.geowave.core.store.index.IndexStore)6 Date (java.util.Date)5 IngestFormatPluginOptions (org.locationtech.geowave.core.ingest.operations.options.IngestFormatPluginOptions)4 ArrayList (java.util.ArrayList)3 LocalToGeoWaveCommand (org.locationtech.geowave.core.ingest.operations.LocalToGeoWaveCommand)3 IOException (java.io.IOException)2 Properties (java.util.Properties)2 Configuration (org.apache.hadoop.conf.Configuration)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 ResizeMRCommand (org.locationtech.geowave.adapter.raster.operations.ResizeMRCommand)2