Class TestEmbeddedServer

java.lang.Object
io.micronaut.test.support.server.TestEmbeddedServer
All Implemented Interfaces:
io.micronaut.context.ApplicationContextLifeCycle<io.micronaut.runtime.server.EmbeddedServer>, io.micronaut.context.ApplicationContextProvider, io.micronaut.context.LifeCycle, io.micronaut.runtime.EmbeddedApplication<io.micronaut.runtime.server.EmbeddedServer>, io.micronaut.runtime.server.EmbeddedServer, Closeable, AutoCloseable

@Singleton @Primary @Order(-100) @Requires(property="micronaut.test.server.url") @Requires(missingProperty="micronaut.test.server.executable") public class TestEmbeddedServer extends Object implements io.micronaut.runtime.server.EmbeddedServer
An EmbeddedServer implementation that can be enabled by setting micronaut.test.server.url to run tests against and existing running server.
Since:
2.2.0
Author:
graemerocher
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    TestEmbeddedServer(URL url, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, io.micronaut.context.ApplicationContext applicationContext)
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    io.micronaut.runtime.ApplicationConfiguration
     
    io.micronaut.context.ApplicationContext
     
     
    int
     
     
     
     
    boolean
     
    boolean
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micronaut.context.ApplicationContextLifeCycle

    start, stop

    Methods inherited from interface io.micronaut.runtime.EmbeddedApplication

    getEnvironment, isForceExit

    Methods inherited from interface io.micronaut.runtime.server.EmbeddedServer

    getContextURI, isKeepAlive

    Methods inherited from interface io.micronaut.context.LifeCycle

    close, refresh
  • Field Details

  • Constructor Details

    • TestEmbeddedServer

      @Internal protected TestEmbeddedServer(@Property(name="micronaut.test.server.url") URL url, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, io.micronaut.context.ApplicationContext applicationContext)
      Default constructor.
      Parameters:
      url - The server URL
      applicationConfiguration - The application configuration
      applicationContext - The application context
  • Method Details

    • getPort

      public int getPort()
      Specified by:
      getPort in interface io.micronaut.runtime.server.EmbeddedServer
    • getHost

      public String getHost()
      Specified by:
      getHost in interface io.micronaut.runtime.server.EmbeddedServer
    • getScheme

      public String getScheme()
      Specified by:
      getScheme in interface io.micronaut.runtime.server.EmbeddedServer
    • getURL

      public URL getURL()
      Specified by:
      getURL in interface io.micronaut.runtime.server.EmbeddedServer
    • getURI

      public URI getURI()
      Specified by:
      getURI in interface io.micronaut.runtime.server.EmbeddedServer
    • getApplicationContext

      public io.micronaut.context.ApplicationContext getApplicationContext()
      Specified by:
      getApplicationContext in interface io.micronaut.context.ApplicationContextProvider
      Specified by:
      getApplicationContext in interface io.micronaut.runtime.EmbeddedApplication<io.micronaut.runtime.server.EmbeddedServer>
    • getApplicationConfiguration

      public io.micronaut.runtime.ApplicationConfiguration getApplicationConfiguration()
      Specified by:
      getApplicationConfiguration in interface io.micronaut.runtime.EmbeddedApplication<io.micronaut.runtime.server.EmbeddedServer>
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface io.micronaut.context.LifeCycle
    • isServer

      public boolean isServer()
      Specified by:
      isServer in interface io.micronaut.runtime.EmbeddedApplication<io.micronaut.runtime.server.EmbeddedServer>
      Specified by:
      isServer in interface io.micronaut.runtime.server.EmbeddedServer