@Test public void provisionLookup() throws IOException { String resourceDir = getResourceFile( "demo_credentials_user1.fdrp").getParent(); Provisioner p = new Provisioner(); List<File> files = p.findProvisionFilesInDir(new File(resourceDir)); List<String> expectedFilenames = Arrays.asList( "demo_credentials_user1.fdrp", "demo_credentials_user2.fdrp"); Assert.assertEquals(2, files.size()); for (File f : files) { Assert.assertTrue("unexpected file name " + f.getName(), expectedFilenames.contains(f.getName())); } }
List<File> findProvisionFilesInDir(File file) { if (file == null || !file.isDirectory()) { return Collections.emptyList(); } try { File[] files = file.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { if (name != null && name.endsWith(".fdrp")) { return true; } return false; } }); return files != null ? Arrays.asList(files) : null; } catch (Exception e) { Utils.debugLog(TAG, "can not search for provisions, can not access: " + file.getAbsolutePath(), e); return new ArrayList<>(); } }
Provisioner { List<File> findProvisionFilesInDir(File file) { if (file == null || !file.isDirectory()) { return Collections.emptyList(); } try { File[] files = file.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { if (name != null && name.endsWith(".fdrp")) { return true; } return false; } }); return files != null ? Arrays.asList(files) : null; } catch (Exception e) { Utils.debugLog(TAG, "can not search for provisions, can not access: " + file.getAbsolutePath(), e); return new ArrayList<>(); } } }
Provisioner { List<File> findProvisionFilesInDir(File file) { if (file == null || !file.isDirectory()) { return Collections.emptyList(); } try { File[] files = file.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { if (name != null && name.endsWith(".fdrp")) { return true; } return false; } }); return files != null ? Arrays.asList(files) : null; } catch (Exception e) { Utils.debugLog(TAG, "can not search for provisions, can not access: " + file.getAbsolutePath(), e); return new ArrayList<>(); } } protected  Provisioner(); }
Provisioner { List<File> findProvisionFilesInDir(File file) { if (file == null || !file.isDirectory()) { return Collections.emptyList(); } try { File[] files = file.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { if (name != null && name.endsWith(".fdrp")) { return true; } return false; } }); return files != null ? Arrays.asList(files) : null; } catch (Exception e) { Utils.debugLog(TAG, "can not search for provisions, can not access: " + file.getAbsolutePath(), e); return new ArrayList<>(); } } protected  Provisioner();  }
Provisioner { List<File> findProvisionFilesInDir(File file) { if (file == null || !file.isDirectory()) { return Collections.emptyList(); } try { File[] files = file.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { if (name != null && name.endsWith(".fdrp")) { return true; } return false; } }); return files != null ? Arrays.asList(files) : null; } catch (Exception e) { Utils.debugLog(TAG, "can not search for provisions, can not access: " + file.getAbsolutePath(), e); return new ArrayList<>(); } } protected  Provisioner();  static final String TAG; }