DebugTestTemplate.java revision ce2e2c2c7126b18ccfce0fe69a3bfa2eafea68b7
/**
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2014-2015 ForgeRock AS.
*/
/**
* Unit test for DebugImpl.
*/
public class DebugTestTemplate {
//use the current test directory. You can modify it for debugging purpose
protected String debugDirectory;
private static int count = 0;
protected IDebugProvider provider;
protected DebugFileProviderForTest debugFileProvider;
SystemPropertiesManager.initializeProperties(DebugConstants.CONFIG_DEBUG_LEVEL, DEFAULT_DEBUG_LEVEL);
SystemPropertiesManager.initializeProperties(DebugConstants.CONFIG_DEBUG_MERGEALL, DEFAULT_MERGE_ALL);
SystemPropertiesManager.initializeProperties(DebugConstants.CONFIG_DEBUG_DIRECTORY, debugDirectory);
}
/**
* Initialize the debug provider
*
* @param debugConfigPath
*/
DebugConfigurationFromProperties debugConfig = new DebugConfigurationFromProperties(debugConfigPath);
}
/**
* Check the file status
*
* @param isCreated true if you want to check that the file exist, false for the contrary
* @param logName log file name
*/
return true;
}
});
}
}
}
/**
* Check if a file exist
*
* @param logName log file name
* @return
*/
return f.exists() && !f.isDirectory();
}
public void clean() throws IOException {
count++;
}
/**
* Delete a file
*
* @param file
* @throws IOException
*/
if (file.isDirectory()) {
//directory is empty, then delete it
} else {
//list all the directory contents
//construct the file structure
//recursive delete
}
//check the directory again, if empty then delete it
}
}
} else {
//if file, then delete it
}
}
protected void initializeProperties() {
}
}