Package org.codice.ddf.itests.common
Class AbstractIntegrationTest
java.lang.Object
org.codice.ddf.itests.common.AbstractIntegrationTest
Abstract integration test with helper methods and configuration at the container level
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn enum that returns a port number based on the class variablebasePort.static classA class used to give a dynamicStringthat evaluates when called rather than at compile time.protected static classHelper Option class to allow interpolation ofkaraf.homedirectory based on the providedUNPACK_DIRECTORY.protected static classHelper Option class to allow interpolation ofkaraf.homedirectory based on the providedUNPACK_DIRECTORY.protected static classHelper Option class to allow interpolation ofkaraf.homedirectory based on the providedUNPACK_DIRECTORY. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AbstractIntegrationTest.DynamicUrlstatic final AbstractIntegrationTest.DynamicUrlstatic final AbstractIntegrationTest.DynamicPortprotected static Integerprotected org.osgi.framework.BundleContextprotected org.apache.karaf.bundle.core.BundleServiceprotected org.osgi.service.cm.ConfigurationAdminprotected KarafConsolestatic final AbstractIntegrationTest.DynamicUrlstatic final AbstractIntegrationTest.DynamicUrlstatic final Stringstatic final Stringprotected static final Stringstatic final AbstractIntegrationTest.DynamicUrlprotected static final Stringprotected static Stringprotected static final Stringstatic final AbstractIntegrationTest.DynamicPortprotected static final String[]protected org.apache.karaf.features.FeaturesServiceprotected static final Stringstatic final longstatic final longprotected static final Stringstatic final AbstractIntegrationTest.DynamicPortstatic final AbstractIntegrationTest.DynamicPortstatic final Stringprotected static final org.slf4j.Loggerprotected static final Stringprotected org.osgi.service.metatype.MetaTypeServicestatic final AbstractIntegrationTest.DynamicUrlprotected static final Stringorg.codice.ddf.test.common.annotations.PaxExamRuleprotected static ServerSocketstatic final Stringstatic final AbstractIntegrationTest.DynamicUrlstatic final Stringstatic final AbstractIntegrationTest.DynamicUrlorg.codice.ddf.test.common.annotations.ExamResultLoggerstatic final AbstractIntegrationTest.DynamicPortstatic final AbstractIntegrationTest.DynamicPortstatic final AbstractIntegrationTest.DynamicUrlprotected org.apache.karaf.shell.api.console.SessionFactorystatic final AbstractIntegrationTest.DynamicPortorg.junit.rules.Stopwatchprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidClears out the catalog and catalog cache of all 'resource' metacards.protected org.ops4j.pax.exam.Option[]combineOptions(org.ops4j.pax.exam.Option[]... options) Combines all theOptionobjects contained in multipleOptionarrays.org.ops4j.pax.exam.Option[]config()Configures the pax exam test containerprotected voidconfigureBundle(String bundleName, String pid, Dictionary<String, Object> properties) protected org.ops4j.pax.exam.Option[]protected org.ops4j.pax.exam.Option[]Allows extending classes to add any custom options to the configuration.protected org.ops4j.pax.exam.Option[]protected org.ops4j.pax.exam.Option[]protected org.ops4j.pax.exam.Option[]protected org.ops4j.pax.exam.Option[]protected org.ops4j.pax.exam.Option[]voidvoidconfigureRestForBasic(String whitelist) voidvoidconfigureRestForGuest(String whitelist) voidconfigureRestForSaml(String whitelist) protected org.ops4j.pax.exam.Option[]protected org.ops4j.pax.exam.Option[]protected org.ops4j.pax.exam.Option[]protected org.ops4j.pax.exam.Option[]createSetLogLevelOption(String name, String level) Creates options to add log configuration lines to the etc/org.ops4j.pax.logging.cfg file.protected AdminConfigprotected Integerprotected CatalogBundleprotected String[]static StringgetFileContent(String filePath) static StringgetFileContent(String filePath, Map<String, String> params) Variables to be replaced in a resource file should be in the format: $variableName$ The variable to replace in the file should also match the parameter names of the method calling getFileContent.static StringVariables to be replaced in a resource file should be in the format: $variableName$ The variable to replace in the file should also also match the parameter names of the method calling getFileContent.static InputStreamgetFileContentAsStream(String filePath) static InputStreamgetFileContentAsStream(String filePath, Class classRelativeToResource) protected org.ops4j.pax.exam.Optionprotected SecurityPolicyConfiguratorprotected ServiceManagerprotected UrlResourceReaderConfiguratorvoidprotected org.ops4j.pax.exam.OptioninstallStartupFile(String content, String destination) Copies a String into the destination specified before the container starts up.protected org.ops4j.pax.exam.OptioninstallStartupFile(URL resource, String destination) Copies the content of a JAR resource to the destination specified before the container starts up.protected booleanvoidvoid
-
Field Details
-
JSON_RECORD_RESOURCE_PATH
- See Also:
-
CSW_RECORD_RESOURCE_PATH
- See Also:
-
XML_RECORD_RESOURCE_PATH
- See Also:
-
CSW_REQUEST_RESOURCE_PATH
- See Also:
-
LOGGER
protected static final org.slf4j.Logger LOGGER -
LOGGER_CONFIGURATION_FILE_PATH
- See Also:
-
DEFAULT_LOG_LEVEL
- See Also:
-
GLOBAL_LOG_LEVEL_PROPERTY
- See Also:
-
TEST_LOG_LEVEL_PROPERTY
- See Also:
-
TEST_SECURITY_LOG_LEVEL_PROPERTY
- See Also:
-
OPENSEARCH_SOURCE_ID
- See Also:
-
CSW_SOURCE_ID
- See Also:
-
SYSTEM_ADMIN_USER
- See Also:
-
SYSTEM_ADMIN_USER_PASSWORD
- See Also:
-
RESOURCE_VARIABLE_DELIMETER
- See Also:
-
REMOVE_ALL
- See Also:
-
GENERIC_TIMEOUT_SECONDS
public static final long GENERIC_TIMEOUT_SECONDS -
GENERIC_TIMEOUT_MILLISECONDS
public static final long GENERIC_TIMEOUT_MILLISECONDS -
FILE_PERMISSIONS
- See Also:
-
placeHolderSocket
-
basePort
-
DDF_HOME_PROPERTY
- See Also:
-
ddfHome
-
paxExamRule
public org.codice.ddf.test.common.annotations.PaxExamRule paxExamRule -
resultLogger
public org.codice.ddf.test.common.annotations.ExamResultLogger resultLogger -
stopwatch
public org.junit.rules.Stopwatch stopwatch -
configAdmin
@Inject protected org.osgi.service.cm.ConfigurationAdmin configAdmin -
features
@Inject protected org.apache.karaf.features.FeaturesService features -
sessionFactory
@Inject protected org.apache.karaf.shell.api.console.SessionFactory sessionFactory -
metatype
@Inject protected org.osgi.service.metatype.MetaTypeService metatype -
bundleContext
@Inject protected org.osgi.framework.BundleContext bundleContext -
bundleService
@Inject protected org.apache.karaf.bundle.core.BundleService bundleService -
DEFAULT_REQUIRED_APPS
-
console
-
BASE_PORT
-
HTTP_PORT
-
HTTPS_PORT
-
DEFAULT_PORT
-
SSH_PORT
-
RMI_SERVER_PORT
-
RMI_REG_PORT
-
SERVICE_ROOT
-
REST_PATH
-
OPENSEARCH_PATH
-
CSW_PATH
-
CSW_SUBSCRIPTION_PATH
-
CSW_EVENT_PATH
-
ADMIN_ALL_SOURCES_PATH
-
ADMIN_STATUS_PATH
-
RESOURCE_DOWNLOAD_ENDPOINT_ROOT
-
-
Constructor Details
-
AbstractIntegrationTest
public AbstractIntegrationTest()
-
-
Method Details
-
initFacades
public void initFacades() -
waitForBaseSystemFeatures
public void waitForBaseSystemFeatures() -
waitForSystemReady
public void waitForSystemReady() -
beforeSuite
- Throws:
Exception
-
config
Configures the pax exam test container- Returns:
- list of pax exam options
- Throws:
URISyntaxExceptionIOException
-
combineOptions
protected org.ops4j.pax.exam.Option[] combineOptions(org.ops4j.pax.exam.Option[]... options) Combines all theOptionobjects contained in multipleOptionarrays.- Parameters:
options- arrays ofOptionobjects to combine. Arrays can benullor empty.- Returns:
- array that combines all the
Optionobjects from the arrays provided.nulland empty arrays will be ignored, butnullOptionobjects will be added to the result.
-
configureDistribution
protected org.ops4j.pax.exam.Option[] configureDistribution() -
configurePaxExam
protected org.ops4j.pax.exam.Option[] configurePaxExam() -
configureConfigurationPorts
protected org.ops4j.pax.exam.Option[] configureConfigurationPorts() throws URISyntaxException, IOException- Throws:
URISyntaxExceptionIOException
-
configureMavenRepos
protected org.ops4j.pax.exam.Option[] configureMavenRepos() -
configureSystemSettings
protected org.ops4j.pax.exam.Option[] configureSystemSettings() -
configureLogLevel
protected org.ops4j.pax.exam.Option[] configureLogLevel() -
createSetLogLevelOption
Creates options to add log configuration lines to the etc/org.ops4j.pax.logging.cfg file. See .- Parameters:
name- name of the logger to setlevel- String value to set the logger level- Returns:
- options to set the log level
-
configureIncludeUnstableTests
protected org.ops4j.pax.exam.Option[] configureIncludeUnstableTests() -
configureVmOptions
protected org.ops4j.pax.exam.Option[] configureVmOptions() -
configureStartScript
protected org.ops4j.pax.exam.Option[] configureStartScript() -
configureCustom
protected org.ops4j.pax.exam.Option[] configureCustom()Allows extending classes to add any custom options to the configuration. This is only valid for tests run with the PerClass strategy -
getFilePermissionsOption
- Throws:
IOException
-
installStartupFile
protected org.ops4j.pax.exam.Option installStartupFile(String content, String destination) throws IOException Copies a String into the destination specified before the container starts up. Useful to add test configuration files before tests are run.- Parameters:
content- content to use for filedestination- destination relative to DDF_HOME- Returns:
- option object to include in a
configureCustom()method - Throws:
IOException- thrown if a problem occurs while copying the resource
-
installStartupFile
protected org.ops4j.pax.exam.Option installStartupFile(URL resource, String destination) throws IOException Copies the content of a JAR resource to the destination specified before the container starts up. Useful to add test configuration files before tests are run.- Parameters:
resource- URL to the JAR resource to copydestination- destination relative to DDF_HOME- Returns:
- option object to include in a
configureCustom()method - Throws:
IOException- thrown if a problem occurs while copying the resource
-
getDefaultRequiredApps
-
getAdminConfig
-
getServiceManager
-
getCatalogBundle
-
getSecurityPolicy
-
getUrlResourceReaderConfigurator
-
getBasePort
-
getFileContentAsStream
-
getFileContentAsStream
-
getFileContent
-
getFileContent
public static String getFileContent(String filePath, Map<String, String> params, Class classRelativeToResource) Variables to be replaced in a resource file should be in the format: $variableName$ The variable to replace in the file should also also match the parameter names of the method calling getFileContent.- Parameters:
filePath-params-classRelativeToResource-- Returns:
-
getFileContent
Variables to be replaced in a resource file should be in the format: $variableName$ The variable to replace in the file should also match the parameter names of the method calling getFileContent. Resource is relative to AbstractIntegrationTest class- Parameters:
filePath-params-- Returns:
-
configureRestForGuest
- Throws:
Exception
-
configureRestForBasic
- Throws:
Exception
-
configureRestForGuest
- Throws:
Exception
-
configureRestForBasic
- Throws:
Exception
-
configureRestForSaml
- Throws:
Exception
-
configureBundle
protected void configureBundle(String bundleName, String pid, Dictionary<String, Object> properties) throws IOException, org.osgi.framework.BundleException, InterruptedException- Throws:
IOExceptionorg.osgi.framework.BundleExceptionInterruptedException
-
clearCatalogAndWait
public void clearCatalogAndWait()Clears out the catalog and catalog cache of all 'resource' metacards. Will not return until all metacards have been removed. Will throw an AssertionError if catalog could not be cleared within 5 minutes. -
clearCatalog
public void clearCatalog() -
isCatalogEmpty
protected boolean isCatalogEmpty()
-