@Documented @Retention(value=RUNTIME) @Target(value={ANNOTATION_TYPE,TYPE}) @Repeatable(value=RemoteResources.class) public @interface RemoteResource
An annotation that can be placed on integration and system tests to specify resources that must be loaded, configured, started, stopped before and after each test case (i.e. an in-memory database).
Note that an remote resource consists of a server component and client component (optional).
For example, if a test class requires an in-memory database then the database
DataSource can be thought of as the server component and the
Connection to the DataSource as the client component.
| Modifier and Type | Required Element and Description |
|---|---|
Class<? extends RemoteResourceProvider> |
value
Specifies the remote resource's implementation provider class.
|
| Modifier and Type | Optional Element and Description |
|---|---|
String |
configKey
The configuration section key in .testify.yml associated with the remote resource.
|
String[] |
dataFiles
A list of classpath data files that should be loaded by the remote resource prior to
being used.
|
Class<? extends DataProvider> |
dataProvider
Specifies a data provider implementations that loads data into the resource prior to it
being used.
|
String |
name
Specifies the name of the
RemoteResourceInstance provided by value(). |
Class |
resourceContract
Specifies the virtual resource's contract.
|
String |
resourceName
Specifies the remote resource's name.
|
public abstract Class<? extends RemoteResourceProvider> value
public abstract String name
Specifies the name of the RemoteResourceInstance provided by value().
Note that if a test class requires multiple resources that provide similar resources then name must be specified to resolve ambiguity as to which resource instance should be injected into your test code.
public abstract String configKey
public abstract String[] dataFiles
FileSystem.getPathMatcher(java.lang.String)
glob patterns are supportedpublic abstract Class<? extends DataProvider> dataProvider
public abstract String resourceName
Specifies the remote resource's name. This useful for giving the resource instance a unique name that can be used to qualify and distinguish it from other similar resources.
Note that if the name is not specified the name provided by the remote resource provider implementation will be used.
public abstract Class resourceContract
Specifies the virtual resource's contract. This useful for getting the resource by its contract.
Note that if the contract is not specified the resource instance will be injectable by its implementation class only.
Copyright © 2016–2018 Testify Project. All rights reserved.