Class TestingServerlessEmbeddedApplication

java.lang.Object
io.micronaut.http.poja.test.TestingServerlessEmbeddedApplication
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 @Requires(env="test") @Replaces(io.micronaut.runtime.EmbeddedApplication.class) public class TestingServerlessEmbeddedApplication extends Object implements io.micronaut.runtime.server.EmbeddedServer
An embedded server that uses PojaHttpServerlessApplication as application. It can be used for testing POJA serverless applications the same way a normal micronaut server would be tested.

It delegates to PojaHttpServerlessApplication by creating 2 pipes to communicate with the client and simplifies reading and writing to them.

Author:
Andriy Dmytruk
  • Constructor Details

    • TestingServerlessEmbeddedApplication

      public TestingServerlessEmbeddedApplication(PojaHttpServerlessApplication<?,?> application)
      Default constructor.
      Parameters:
      application - The application context
  • Method Details

    • start

      Specified by:
      start in interface io.micronaut.context.ApplicationContextLifeCycle<io.micronaut.runtime.server.EmbeddedServer>
      Specified by:
      start in interface io.micronaut.context.LifeCycle
    • stop

      @NonNull public @NonNull TestingServerlessEmbeddedApplication stop()
      Specified by:
      stop in interface io.micronaut.context.ApplicationContextLifeCycle<io.micronaut.runtime.server.EmbeddedServer>
      Specified by:
      stop in interface io.micronaut.context.LifeCycle
    • isRunning

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

      public int getPort()
      Get the port.
      Specified by:
      getPort in interface io.micronaut.runtime.server.EmbeddedServer
      Returns:
      The port
    • 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>