ResourceUtils { public static Map<Component,File> findScopedInstancesDirectories( AbstractApplication absApp ) { Map<Component,File> result = new HashMap<> (); for( Component c : ComponentHelpers.findAllComponents( absApp.getGraphs())) { if( ! ComponentHelpers.isTarget( c )) continue; File dir = ResourceUtils.findInstanceResourcesDirectory( absApp.getDirectory(), c ); if( ! dir.exists()) continue; result.put( c, dir ); } return result; } private  ResourceUtils(); static Map<String,byte[]> storeInstanceResources( File applicationFilesDirectory, Instance instance ); static Map<String,byte[]> storeInstanceProbeResources( File applicationFilesDirectory, Instance instance ); static File findInstanceResourcesDirectory( File applicationFilesDirectory, Instance instance ); static File findInstanceResourcesDirectory( File applicationFilesDirectory, Component component ); static Map<Component,File> findScopedInstancesDirectories( AbstractApplication absApp );  }
@Test public void testFindScopedInstancesDirectories() throws Exception { final File appDir = this.folder.newFolder(); TestApplication app = new TestApplication(); app.setDirectory( appDir ); Assert.assertEquals( 0, ResourceUtils.findScopedInstancesDirectories( app ).size()); File vmDir = new File( appDir, Constants.PROJECT_DIR_GRAPH + "/" + app.getMySqlVm().getComponent().getName()); Assert.assertTrue( vmDir.mkdirs()); Map<Component,File> map = ResourceUtils.findScopedInstancesDirectories( app ); Assert.assertEquals( 1, map.size()); Assert.assertEquals( vmDir, map.get( app.getMySqlVm().getComponent())); }