@Test(expected = NullPointerException.class) public void shouldFailIfPathNotProvided() throws Exception { provider.getDB(FileDbProvider.TYPE_FILE, new BasicDocument()); }
@Override public FileDb getDB( String type, Document configuration ) { if (TYPE_MEM.equalsIgnoreCase(type)) { LOGGER.debug("Returning new in-memory schematic DB..."); return FileDb.inMemory(configuration.getBoolean(COMPRESS_FIELD, false)); } else if (TYPE_FILE.equalsIgnoreCase(type)) { boolean compress = configuration.getBoolean(COMPRESS_FIELD, true); String path = configuration.getString(PATH_FIELD, null); LOGGER.debug("Returning new disk schematic DB at {0}...", path); return FileDb.onDisk(compress, path); } return null; }
FileDbProvider implements SchematicDbProvider<FileDb> { @Override public FileDb getDB( String type, Document configuration ) { if (TYPE_MEM.equalsIgnoreCase(type)) { LOGGER.debug("Returning new in-memory schematic DB..."); return FileDb.inMemory(configuration.getBoolean(COMPRESS_FIELD, false)); } else if (TYPE_FILE.equalsIgnoreCase(type)) { boolean compress = configuration.getBoolean(COMPRESS_FIELD, true); String path = configuration.getString(PATH_FIELD, null); LOGGER.debug("Returning new disk schematic DB at {0}...", path); return FileDb.onDisk(compress, path); } return null; } }
FileDbProvider implements SchematicDbProvider<FileDb> { @Override public FileDb getDB( String type, Document configuration ) { if (TYPE_MEM.equalsIgnoreCase(type)) { LOGGER.debug("Returning new in-memory schematic DB..."); return FileDb.inMemory(configuration.getBoolean(COMPRESS_FIELD, false)); } else if (TYPE_FILE.equalsIgnoreCase(type)) { boolean compress = configuration.getBoolean(COMPRESS_FIELD, true); String path = configuration.getString(PATH_FIELD, null); LOGGER.debug("Returning new disk schematic DB at {0}...", path); return FileDb.onDisk(compress, path); } return null; }  }
FileDbProvider implements SchematicDbProvider<FileDb> { @Override public FileDb getDB( String type, Document configuration ) { if (TYPE_MEM.equalsIgnoreCase(type)) { LOGGER.debug("Returning new in-memory schematic DB..."); return FileDb.inMemory(configuration.getBoolean(COMPRESS_FIELD, false)); } else if (TYPE_FILE.equalsIgnoreCase(type)) { boolean compress = configuration.getBoolean(COMPRESS_FIELD, true); String path = configuration.getString(PATH_FIELD, null); LOGGER.debug("Returning new disk schematic DB at {0}...", path); return FileDb.onDisk(compress, path); } return null; }  @Override FileDb getDB( String type, Document configuration ); }
FileDbProvider implements SchematicDbProvider<FileDb> { @Override public FileDb getDB( String type, Document configuration ) { if (TYPE_MEM.equalsIgnoreCase(type)) { LOGGER.debug("Returning new in-memory schematic DB..."); return FileDb.inMemory(configuration.getBoolean(COMPRESS_FIELD, false)); } else if (TYPE_FILE.equalsIgnoreCase(type)) { boolean compress = configuration.getBoolean(COMPRESS_FIELD, true); String path = configuration.getString(PATH_FIELD, null); LOGGER.debug("Returning new disk schematic DB at {0}...", path); return FileDb.onDisk(compress, path); } return null; }  @Override FileDb getDB( String type, Document configuration ); static final String TYPE_MEM; static final String TYPE_FILE; static final String PATH_FIELD; static final String COMPRESS_FIELD; }