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
org.apache.brooklyn.api.entity.Entity.AdjunctSupport<T extends org.apache.brooklyn.api.objs.EntityAdjunct>, org.apache.brooklyn.api.entity.Entity.EnricherSupport, org.apache.brooklyn.api.entity.Entity.GroupSupport, org.apache.brooklyn.api.entity.Entity.PolicySupport, org.apache.brooklyn.api.entity.Entity.SensorSupportorg.apache.brooklyn.api.objs.BrooklynObject.RelationSupport<T extends org.apache.brooklyn.api.objs.BrooklynObject>, org.apache.brooklyn.api.objs.BrooklynObject.SubscriptionSupport, org.apache.brooklyn.api.objs.BrooklynObject.TagSupportorg.apache.brooklyn.api.objs.Configurable.ConfigurationSupportStartable.RestartEffectorBody, Startable.StartEffectorBody, Startable.StopEffectorBody| Modifier and Type | Field and Description |
|---|---|
static org.apache.brooklyn.config.ConfigKey<String> |
ENDPOINT |
static org.apache.brooklyn.config.ConfigKey<Object> |
ENDPOINT_SENSOR |
static 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, addEnricher, addEnricher, addFeed, addGroup, addPolicy, addPolicy, clearParent, enrichers, getApplication, getApplicationId, getAttribute, getChildren, getConfig, getCreationTime, getDisplayName, getEnrichers, getEntityType, getGroups, getIconUrl, getId, getLocations, getParent, getPolicies, groups, invoke, policies, relations, removeChild, removeEnricher, removeGroup, removePolicy, sensors, setDisplayName, setParentgetCatalogItemId, getCatalogItemIdSearchPath, subscriptions, tagsstatic final org.apache.brooklyn.config.ConfigKey<String> ENDPOINT
static final org.apache.brooklyn.config.ConfigKey<Object> ENDPOINT_SENSOR
static final String REACHABLE_KEY
Copyright © 2012–2017 The Apache Software Foundation. All rights reserved.