UserDataHelpers { static void interceptLoadingFiles( Properties props ) throws IOException { Logger logger = Logger.getLogger( UserDataHelpers.class.getName()); Set<String> keys = props.stringPropertyNames(); for( final String key : keys ) { if( ! key.startsWith( ENCODE_FILE_CONTENT_PREFIX )) continue; String realKey = key.substring( ENCODE_FILE_CONTENT_PREFIX.length()); String value = props.getProperty( realKey ); if( value == null ) { logger.fine( "No file was specified for " + realKey + ". Skipping it..." ); continue; } File f = new File( value ); if( ! f.exists()) throw new IOException( "File " + f + " was not found." ); ByteArrayOutputStream os = new ByteArrayOutputStream(); Utils.copyStream( f, os ); String encodedFileContent = encodeToBase64( os.toByteArray()); props.put( key, encodedFileContent ); } } private  UserDataHelpers(); static String writeUserDataAsString(
			Map<String,String> messagingConfiguration,
			String domain,
			String applicationName,
			String scopedInstancePath ); static Properties writeUserDataAsProperties(
			Map<String,String> messagingConfiguration,
			String domain,
			String applicationName,
			String scopedInstancePath ); static Properties readUserData( String rawProperties, File outputDirectory ); static Properties processUserData( Properties properties, File outputDirectory ); static final String SCOPED_INSTANCE_PATH; static final String APPLICATION_NAME; static final String DOMAIN; static final String ENCODE_FILE_CONTENT_PREFIX; }
@Test( expected = IOException.class ) public void testInterceptLoadingFiles_inexistingFile() throws Exception { Properties props = new Properties(); props.put( "loc", "does/not/exist" ); props.put( UserDataHelpers.ENCODE_FILE_CONTENT_PREFIX + "loc", "" ); UserDataHelpers.interceptLoadingFiles( props ); }