Package org.opennms.core.test
Class ConfigurationTestUtils
- java.lang.Object
-
- org.junit.Assert
-
- org.opennms.core.test.ConfigurationTestUtils
-
public abstract class ConfigurationTestUtils extends org.junit.Assert
ConfigurationTestUtils class.
- Version:
- $Id: $
- Author:
- ranger
-
-
Constructor Summary
Constructors Constructor Description ConfigurationTestUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static String
getConfigForResourceWithReplacements(Object obj, String resource, String[]... replacements)
getConfigForResourceWithReplacementsstatic File
getDaemonEtcDirectory()
getDaemonEtcDirectorystatic File
getDaemonProjectDirectory()
getDaemonProjectDirectorystatic File
getFileForConfigFile(String configFile)
getFileForConfigFilestatic File
getFileForResource(Object obj, String resource)
getFileForResourcestatic InputStream
getInputStreamForConfigFile(String configFile)
getInputStreamForConfigFilestatic InputStream
getInputStreamForResource(Object obj, String resource)
getInputStreamForResourcestatic InputStream
getInputStreamForResource(String resource)
getInputStreamForResourcestatic InputStream
getInputStreamForResourceWithReplacements(Object obj, String resource, String[]... replacements)
getInputStreamForResourceWithReplacementsstatic Reader
getReaderForConfigFile(String configFile)
Use getInputStreamForConfigFile instead.static Reader
getReaderForResource(Object obj, String resource)
Deprecated.Use getInputStreamForResource instead.static Reader
getReaderForResourceWithReplacements(Object obj, String resource, String[]... replacements)
getReaderForResourceWithReplacementsstatic org.springframework.core.io.Resource
getResourceForConfigWithReplacements(String config, String[]... replacements)
getInputStreamForResourceWithReplacementsstatic org.springframework.core.io.Resource
getSpringResourceForResource(Object obj, String resource)
getSpringResourceForResourcestatic org.springframework.core.io.Resource
getSpringResourceForResourceWithReplacements(Object obj, String resource, String[]... replacements)
static File
getTopProjectDirectory()
getTopProjectDirectorystatic URL
getUrlForResource(Object obj, String resource)
getUrlForResourcestatic String
performReplacements(String newConfig, String[]... replacements)
static void
setAbsoluteHomeDirectory(String absoluteHomeDirectory)
setAbsoluteHomeDirectorystatic void
setRelativeForeignSourceDirectory(String relativeForeignSourceDirectory)
setRelativeForeignSourceDirectorystatic void
setRelativeHomeDirectory(String relativeHomeDirectory)
setRelativeHomeDirectorystatic void
setRelativeImporterDirectory(String relativeImporterDirectory)
setRelativeImporterDirectorystatic void
setRelativeRrdBaseDirectory(String relativePath)
setRelativeRrdBaseDirectorystatic void
setRrdBinary(String path)
setRrdBinary-
Methods inherited from class org.junit.Assert
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail
-
-
-
-
Method Detail
-
getUrlForResource
public static URL getUrlForResource(Object obj, String resource)
getUrlForResource
-
getSpringResourceForResource
public static org.springframework.core.io.Resource getSpringResourceForResource(Object obj, String resource)
getSpringResourceForResource
-
getSpringResourceForResourceWithReplacements
public static org.springframework.core.io.Resource getSpringResourceForResourceWithReplacements(Object obj, String resource, String[]... replacements) throws IOException
- Throws:
IOException
-
getFileForResource
public static File getFileForResource(Object obj, String resource)
getFileForResource
-
getReaderForResource
public static Reader getReaderForResource(Object obj, String resource)
Deprecated.Use getInputStreamForResource instead.
-
getInputStreamForResource
public static InputStream getInputStreamForResource(Object obj, String resource)
getInputStreamForResource
- Parameters:
obj
- aObject
object.resource
- aString
object.- Returns:
- a
InputStream
object.
-
getInputStreamForResource
public static InputStream getInputStreamForResource(String resource)
getInputStreamForResource
- Parameters:
resource
- aString
object.- Returns:
- a
InputStream
object.
-
getReaderForResourceWithReplacements
public static Reader getReaderForResourceWithReplacements(Object obj, String resource, String[]... replacements) throws IOException
getReaderForResourceWithReplacements
- Parameters:
obj
- aObject
object.resource
- aString
object.replacements
- an array ofString
objects.- Returns:
- a
Reader
object. - Throws:
IOException
- if any.
-
getInputStreamForResourceWithReplacements
public static InputStream getInputStreamForResourceWithReplacements(Object obj, String resource, String[]... replacements) throws IOException
getInputStreamForResourceWithReplacements
- Parameters:
obj
- aObject
object.resource
- aString
object.replacements
- an array ofString
objects.- Returns:
- a
InputStream
object. - Throws:
IOException
- if any.
-
getResourceForConfigWithReplacements
public static org.springframework.core.io.Resource getResourceForConfigWithReplacements(String config, String[]... replacements)
getInputStreamForResourceWithReplacements
- Parameters:
config
- aString
config file contents.replacements
- an array ofString
objects.- Returns:
- a
InputStream
object. - Throws:
IOException
- if any.
-
getConfigForResourceWithReplacements
public static String getConfigForResourceWithReplacements(Object obj, String resource, String[]... replacements) throws IOException
getConfigForResourceWithReplacements
- Parameters:
obj
- aObject
object.resource
- aString
object.replacements
- an array ofString
objects.- Returns:
- a
String
object. - Throws:
IOException
- if any.
-
performReplacements
public static String performReplacements(String newConfig, String[]... replacements)
-
getReaderForConfigFile
public static Reader getReaderForConfigFile(String configFile) throws FileNotFoundException
Use getInputStreamForConfigFile instead.- Parameters:
configFile
- aString
object.- Returns:
- a
Reader
object. - Throws:
FileNotFoundException
- if any.
-
getInputStreamForConfigFile
public static InputStream getInputStreamForConfigFile(String configFile) throws FileNotFoundException
getInputStreamForConfigFile
- Parameters:
configFile
- aString
object.- Returns:
- a
InputStream
object. - Throws:
FileNotFoundException
- if any.
-
getFileForConfigFile
public static File getFileForConfigFile(String configFile)
getFileForConfigFile
-
getDaemonEtcDirectory
public static File getDaemonEtcDirectory()
getDaemonEtcDirectory
- Returns:
- a
File
object.
-
setRelativeHomeDirectory
public static void setRelativeHomeDirectory(String relativeHomeDirectory)
setRelativeHomeDirectory
- Parameters:
relativeHomeDirectory
- aString
object.
-
setAbsoluteHomeDirectory
public static void setAbsoluteHomeDirectory(String absoluteHomeDirectory)
setAbsoluteHomeDirectory
- Parameters:
absoluteHomeDirectory
- aString
object.
-
getTopProjectDirectory
public static File getTopProjectDirectory()
getTopProjectDirectory
- Returns:
- a
File
object.
-
getDaemonProjectDirectory
public static File getDaemonProjectDirectory()
getDaemonProjectDirectory
- Returns:
- a
File
object.
-
setRrdBinary
public static void setRrdBinary(String path)
setRrdBinary
- Parameters:
path
- aString
object.
-
setRelativeRrdBaseDirectory
public static void setRelativeRrdBaseDirectory(String relativePath)
setRelativeRrdBaseDirectory
- Parameters:
relativePath
- aString
object.
-
setRelativeImporterDirectory
public static void setRelativeImporterDirectory(String relativeImporterDirectory)
setRelativeImporterDirectory
- Parameters:
relativeImporterDirectory
- aString
object.
-
-