@Test @Category(UnitTest.class) public void testAssignBadDateRange() throws IOException, AccumuloSecurityException, AccumuloException { String strSettings = "startTime=2013-05-06T00:00:00.000+08:00;endTime=2013-05-05T00:00:00.000+08:00"; Map<String, String> settings = new TreeMap<String, String>(); GeoWaveVectorDataProvider.parseDataSourceSettings(strSettings, settings); String dataSource = "input"; GeoWaveVectorDataProvider provider = new GeoWaveVectorDataProvider(null, "geowave", dataSource, (ProviderProperties) null); try { provider.assignSettings("input", settings); Assert.fail("Expected exception for bad date format"); } catch (IOException e) { Assert.assertEquals("Unexpected exception message: " + e.getMessage(), e.getMessage(), "For GeoWave data source " + dataSource + ", startDate must be after endDate"); } }
void assignSettings(String name, Map<String, String> settings) throws IOException { filter = null; spatialConstraint = null; startTimeConstraint = null; endTimeConstraint = null; for (Map.Entry<String, String> entry : settings.entrySet()) { String keyName = entry.getKey(); if (keyName != null && !keyName.isEmpty()) { String value = entry.getValue(); switch (keyName) { case "spatial": { WKTReader wktReader = new WKTReader(); try { spatialConstraint = wktReader.read(value); } catch (ParseException e) { throw new IOException("Invalid WKT specified for spatial property of GeoWave data source " + name, e); } break; } case "startTime": { startTimeConstraint = parseDate(value); break; } case "endTime": { endTimeConstraint = parseDate(value); break; } case "cql": { if (value != null && !value.isEmpty()) { cqlFilter = value; try { filter = ECQL.toFilter(value); } catch (CQLException e) { throw new IOException("Bad CQL filter: " + value, e); } } break; } case "index": { requestedIndexName = value.trim(); break; } default: throw new IOException("Unrecognized setting for GeoWave data source " + name + ": " + keyName); } } } if ((startTimeConstraint == null) != (endTimeConstraint == null)) { throw new IOException("When querying a GeoWave data source by time," + " both the start and the end are required."); } if (startTimeConstraint != null && endTimeConstraint != null && startTimeConstraint.after(endTimeConstraint)) { throw new IOException("For GeoWave data source " + name + ", startDate must be after endDate"); } }
GeoWaveVectorDataProvider extends VectorDataProvider { void assignSettings(String name, Map<String, String> settings) throws IOException { filter = null; spatialConstraint = null; startTimeConstraint = null; endTimeConstraint = null; for (Map.Entry<String, String> entry : settings.entrySet()) { String keyName = entry.getKey(); if (keyName != null && !keyName.isEmpty()) { String value = entry.getValue(); switch (keyName) { case "spatial": { WKTReader wktReader = new WKTReader(); try { spatialConstraint = wktReader.read(value); } catch (ParseException e) { throw new IOException("Invalid WKT specified for spatial property of GeoWave data source " + name, e); } break; } case "startTime": { startTimeConstraint = parseDate(value); break; } case "endTime": { endTimeConstraint = parseDate(value); break; } case "cql": { if (value != null && !value.isEmpty()) { cqlFilter = value; try { filter = ECQL.toFilter(value); } catch (CQLException e) { throw new IOException("Bad CQL filter: " + value, e); } } break; } case "index": { requestedIndexName = value.trim(); break; } default: throw new IOException("Unrecognized setting for GeoWave data source " + name + ": " + keyName); } } } if ((startTimeConstraint == null) != (endTimeConstraint == null)) { throw new IOException("When querying a GeoWave data source by time," + " both the start and the end are required."); } if (startTimeConstraint != null && endTimeConstraint != null && startTimeConstraint.after(endTimeConstraint)) { throw new IOException("For GeoWave data source " + name + ", startDate must be after endDate"); } } }
GeoWaveVectorDataProvider extends VectorDataProvider { void assignSettings(String name, Map<String, String> settings) throws IOException { filter = null; spatialConstraint = null; startTimeConstraint = null; endTimeConstraint = null; for (Map.Entry<String, String> entry : settings.entrySet()) { String keyName = entry.getKey(); if (keyName != null && !keyName.isEmpty()) { String value = entry.getValue(); switch (keyName) { case "spatial": { WKTReader wktReader = new WKTReader(); try { spatialConstraint = wktReader.read(value); } catch (ParseException e) { throw new IOException("Invalid WKT specified for spatial property of GeoWave data source " + name, e); } break; } case "startTime": { startTimeConstraint = parseDate(value); break; } case "endTime": { endTimeConstraint = parseDate(value); break; } case "cql": { if (value != null && !value.isEmpty()) { cqlFilter = value; try { filter = ECQL.toFilter(value); } catch (CQLException e) { throw new IOException("Bad CQL filter: " + value, e); } } break; } case "index": { requestedIndexName = value.trim(); break; } default: throw new IOException("Unrecognized setting for GeoWave data source " + name + ": " + keyName); } } } if ((startTimeConstraint == null) != (endTimeConstraint == null)) { throw new IOException("When querying a GeoWave data source by time," + " both the start and the end are required."); } if (startTimeConstraint != null && endTimeConstraint != null && startTimeConstraint.after(endTimeConstraint)) { throw new IOException("For GeoWave data source " + name + ", startDate must be after endDate"); } } GeoWaveVectorDataProvider(Configuration conf, String inputPrefix, String input,
    ProviderProperties providerProperties); }
GeoWaveVectorDataProvider extends VectorDataProvider { void assignSettings(String name, Map<String, String> settings) throws IOException { filter = null; spatialConstraint = null; startTimeConstraint = null; endTimeConstraint = null; for (Map.Entry<String, String> entry : settings.entrySet()) { String keyName = entry.getKey(); if (keyName != null && !keyName.isEmpty()) { String value = entry.getValue(); switch (keyName) { case "spatial": { WKTReader wktReader = new WKTReader(); try { spatialConstraint = wktReader.read(value); } catch (ParseException e) { throw new IOException("Invalid WKT specified for spatial property of GeoWave data source " + name, e); } break; } case "startTime": { startTimeConstraint = parseDate(value); break; } case "endTime": { endTimeConstraint = parseDate(value); break; } case "cql": { if (value != null && !value.isEmpty()) { cqlFilter = value; try { filter = ECQL.toFilter(value); } catch (CQLException e) { throw new IOException("Bad CQL filter: " + value, e); } } break; } case "index": { requestedIndexName = value.trim(); break; } default: throw new IOException("Unrecognized setting for GeoWave data source " + name + ": " + keyName); } } } if ((startTimeConstraint == null) != (endTimeConstraint == null)) { throw new IOException("When querying a GeoWave data source by time," + " both the start and the end are required."); } if (startTimeConstraint != null && endTimeConstraint != null && startTimeConstraint.after(endTimeConstraint)) { throw new IOException("For GeoWave data source " + name + ", startDate must be after endDate"); } } GeoWaveVectorDataProvider(Configuration conf, String inputPrefix, String input,
    ProviderProperties providerProperties); static GeoWaveConnectionInfo getConnectionInfo(); static boolean isValid(Configuration conf); static boolean isValid(); static String[] listVectors(final ProviderProperties providerProperties); @SuppressWarnings("squid:S1166") // Exception caught and handled static boolean canOpen(String input,
    ProviderProperties providerProperties); static long getAdapterCount(ByteArrayId adapterId,
    String namespace,
    ProviderProperties providerProperties); AdapterStore getAdapterStore(); DataStore getDataStore(); DataStatisticsStore getStatisticsStore(); DataStorePluginOptions getDataStorePluginOptions(); PrimaryIndex getPrimaryIndex(); String getGeoWaveResourceName(); String getStoreName(); DataAdapter<?> getDataAdapter(); String getCqlFilter(); com.vividsolutions.jts.geom.Geometry getSpatialConstraint(); @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Used by trusted code") Date getStartTimeConstraint(); @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Used by trusted code") Date getEndTimeConstraint(); DistributableQuery getQuery(); QueryOptions getQueryOptions(ProviderProperties providerProperties); @Override VectorMetadataReader getMetadataReader(); @Override VectorMetadataWriter getMetadataWriter(); @Override VectorReader getVectorReader(); @Override VectorReader getVectorReader(VectorReaderContext context); @Override VectorWriter getVectorWriter(); @Override RecordReader<FeatureIdWritable, Geometry> getRecordReader(); @Override RecordWriter<FeatureIdWritable, Geometry> getRecordWriter(); @Override VectorInputFormatProvider getVectorInputFormatProvider(VectorInputFormatContext context); @Override VectorOutputFormatProvider getVectorOutputFormatProvider(VectorOutputFormatContext context); @Override void delete(); @Override void move(String toResource); }
GeoWaveVectorDataProvider extends VectorDataProvider { void assignSettings(String name, Map<String, String> settings) throws IOException { filter = null; spatialConstraint = null; startTimeConstraint = null; endTimeConstraint = null; for (Map.Entry<String, String> entry : settings.entrySet()) { String keyName = entry.getKey(); if (keyName != null && !keyName.isEmpty()) { String value = entry.getValue(); switch (keyName) { case "spatial": { WKTReader wktReader = new WKTReader(); try { spatialConstraint = wktReader.read(value); } catch (ParseException e) { throw new IOException("Invalid WKT specified for spatial property of GeoWave data source " + name, e); } break; } case "startTime": { startTimeConstraint = parseDate(value); break; } case "endTime": { endTimeConstraint = parseDate(value); break; } case "cql": { if (value != null && !value.isEmpty()) { cqlFilter = value; try { filter = ECQL.toFilter(value); } catch (CQLException e) { throw new IOException("Bad CQL filter: " + value, e); } } break; } case "index": { requestedIndexName = value.trim(); break; } default: throw new IOException("Unrecognized setting for GeoWave data source " + name + ": " + keyName); } } } if ((startTimeConstraint == null) != (endTimeConstraint == null)) { throw new IOException("When querying a GeoWave data source by time," + " both the start and the end are required."); } if (startTimeConstraint != null && endTimeConstraint != null && startTimeConstraint.after(endTimeConstraint)) { throw new IOException("For GeoWave data source " + name + ", startDate must be after endDate"); } } GeoWaveVectorDataProvider(Configuration conf, String inputPrefix, String input,
    ProviderProperties providerProperties); static GeoWaveConnectionInfo getConnectionInfo(); static boolean isValid(Configuration conf); static boolean isValid(); static String[] listVectors(final ProviderProperties providerProperties); @SuppressWarnings("squid:S1166") // Exception caught and handled static boolean canOpen(String input,
    ProviderProperties providerProperties); static long getAdapterCount(ByteArrayId adapterId,
    String namespace,
    ProviderProperties providerProperties); AdapterStore getAdapterStore(); DataStore getDataStore(); DataStatisticsStore getStatisticsStore(); DataStorePluginOptions getDataStorePluginOptions(); PrimaryIndex getPrimaryIndex(); String getGeoWaveResourceName(); String getStoreName(); DataAdapter<?> getDataAdapter(); String getCqlFilter(); com.vividsolutions.jts.geom.Geometry getSpatialConstraint(); @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Used by trusted code") Date getStartTimeConstraint(); @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Used by trusted code") Date getEndTimeConstraint(); DistributableQuery getQuery(); QueryOptions getQueryOptions(ProviderProperties providerProperties); @Override VectorMetadataReader getMetadataReader(); @Override VectorMetadataWriter getMetadataWriter(); @Override VectorReader getVectorReader(); @Override VectorReader getVectorReader(VectorReaderContext context); @Override VectorWriter getVectorWriter(); @Override RecordReader<FeatureIdWritable, Geometry> getRecordReader(); @Override RecordWriter<FeatureIdWritable, Geometry> getRecordWriter(); @Override VectorInputFormatProvider getVectorInputFormatProvider(VectorInputFormatContext context); @Override VectorOutputFormatProvider getVectorOutputFormatProvider(VectorOutputFormatContext context); @Override void delete(); @Override void move(String toResource);  }