Class DdfBaseOptions

java.lang.Object
org.codice.ddf.test.common.configurators.DdfBaseOptions
All Implemented Interfaces:
Supplier<org.ops4j.pax.exam.Option>, ApplicationOptions
Direct Known Subclasses:
DdfComponentOptions

public abstract class DdfBaseOptions extends Object implements ApplicationOptions
Provides the basic DDF configuration Options required to run with Pax Exam. The class must be extended to implement getDistributionOptions() and provide the distribution that will be run in the test container.

Any other bundles and features required by the tests can be provided by extending this class and implementing getBundleOptions() and getFeatureOptions(). Other configuration options can be provided by overwriting getExtraOptions().

The following system properties can be used to customize the application's runtime behavior:

  • logLevel: sets logging to the level specified for all ddf and org.codice.ddf packages, unless logPackages is also provided.
  • logPackages: coma-separated list of packages logLevel will apply to; ddf and org.codice.ddf if not provided.
See Also:
  • Field Details

  • Constructor Details

    • DdfBaseOptions

      public DdfBaseOptions(PortFinder portFinder)
      Constructor.
      Parameters:
      portFinder - instance of the PortFinder to use to assign unique ports to the new Pax Exam container
  • Method Details

    • get

      public org.ops4j.pax.exam.Option get()
      Description copied from interface: ApplicationOptions
      Gets the Pax Exam configuration Options for this application. Implementers should use Pax Exam's CoreOptions.composite(Option...) to combine multiple options into one if needed.
      Specified by:
      get in interface ApplicationOptions
      Specified by:
      get in interface Supplier<org.ops4j.pax.exam.Option>
      Returns:
      Pax Exam configuration Options
    • getDistributionOptions

      protected abstract org.ops4j.pax.exam.Option getDistributionOptions()
      Gets the distribution artifact to deploy in the Pax Exam container, e.g., the Karaf or DDF distribution zip file.
      Returns:
      distribution artifact to deploy
    • getBundleOptions

      protected BundleOptionBuilder.BundleOption getBundleOptions()
      Gets the BundleOptionBuilder.BundleOption that contains all the bundles to start in the Pax Exam container for the tests to run.

      Important: Since the bundle being tested will automatically be started by this class, it should not be returned by this method.

      Returns:
      BundleOptionBuilder.BundleOption that contains the bundles to start. Defaults to an empty list of bundles.
    • getFeatureOptions

      protected FeatureOptionBuilder.FeatureOption getFeatureOptions()
      Gets the FeatureOptionBuilder.FeatureOption that contains all the features to start in the Pax Exam container for the tests to run.
      Returns:
      FeatureOptionBuilder.FeatureOption that contains the features to start. Defaults to an empty list of features.
    • getExtraOptions

      protected org.ops4j.pax.exam.Option getExtraOptions()
      Gets the extra Pax Exam Option to use to configure the Pax Exam container. CoreOptions.composite(Option...) can be used to combine multiple options into one.
      Returns:
      extra Option. Defaults to empty.
    • getDefaultLogPackages

      protected String getDefaultLogPackages()
      Gets the list of packages whose logging level will be changed when the logLevel system property has been defined. By default, the ddf and org.codice.ddf packages will have their logging level set to the one specified by logLevel.
      Returns:
      coma-separated list of packages to include by default. Defaults to ddf and org.codice.ddf.
    • installStartupFile

      protected org.ops4j.pax.exam.Option installStartupFile(URL resource, String destination)
      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 copy
      destination - destination relative to DDF_HOME
      Returns:
      option object
      Throws:
      IOException - thrown if a problem occurs while copying the resource