@Test public void test_validateDirectory_Exists() throws IOException { File tempDirectory = new File(System.getProperty("java.io.tmpdir")); MongoSchemaFileStore.validateDirectory(tempDirectory); }
static void validateDirectory(File file) throws IOException { if (!file.exists() && !file.mkdirs()) { throw new IOException( "Schema store directory does not exist and could not be created: " + file.getAbsolutePath()); } if (file.isDirectory()) { if (!File.createTempFile("test", ".tmp", file).delete()) { throw new IOException( "Unable to write to schema store directory: " + file.getAbsolutePath()); } } else { throw new IOException( "Specified schema store directory exists but is not a directory: " + file.getAbsolutePath()); } }
MongoSchemaFileStore implements MongoSchemaStore { static void validateDirectory(File file) throws IOException { if (!file.exists() && !file.mkdirs()) { throw new IOException( "Schema store directory does not exist and could not be created: " + file.getAbsolutePath()); } if (file.isDirectory()) { if (!File.createTempFile("test", ".tmp", file).delete()) { throw new IOException( "Unable to write to schema store directory: " + file.getAbsolutePath()); } } else { throw new IOException( "Specified schema store directory exists but is not a directory: " + file.getAbsolutePath()); } } }
MongoSchemaFileStore implements MongoSchemaStore { static void validateDirectory(File file) throws IOException { if (!file.exists() && !file.mkdirs()) { throw new IOException( "Schema store directory does not exist and could not be created: " + file.getAbsolutePath()); } if (file.isDirectory()) { if (!File.createTempFile("test", ".tmp", file).delete()) { throw new IOException( "Unable to write to schema store directory: " + file.getAbsolutePath()); } } else { throw new IOException( "Specified schema store directory exists but is not a directory: " + file.getAbsolutePath()); } } MongoSchemaFileStore(String uri);  MongoSchemaFileStore(URI uri);  MongoSchemaFileStore(File file); }
MongoSchemaFileStore implements MongoSchemaStore { static void validateDirectory(File file) throws IOException { if (!file.exists() && !file.mkdirs()) { throw new IOException( "Schema store directory does not exist and could not be created: " + file.getAbsolutePath()); } if (file.isDirectory()) { if (!File.createTempFile("test", ".tmp", file).delete()) { throw new IOException( "Unable to write to schema store directory: " + file.getAbsolutePath()); } } else { throw new IOException( "Specified schema store directory exists but is not a directory: " + file.getAbsolutePath()); } } MongoSchemaFileStore(String uri);  MongoSchemaFileStore(URI uri);  MongoSchemaFileStore(File file); @Override void storeSchema(SimpleFeatureType schema); @Override SimpleFeatureType retrieveSchema(Name name); @Override void deleteSchema(Name name); @Override List<String> typeNames(); @Override void close(); }
MongoSchemaFileStore implements MongoSchemaStore { static void validateDirectory(File file) throws IOException { if (!file.exists() && !file.mkdirs()) { throw new IOException( "Schema store directory does not exist and could not be created: " + file.getAbsolutePath()); } if (file.isDirectory()) { if (!File.createTempFile("test", ".tmp", file).delete()) { throw new IOException( "Unable to write to schema store directory: " + file.getAbsolutePath()); } } else { throw new IOException( "Specified schema store directory exists but is not a directory: " + file.getAbsolutePath()); } } MongoSchemaFileStore(String uri);  MongoSchemaFileStore(URI uri);  MongoSchemaFileStore(File file); @Override void storeSchema(SimpleFeatureType schema); @Override SimpleFeatureType retrieveSchema(Name name); @Override void deleteSchema(Name name); @Override List<String> typeNames(); @Override void close();  }