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.SensorSupportBrooklynObject.RelationSupport<T extends BrooklynObject>, BrooklynObject.SubscriptionSupport, BrooklynObject.TagSupportConfigurable.ConfigurationSupportStartable.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, TIMEOUTTARGET_ENTITY, TARGET_ENTITY_ID, TARGET_ENTITY_NAME, TARGET_ENTITY_TYPE, TARGET_ID, TARGET_RESOLUTION_TIMEOUTRESTART, SERVICE_UP, START, STOPresolveTargetaddChild, addChild, addFeed, clearParent, enrichers, getApplication, getApplicationId, getAttribute, getChildren, getConfig, getCreationTime, getDisplayName, getEntityType, getIconUrl, getId, getLocations, getParent, groups, invoke, policies, relations, removeChild, sensors, setDisplayName, setParentgetCatalogItemId, getCatalogItemIdSearchPath, subscriptions, tagsconfig, getConfigstatic final ConfigKey<java.lang.String> ENDPOINT
static final ConfigKey<java.lang.Object> ENDPOINT_SENSOR
static final java.lang.String REACHABLE_KEY