本文整理了Java中org.apache.brooklyn.api.entity.Entity.getConfig()
方法的一些代码示例,展示了Entity.getConfig()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getConfig()
方法的具体详情如下:
包路径:org.apache.brooklyn.api.entity.Entity
类名称:Entity
方法名:getConfig
暂无
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Override
public boolean apply(Entity input) {
Entity delegate = input.getConfig(DelegateEntity.DELEGATE_ENTITY);
if (delegate == null) return false;
return delegate.equals(member);
}
});
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Override
public boolean apply(@Nullable Entity input) {
return (input != null) && Objects.equal(input.getConfig(configKey), val);
}
};
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Override
public boolean apply(@Nullable Entity input) {
return (input != null) && condition.apply(input.getConfig(configKey));
}
@Override
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
public static <T> T getRequiredConfig(Entity entity, ConfigKey<T> key) {
return Preconditions.checkNotNull(
Preconditions.checkNotNull(entity, "Entity must be supplied").getConfig(key),
"Key "+key+" is required on "+entity);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-camp
@Override
public Object call() {
return entities[1].getConfig(TestEntity.CONF_OBJECT);
}}).get();
Assert.assertNotNull(object);
代码示例来源:origin: org.apache.brooklyn/brooklyn-camp
@Override
public Object call() throws Exception {
return testEntity.getConfig(TestEntity.CONF_MAP_PLAIN);
}
}).build()).get();
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
public static void waitForServiceUp(final Entity entity) {
Duration timeout = entity.getConfig(BrooklynConfigKeys.START_TIMEOUT);
waitForServiceUp(entity, timeout);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
/** Fails-fast if value of the given key is null or unresolveable. */
public static String getRequiredUrlConfig(Entity entity, ConfigKey<String> urlKey) {
String url = entity.getConfig(urlKey);
Preconditions.checkNotNull(url, "Key %s on %s should not be null", urlKey, entity);
if (!ResourceUtils.create(entity).doesUrlExist(url)) {
throw new IllegalStateException(String.format("Key %s on %s contains unavailable URL %s", urlKey, entity, url));
}
return url;
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
/** @return provisioning flags for the given entity */
@SuppressWarnings({ "rawtypes", "unchecked" })
protected Map<String,Object> obtainProvisioningFlags(Entity entity, MachineProvisioningLocation location) {
Map<String,Object> result = Maps.newLinkedHashMap();
result.putAll(Maps.newLinkedHashMap(location.getProvisioningFlags(ImmutableList.of(entity.getEntityType().getName()))));
result.putAll(entity.getConfig(SameServerEntity.PROVISIONING_PROPERTIES));
for (Entity child : entity.getChildren()) {
result.putAll(obtainProvisioningFlags(child, location));
}
return result;
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
/** Logs a warning if an entity has a value for a config key. */
public static void warnOnIgnoringConfig(Entity entity, ConfigKey<?> key) {
if (((EntityInternal)entity).config().getRaw(key).isPresentAndNonNull())
log.warn("Ignoring "+key+" set on "+entity+" ("+entity.getConfig(key)+")");
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testConfigKeysInheritance() throws Exception {
Entity child = setupBasicInheritanceTest();
Assert.assertNotNull(child.getConfig(MyEntityWithPartiallyHeritableConfig.HERITABLE_BY_DEFAULT));
Assert.assertNotNull(child.getConfig(MyEntityWithPartiallyHeritableConfig.ALWAYS_HERITABLE));
Assert.assertNull(child.getConfig(MyEntityWithPartiallyHeritableConfig.NEVER_INHERIT));
// it's reinheritable unless explicitly declared
Assert.assertNotNull(child.getConfig(MyEntityWithPartiallyHeritableConfig.NOT_REINHERITABLE));
app.getMutableEntityType().addConfigKey(MyEntityWithPartiallyHeritableConfig.NOT_REINHERITABLE);
Assert.assertNull(child.getConfig(MyEntityWithPartiallyHeritableConfig.NOT_REINHERITABLE));
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-webapp
static void addToWarsByContext(Entity entity, String url, String targetName) {
targetName = FILENAME_TO_WEB_CONTEXT_MAPPER.convertDeploymentTargetNameToContext(targetName);
// TODO a better way to do atomic updates, see comment above
synchronized (entity) {
Map<String,String> newWarsMap = MutableMap.copyOf(entity.getConfig(WARS_BY_CONTEXT));
newWarsMap.put(targetName, url);
entity.config().set(WARS_BY_CONTEXT, newWarsMap);
}
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@SuppressWarnings("unchecked")
protected <T> T getTestKeyFromEntityMemento(String label, String entityId, Class<T> type) throws Exception {
Entity e = loadEntityMemento(label, entityId);
return (T) e.getConfig(TEST_KEY);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-camp
@Test
public void testFlagAtRootEntityImpl() throws Exception {
Entity app = createAndStartApplication(
"services:",
"- serviceType: " + TestEntityImpl.class.getName(),
" confName: Foo Bar");
Entity testEntity = Iterables.getOnlyElement(app.getChildren());
Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_NAME), "Foo Bar");
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-camp
@Test
public void testExplicitFlagsEntityImpl() throws Exception {
Entity app = createAndStartApplication(
"services:",
"- serviceType: " + TestEntityImpl.class.getName(),
" brooklyn.flags:",
" confName: Foo Bar");
Entity testEntity = Iterables.getOnlyElement(app.getChildren());
Assert.assertEquals(testEntity.getConfig(TestEntity.CONF_NAME), "Foo Bar");
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-camp
@Test
public void testTestSetup() throws Exception {
app();
Assert.assertEquals(find("two").getConfig(DEST), 1);
Assert.assertEquals(find("two").getConfig(DEST2), 2);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-camp
@Test
public void testWrapsAppIfNameAtTopLevelAndOnApp() throws Exception {
String yaml = Joiner.on("\n").join(
"name: myTopLevelName",
"services:",
"- serviceType: org.apache.brooklyn.core.test.entity.TestApplication",
" name: myEntityName");
Entity app = createStartWaitAndLogApplication(yaml);
assertNull(app.getConfig(EntityManagementUtils.WRAPPER_APP_MARKER));
assertEquals(app.getDisplayName(), "myTopLevelName");
assertEquals(app.getChildren().size(), 0);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-camp
@Test
public void testAddChildrenWithConfig() throws Exception {
Entity child = makeAppAndAddChild(true, MutableMap.<String,Object>of(),
"blueprint_yaml: |",
" services:",
" - type: "+BasicEntity.class.getName(),
" brooklyn.config:",
" p.child: $brooklyn:config(\"p.parent\")");
Assert.assertEquals(child.getConfig(ConfigKeys.newStringConfigKey("p.param1")), "default");
Assert.assertEquals(child.getConfig(ConfigKeys.newStringConfigKey("p.child")), "parent");
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-camp
@Test
public void testRefToSelf() throws Exception {
Entity app = createAndStartApplication(
"services:",
"- type: " + TestEntity.class.getName(),
" test.confObject: $brooklyn:self()",
" test.confName: $brooklyn:self().attributeWhenReady(\"mysensor\")");
Entity entity = Iterables.getOnlyElement(app.getChildren());
assertEquals(entity.getConfig(TestEntity.CONF_OBJECT), entity);
entity.sensors().set(Sensors.newStringSensor("mysensor"), "myval");
assertEquals(entity.getConfig(TestEntity.CONF_NAME), "myval");
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test(enabled=false)
public void testSetConfigKeyAsEmptySet() throws Exception {
Entity entity2 = app.createAndManageChild(EntitySpec.create(TestEntity.class)
.configure(TestEntity.CONF_SET_THING.getName(), ImmutableSet.<String>of()));
Entity entity3 = app.createAndManageChild(EntitySpec.create(TestEntity.class)
.configure(TestEntity.CONF_SET_THING, ImmutableSet.<String>of()));
app.start(locs);
assertEquals(entity3.getConfig(TestEntity.CONF_SET_THING), ImmutableSet.of());
assertEquals(entity2.getConfig(TestEntity.CONF_SET_THING), ImmutableSet.of());
}
内容来源于网络,如有侵权,请联系作者删除!