@Test @Category(UnitTest.class) public void testCanOpenBadUri() throws Exception { String bad = "abcd:bad-name"; Assert.assertFalse("", factory.canOpen(bad, conf, providerProperties)); }
@Override public boolean canOpen(final String input, final Configuration conf, final ProviderProperties providerProperties) { if (input == null) { throw new NullPointerException("Cannot open null."); } if (input.startsWith(MrGeoAccumuloConstants.MRGEO_ACC_PREFIX)) { return true; } if (input.contains(":")) { return false; } String t = input; if (input.startsWith(MrGeoAccumuloConstants.MRGEO_ACC_PREFIX)) { t = input.replaceFirst(MrGeoAccumuloConstants.MRGEO_ACC_PREFIX, ""); } Properties oldProviderProperties = AccumuloUtils.providerPropertiesToProperties(providerProperties); try { ADPF_AllTables = AccumuloUtils.getListOfTables(oldProviderProperties); ADPF_ImageToTable = AccumuloUtils.getGeoTables(oldProviderProperties); log.info("Asked to open: " + input + " (" + t + ")"); return ADPF_AllTables.contains(t); } catch (DataProviderException e) { log.error("Failure in Accumulo MrsImage canOpen for input " + input, e); } return false; }
AccumuloMrsImageDataProviderFactory implements MrsImageDataProviderFactory { @Override public boolean canOpen(final String input, final Configuration conf, final ProviderProperties providerProperties) { if (input == null) { throw new NullPointerException("Cannot open null."); } if (input.startsWith(MrGeoAccumuloConstants.MRGEO_ACC_PREFIX)) { return true; } if (input.contains(":")) { return false; } String t = input; if (input.startsWith(MrGeoAccumuloConstants.MRGEO_ACC_PREFIX)) { t = input.replaceFirst(MrGeoAccumuloConstants.MRGEO_ACC_PREFIX, ""); } Properties oldProviderProperties = AccumuloUtils.providerPropertiesToProperties(providerProperties); try { ADPF_AllTables = AccumuloUtils.getListOfTables(oldProviderProperties); ADPF_ImageToTable = AccumuloUtils.getGeoTables(oldProviderProperties); log.info("Asked to open: " + input + " (" + t + ")"); return ADPF_AllTables.contains(t); } catch (DataProviderException e) { log.error("Failure in Accumulo MrsImage canOpen for input " + input, e); } return false; } }
AccumuloMrsImageDataProviderFactory implements MrsImageDataProviderFactory { @Override public boolean canOpen(final String input, final Configuration conf, final ProviderProperties providerProperties) { if (input == null) { throw new NullPointerException("Cannot open null."); } if (input.startsWith(MrGeoAccumuloConstants.MRGEO_ACC_PREFIX)) { return true; } if (input.contains(":")) { return false; } String t = input; if (input.startsWith(MrGeoAccumuloConstants.MRGEO_ACC_PREFIX)) { t = input.replaceFirst(MrGeoAccumuloConstants.MRGEO_ACC_PREFIX, ""); } Properties oldProviderProperties = AccumuloUtils.providerPropertiesToProperties(providerProperties); try { ADPF_AllTables = AccumuloUtils.getListOfTables(oldProviderProperties); ADPF_ImageToTable = AccumuloUtils.getGeoTables(oldProviderProperties); log.info("Asked to open: " + input + " (" + t + ")"); return ADPF_AllTables.contains(t); } catch (DataProviderException e) { log.error("Failure in Accumulo MrsImage canOpen for input " + input, e); } return false; } AccumuloMrsImageDataProviderFactory(); }
AccumuloMrsImageDataProviderFactory implements MrsImageDataProviderFactory { @Override public boolean canOpen(final String input, final Configuration conf, final ProviderProperties providerProperties) { if (input == null) { throw new NullPointerException("Cannot open null."); } if (input.startsWith(MrGeoAccumuloConstants.MRGEO_ACC_PREFIX)) { return true; } if (input.contains(":")) { return false; } String t = input; if (input.startsWith(MrGeoAccumuloConstants.MRGEO_ACC_PREFIX)) { t = input.replaceFirst(MrGeoAccumuloConstants.MRGEO_ACC_PREFIX, ""); } Properties oldProviderProperties = AccumuloUtils.providerPropertiesToProperties(providerProperties); try { ADPF_AllTables = AccumuloUtils.getListOfTables(oldProviderProperties); ADPF_ImageToTable = AccumuloUtils.getGeoTables(oldProviderProperties); log.info("Asked to open: " + input + " (" + t + ")"); return ADPF_AllTables.contains(t); } catch (DataProviderException e) { log.error("Failure in Accumulo MrsImage canOpen for input " + input, e); } return false; } AccumuloMrsImageDataProviderFactory(); @Override boolean isValid(); @Override void initialize(Configuration conf); @Override String getPrefix(); @Override Map<String, String> getConfiguration(); @Override void setConfiguration(Map<String, String> properties); @Override MrsImageDataProvider createTempMrsImageDataProvider(final Configuration conf,
                                                           ProviderProperties providerProperties); @Override MrsImageDataProvider createMrsImageDataProvider(final String input,
                                                       final Configuration conf,
                                                       final ProviderProperties providerProperties); @Override boolean canOpen(final String input,
                       final Configuration conf,
                       final ProviderProperties providerProperties); @Override String[] listImages(final Configuration conf,
                           final ProviderProperties providerProperties); @Override boolean canWrite(final String input,
                        final Configuration conf,
                        final ProviderProperties providerProperties); @Override boolean exists(final String input,
                      final Configuration conf,
                      final ProviderProperties providerProperties); @Override void delete(final String name,
                   final Configuration conf,
                   final ProviderProperties providerProperties); }
AccumuloMrsImageDataProviderFactory implements MrsImageDataProviderFactory { @Override public boolean canOpen(final String input, final Configuration conf, final ProviderProperties providerProperties) { if (input == null) { throw new NullPointerException("Cannot open null."); } if (input.startsWith(MrGeoAccumuloConstants.MRGEO_ACC_PREFIX)) { return true; } if (input.contains(":")) { return false; } String t = input; if (input.startsWith(MrGeoAccumuloConstants.MRGEO_ACC_PREFIX)) { t = input.replaceFirst(MrGeoAccumuloConstants.MRGEO_ACC_PREFIX, ""); } Properties oldProviderProperties = AccumuloUtils.providerPropertiesToProperties(providerProperties); try { ADPF_AllTables = AccumuloUtils.getListOfTables(oldProviderProperties); ADPF_ImageToTable = AccumuloUtils.getGeoTables(oldProviderProperties); log.info("Asked to open: " + input + " (" + t + ")"); return ADPF_AllTables.contains(t); } catch (DataProviderException e) { log.error("Failure in Accumulo MrsImage canOpen for input " + input, e); } return false; } AccumuloMrsImageDataProviderFactory(); @Override boolean isValid(); @Override void initialize(Configuration conf); @Override String getPrefix(); @Override Map<String, String> getConfiguration(); @Override void setConfiguration(Map<String, String> properties); @Override MrsImageDataProvider createTempMrsImageDataProvider(final Configuration conf,
                                                           ProviderProperties providerProperties); @Override MrsImageDataProvider createMrsImageDataProvider(final String input,
                                                       final Configuration conf,
                                                       final ProviderProperties providerProperties); @Override boolean canOpen(final String input,
                       final Configuration conf,
                       final ProviderProperties providerProperties); @Override String[] listImages(final Configuration conf,
                           final ProviderProperties providerProperties); @Override boolean canWrite(final String input,
                        final Configuration conf,
                        final ProviderProperties providerProperties); @Override boolean exists(final String input,
                      final Configuration conf,
                      final ProviderProperties providerProperties); @Override void delete(final String name,
                   final Configuration conf,
                   final ProviderProperties providerProperties);  }