@Test public void testStoreInstanceResources_notADirectory() throws Exception { final File appDir = this.folder.newFolder(); final String componentName = "my-component"; final File componentDirectory = new File( appDir, Constants.PROJECT_DIR_GRAPH + File.separator + componentName ); Assert.assertTrue( componentDirectory.getParentFile().mkdirs()); Assert.assertTrue( componentDirectory.createNewFile()); Instance instance = new Instance( "whatever" ).component( new Component( componentName )); Map<?,?> map = ResourceUtils.storeInstanceResources( appDir, instance ); Assert.assertEquals( 0, map.size()); }
public static Map<String,byte[]> storeInstanceResources( File applicationFilesDirectory, Instance instance ) throws IOException { Map<String,byte[]> result = new HashMap<> (); File instanceResourcesDirectory = findInstanceResourcesDirectory( applicationFilesDirectory, instance ); if( instanceResourcesDirectory.exists() && instanceResourcesDirectory.isDirectory()) result.putAll( Utils.storeDirectoryResourcesAsBytes( instanceResourcesDirectory )); result.putAll( storeInstanceProbeResources( applicationFilesDirectory, instance )); return result; }
ResourceUtils { public static Map<String,byte[]> storeInstanceResources( File applicationFilesDirectory, Instance instance ) throws IOException { Map<String,byte[]> result = new HashMap<> (); File instanceResourcesDirectory = findInstanceResourcesDirectory( applicationFilesDirectory, instance ); if( instanceResourcesDirectory.exists() && instanceResourcesDirectory.isDirectory()) result.putAll( Utils.storeDirectoryResourcesAsBytes( instanceResourcesDirectory )); result.putAll( storeInstanceProbeResources( applicationFilesDirectory, instance )); return result; } }
ResourceUtils { public static Map<String,byte[]> storeInstanceResources( File applicationFilesDirectory, Instance instance ) throws IOException { Map<String,byte[]> result = new HashMap<> (); File instanceResourcesDirectory = findInstanceResourcesDirectory( applicationFilesDirectory, instance ); if( instanceResourcesDirectory.exists() && instanceResourcesDirectory.isDirectory()) result.putAll( Utils.storeDirectoryResourcesAsBytes( instanceResourcesDirectory )); result.putAll( storeInstanceProbeResources( applicationFilesDirectory, instance )); return result; } private  ResourceUtils(); }
ResourceUtils { public static Map<String,byte[]> storeInstanceResources( File applicationFilesDirectory, Instance instance ) throws IOException { Map<String,byte[]> result = new HashMap<> (); File instanceResourcesDirectory = findInstanceResourcesDirectory( applicationFilesDirectory, instance ); if( instanceResourcesDirectory.exists() && instanceResourcesDirectory.isDirectory()) result.putAll( Utils.storeDirectoryResourcesAsBytes( instanceResourcesDirectory )); result.putAll( storeInstanceProbeResources( applicationFilesDirectory, instance )); 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 ); }
ResourceUtils { public static Map<String,byte[]> storeInstanceResources( File applicationFilesDirectory, Instance instance ) throws IOException { Map<String,byte[]> result = new HashMap<> (); File instanceResourcesDirectory = findInstanceResourcesDirectory( applicationFilesDirectory, instance ); if( instanceResourcesDirectory.exists() && instanceResourcesDirectory.isDirectory()) result.putAll( Utils.storeDirectoryResourcesAsBytes( instanceResourcesDirectory )); result.putAll( storeInstanceProbeResources( applicationFilesDirectory, instance )); 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 );  }