Class TestResourcesController

java.lang.Object
io.micronaut.testresources.server.TestResourcesController
All Implemented Interfaces:
io.micronaut.core.order.Ordered, TestResourcesResolver

@Controller("/") @ExecuteOn("blocking") public class TestResourcesController extends Object implements TestResourcesResolver
The main test resources controller, which will answer requests performed by the test resources client to resolve properties or close test resources.
  • Constructor Details

    • TestResourcesController

      public TestResourcesController(List<PropertyResolutionListener> propertyResolutionListeners, io.micronaut.runtime.server.EmbeddedServer embeddedServer, io.micronaut.context.ApplicationContext applicationContext, ResolverLoader loader, io.micronaut.scheduling.TaskScheduler taskScheduler)
  • Method Details

    • getResolvableProperties

      @Get("/list") public List<String> getResolvableProperties()
      Lists all resolvable properties. Prefer getResolvableProperties(Map, Map) to list all properties which can be resolved for a particular configuration.
      Returns:
      the list of resolvable properties which do not depend on the application configuration
    • getResolvableProperties

      @Post("/list") public List<String> getResolvableProperties(Map<String,Collection<String>> propertyEntries, Map<String,Object> testResourcesConfig)
      Lists all resolvable properties for a particular configuration.
      Specified by:
      getResolvableProperties in interface TestResourcesResolver
      Parameters:
      propertyEntries - the property entries
      testResourcesConfig - the test resources configuration
      Returns:
      the list of properties
    • getRequiredProperties

      @Get("/requirements/expr/{expression}") public List<String> getRequiredProperties(String expression)
      Lists all properties required to resolve a particular expression.
      Specified by:
      getRequiredProperties in interface TestResourcesResolver
      Parameters:
      expression - the expression which needs to be resolved.
      Returns:
      the list of required properties
    • getRequiredPropertyEntries

      @Get("/requirements/entries") public List<String> getRequiredPropertyEntries()
      Lists all properties required by all resolvers.
      Specified by:
      getRequiredPropertyEntries in interface TestResourcesResolver
      Returns:
      the list of required properties
    • resolve

      @Post("/resolve") public Optional<String> resolve(String name, Map<String,Object> properties, Map<String,Object> testResourcesConfig)
      Resolves a property.
      Specified by:
      resolve in interface TestResourcesResolver
      Parameters:
      name - the property to resolve
      properties - the resolved required properties
      testResourcesConfig - the test resources configuration
      Returns:
      the resolved property, if any
    • closeAll

      @Get("/close/all") public boolean closeAll()
      Closes all test resources.
      Returns:
      true if the operation was successful
    • closeScope

      @Get("/close/{id}") public boolean closeScope(@Nullable @Nullable String id)
      Closes a test resource scope.
      Parameters:
      id - the scope id
      Returns:
      true if the operation was successful
    • listContainers

      @Get("/testcontainers") public List<TestContainer> listContainers()
      Lists all test containers started by the server.
      Returns:
      the list of test containers
    • listContainersByScope

      @Get("/testcontainers/{scope}") public List<TestContainer> listContainersByScope(@Nullable @Nullable String scope)
      Lists all test containers started by the server for a particular scope.
      Parameters:
      scope - the scope id
      Returns:
      the list of test containers
    • stopService

      @Post("/stop") public boolean stopService()
      Requests a test resources service shutdown.