Class TestResourcesController

java.lang.Object
io.micronaut.testresources.server.TestResourcesController

@Controller("/") @Produces("application/x-test-resources+binary") @ExecuteOn("blocking") public class TestResourcesController extends Object
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 Result<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") @Consumes("application/x-test-resources+binary") public Result<List<String>> getResolvableProperties(Map<String, Collection<String>> propertyEntries, Map<String,Object> testResourcesConfig)
      Lists all resolvable properties for a particular configuration.
      Parameters:
      propertyEntries - the property entries
      testResourcesConfig - the test resources configuration
      Returns:
      the list of resolvable properties for the supplied configuration
    • getRequiredProperties

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

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

      @Post("/resolve") @Consumes("application/x-test-resources+binary") public Optional<Result<String>> resolve(String name, Map<String,Object> properties, Map<String,Object> testResourcesConfig)
      Resolves a property.
      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 Result<Boolean> closeAll()
      Closes all test resources.
      Returns:
      true if the operation was successful
    • closeScope

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

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

      @Get("/testcontainers/{scope}") public Result<List<Map<String,Object>>> listContainersByScope(@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") @Consumes("application/x-test-resources+binary") public Result<Boolean> stopService()
      Requests a test resources service shutdown.
      Returns:
      a boolean indicating if shutdown was successful.