Class KarafTestCase


  • public abstract class KarafTestCase
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      KarafTestCase()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addFeaturesUrl​(java.lang.String url)  
      void before()  
      org.ops4j.pax.exam.Option[] config()
      This is the default Configuration for any Pax Exam tests that use this abstract base class.
      protected org.ops4j.pax.exam.Option[] configAsArray()  
      protected java.util.List<org.ops4j.pax.exam.Option> configAsList()  
      protected java.lang.String executeCommand​(java.lang.String command)
      Executes a shell command and returns output as a String.
      protected static java.io.File findPom​(java.io.File root)  
      protected org.ops4j.pax.exam.options.MavenUrlReference getFrameworkUrl()
      Use the vanilla Apache Karaf container.
      protected static java.lang.String getKarafVersion()  
      protected static java.lang.String getOpenNMSVersion()  
      protected <T> T getOsgiService​(java.lang.Class<T> type)  
      protected java.lang.String[] getSystemPackages()
      Override this method to add system packages to the test container.
      protected void installFeature​(java.lang.String featureName)  
      protected void installFeature​(java.lang.String featureName, java.lang.String version)  
      protected void installFeature​(java.lang.String featureName, java.util.EnumSet<org.apache.karaf.features.FeaturesService.Option> options)  
      org.ops4j.pax.exam.TestProbeBuilder probeConfiguration​(org.ops4j.pax.exam.TestProbeBuilder probe)
      This ProbeBuilder can be used to add OSGi metadata to the test probe bundle.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MIN_RMI_SERVER_PORT

        public static final java.lang.String MIN_RMI_SERVER_PORT
        See Also:
        Constant Field Values
      • MAX_RMI_SERVER_PORT

        public static final java.lang.String MAX_RMI_SERVER_PORT
        See Also:
        Constant Field Values
      • MIN_RMI_REG_PORT

        public static final java.lang.String MIN_RMI_REG_PORT
        See Also:
        Constant Field Values
      • MAX_RMI_REG_PORT

        public static final java.lang.String MAX_RMI_REG_PORT
        See Also:
        Constant Field Values
      • bundleContext

        @Inject
        protected org.osgi.framework.BundleContext bundleContext
      • featuresService

        @Inject
        protected org.apache.karaf.features.FeaturesService featuresService
      • sessionFactory

        @Inject
        protected org.apache.karaf.shell.api.console.SessionFactory sessionFactory
    • Constructor Detail

      • KarafTestCase

        public KarafTestCase()
    • Method Detail

      • getKarafVersion

        protected static java.lang.String getKarafVersion()
      • findPom

        protected static java.io.File findPom​(java.io.File root)
      • getOpenNMSVersion

        protected static java.lang.String getOpenNMSVersion()
      • before

        public void before()
      • probeConfiguration

        public org.ops4j.pax.exam.TestProbeBuilder probeConfiguration​(org.ops4j.pax.exam.TestProbeBuilder probe)
        This ProbeBuilder can be used to add OSGi metadata to the test probe bundle. We only use it to give the bundle a nice human-readable name of "org.opennms.core.test.karaf.test".
      • config

        public org.ops4j.pax.exam.Option[] config()
        This is the default Configuration for any Pax Exam tests that use this abstract base class. If you wish to add more Configuration parameters, you should call configAsList(), append the Option values to the list, and then return it in a Configuration function that overrides config().
      • configAsList

        protected java.util.List<org.ops4j.pax.exam.Option> configAsList()
      • configAsArray

        protected org.ops4j.pax.exam.Option[] configAsArray()
      • getFrameworkUrl

        protected org.ops4j.pax.exam.options.MavenUrlReference getFrameworkUrl()
        Use the vanilla Apache Karaf container. Override this method to use a different Karaf-compatible framework artifact.
      • getSystemPackages

        protected java.lang.String[] getSystemPackages()
        Override this method to add system packages to the test container.
      • addFeaturesUrl

        protected void addFeaturesUrl​(java.lang.String url)
      • installFeature

        protected void installFeature​(java.lang.String featureName)
      • installFeature

        protected void installFeature​(java.lang.String featureName,
                                      java.util.EnumSet<org.apache.karaf.features.FeaturesService.Option> options)
      • installFeature

        protected void installFeature​(java.lang.String featureName,
                                      java.lang.String version)
      • executeCommand

        protected java.lang.String executeCommand​(java.lang.String command)
        Executes a shell command and returns output as a String. Commands have a default timeout of 10 seconds.
        Parameters:
        command -
        Returns:
      • getOsgiService

        protected <T> T getOsgiService​(java.lang.Class<T> type)