Class TomEEEmbeddedSingleRunner

java.lang.Object
org.junit.runner.Runner
org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
org.junit.runners.BlockJUnit4ClassRunner
org.apache.tomee.embedded.junit.TomEEEmbeddedSingleRunner
All Implemented Interfaces:
org.junit.runner.Describable, org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Orderable, org.junit.runner.manipulation.Sortable

@Vetoed public class TomEEEmbeddedSingleRunner extends org.junit.runners.BlockJUnit4ClassRunner
see org.apache.tomee.embedded.SingleInstanceRunnerTest for a sample. idea is to reuse some part of ApplicationComposer API to get a single container for all tests in embedded mode.

Base is to declare an @Application class which holds the model and some injections. Note: this can be replaced setting tomee.application-composer.application property to the fully qualified name of the app. Note: @Application classes are only searched in the same jar as the test.

Model: - @Configuration: programmatic properties - note injections don't work there. - @Classes: only context value is used. - @ContainerProperties: to configure the container - @WebResource: first value can be used to set the docBase (other values are ignored) - @TomEEEmbeddedSingleRunner.LifecycleTasks: allow to add some lifecycle tasks (like starting a ftp/sft/elasticsearch... server)

Injections: - CDI - @RandomPort: with the value http or https. Supported types are URL (context base) and int (the port).

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
    static class 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
     
    protected List<org.junit.rules.MethodRule>
    rules(Object test)
     
    static void
     

    Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner

    collectInitializationErrors, computeTestMethods, createTest, createTest, describeChild, getChildren, getTestRules, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, runChild, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeout

    Methods inherited from class org.junit.runners.ParentRunner

    childrenInvoker, classBlock, classRules, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, order, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolation

    Methods inherited from class org.junit.runner.Runner

    testCount

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TomEEEmbeddedSingleRunner

      public TomEEEmbeddedSingleRunner(Class<?> klass) throws org.junit.runners.model.InitializationError
      Throws:
      org.junit.runners.model.InitializationError
  • Method Details

    • setApp

      public static void setApp(Object o)
    • close

      public static void close()
    • rules

      protected List<org.junit.rules.MethodRule> rules(Object test)
      Overrides:
      rules in class org.junit.runners.BlockJUnit4ClassRunner