ResourceUtils { public static File findInstanceResourcesDirectory( File applicationFilesDirectory, Instance instance ) { return findInstanceResourcesDirectory( applicationFilesDirectory, instance.getComponent()); } 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 testFindInstanceResourcesDirectory_success() throws Exception { final File appDir = this.folder.newFolder(); final Component c1 = new Component( "c1" ); final Component c2 = new Component( "c2" ); final File expectedFile = new File( appDir, Constants.PROJECT_DIR_GRAPH + File.separator + c1.getName()); Assert.assertEquals( expectedFile, ResourceUtils.findInstanceResourcesDirectory( appDir, c1 )); Assert.assertNotSame( expectedFile, ResourceUtils.findInstanceResourcesDirectory( appDir, c2 )); c2.extendComponent( c1 ); Assert.assertEquals( expectedFile, ResourceUtils.findInstanceResourcesDirectory( appDir, c2 )); Instance instance = new Instance( "whatever" ).component( c2 ); Assert.assertEquals( expectedFile, ResourceUtils.findInstanceResourcesDirectory( appDir, instance )); }