public interface TestEndpointReachable extends BaseTest
services:
- type: com.acme.MyEntityUnderTest
id: entity-under-test
- type: org.apache.brooklyn.test.framework.TestCase
name: Tests
brooklyn.children:
- type: org.apache.brooklyn.test.framework.TestEndpointReachable
name: Endpoint reachable
brooklyn.config:
targetId: entity-under-test
timeout: 2m
endpointSensor: datastore.url
The sensor's value can be in a number of different formats: a string in the form of ip:port
or URI format; or a HostAndPort
; or a URI
; or a
URL
instance.
Alternatively an explicit endpoint can be used (e.g. constructed from other sensors of
the target entity):
...
- type: org.apache.brooklyn.test.framework.TestEndpointReachable
name: Endpoint reachable
brooklyn.config:
targetId: entity-under-test
timeout: 2m
endpoint:
$brooklyn:formatString:
- %s:%s"
- $brooklyn:entity("entity-under-test").attributeWhenReady("host.name")
- $brooklyn:entity("entity-under-test").attributeWhenReady("https.port")
One can also assert that the given endpoint is not reachable. Here the timeout means that at
some point within this timeout period, we expect the endpoint to become unreachable. As soon
as it is unreachable, we return:
...
- type: org.apache.brooklyn.test.framework.TestEndpointReachable
name: Endpoint reachable
brooklyn.config:
targetId: entity-under-test
timeout: 2m
endpointSensor: datastore.url
assertions:
reachable: false
Entity.AdjunctSupport<T extends EntityAdjunct>, Entity.EnricherSupport, Entity.GroupSupport, Entity.PolicySupport, Entity.SensorSupport
BrooklynObject.RelationSupport<T extends BrooklynObject>, BrooklynObject.SubscriptionSupport, BrooklynObject.TagSupport
Configurable.ConfigurationSupport
Startable.RestartEffectorBody, Startable.StartEffectorBody, Startable.StopEffectorBody
Modifier and Type | Field and Description |
---|---|
static ConfigKey<java.lang.String> |
ENDPOINT |
static ConfigKey<java.lang.Object> |
ENDPOINT_SENSOR |
static java.lang.String |
REACHABLE_KEY
A key within the assertions map, to say whether we should assert that the endpoint is reachable or not reachable.
|
ASSERTIONS, BACKOFF_TO_PERIOD, ITERATION_LIMIT, TIMEOUT
TARGET_ENTITY, TARGET_ENTITY_ID, TARGET_ENTITY_NAME, TARGET_ENTITY_TYPE, TARGET_ID, TARGET_RESOLUTION_TIMEOUT
RESTART, SERVICE_UP, START, STOP
resolveTarget
addChild, addChild, addFeed, clearParent, enrichers, getApplication, getApplicationId, getAttribute, getChildren, getConfig, getCreationTime, getDisplayName, getEntityType, getIconUrl, getId, getLocations, getParent, groups, invoke, policies, relations, removeChild, sensors, setDisplayName, setParent
getCatalogItemId, getCatalogItemIdSearchPath, subscriptions, tags
config, getConfig
static final ConfigKey<java.lang.String> ENDPOINT
static final ConfigKey<java.lang.Object> ENDPOINT_SENSOR
static final java.lang.String REACHABLE_KEY