本文整理了Java中org.apache.brooklyn.core.entity.Entities.descendants()
方法的一些代码示例,展示了Entities.descendants()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entities.descendants()
方法的具体详情如下:
包路径:org.apache.brooklyn.core.entity.Entities
类名称:Entities
方法名:descendants
暂无
代码示例来源:origin: io.brooklyn.ambari/brooklyn-ambari
@Override
public Iterable<AmbariNode> getAmbariNodes() {
return Entities.descendants(this, AmbariNode.class);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
@SuppressWarnings("deprecation")
public void testDescendantsFilteredByType() throws Exception {
Asserts.assertEqualsIgnoringOrder(Entities.descendantsAndSelf(app, TestEntity.class), ImmutableList.of(entity, entity2));
Asserts.assertEqualsIgnoringOrder(Entities.descendants(app, TestEntity.class), ImmutableList.of(entity, entity2));
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
@SuppressWarnings("deprecation")
public void testDescendants() throws Exception {
Asserts.assertEqualsIgnoringOrder(Entities.descendantsAndSelf(app), ImmutableList.of(app, entity, entity2));
Asserts.assertEqualsIgnoringOrder(Entities.descendants(app), ImmutableList.of(app, entity, entity2));
Asserts.assertEqualsIgnoringOrder(Entities.descendantsAndSelf(entity), ImmutableList.of(entity));
Asserts.assertEqualsIgnoringOrder(Entities.descendants(entity), ImmutableList.of(entity));
}
代码示例来源:origin: io.brooklyn.ambari/brooklyn-ambari
private Iterable<AmbariHostGroup> getHostGroups() {
return Entities.descendants(this, AmbariHostGroup.class);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
@SuppressWarnings("deprecation")
public void testDescendantsFilteredByPredicate() throws Exception {
Asserts.assertEqualsIgnoringOrder(Entities.descendantsAndSelf(app, Predicates.instanceOf(TestEntity.class)), ImmutableList.of(entity, entity2));
Asserts.assertEqualsIgnoringOrder(Entities.descendants(app, Predicates.instanceOf(TestEntity.class)), ImmutableList.of(entity, entity2));
}
代码示例来源:origin: io.brooklyn.ambari/brooklyn-ambari
@Override
public Iterable<AmbariAgent> getAmbariAgents() {
return Entities.descendants(this, AmbariAgent.class);
}
代码示例来源:origin: io.brooklyn.ambari/brooklyn-ambari
@Override
public Iterable<AmbariServer> getAmbariServers() {
return Entities.descendants(this, AmbariServer.class);
}
代码示例来源:origin: io.brooklyn.ambari/brooklyn-ambari
@Nonnull
private Iterable<ExtraService> getExtraServices() {
return Entities.descendants(this, ExtraService.class);
}
代码示例来源:origin: io.brooklyn.ambari/brooklyn-ambari
@Override
public AmbariServer getMasterAmbariServer() {
return Iterables.getFirst(Entities.descendants(this, AmbariServer.class), null);
}
代码示例来源:origin: io.brooklyn.ambari/brooklyn-ambari
private List<AmbariAgent> getAmbariAgents(Collection<Entity> entities) {
ImmutableList.Builder<AmbariAgent> builder = ImmutableList.<AmbariAgent>builder();
for (Entity entity : entities) {
if(entity instanceof AmbariAgent) {
builder.add((AmbariAgent) entity);
}
else {
builder.addAll(Entities.descendants(entity, AmbariAgent.class));
}
}
return builder.build();
}
代码示例来源:origin: io.brooklyn.ambari/brooklyn-ambari
@Override
public List<String> getHostFQDNs() {
ImmutableList.Builder<String> builder = ImmutableList.builder();
for (AmbariAgent agent : Entities.descendants(this, AmbariAgent.class)) {
String fqdn = agent.getFqdn();
if (fqdn != null) {
builder.add(fqdn);
}
}
return builder.build();
}
代码示例来源:origin: io.brooklyn.ambari/brooklyn-ambari
@Nullable
private AmbariAgent getAmbariAgentByFqdn(@Nonnull String fqdn) {
checkNotNull(fqdn);
for (AmbariAgent ambariAgent : Entities.descendants(this, AmbariAgent.class)) {
if (StringUtils.equals(ambariAgent.getFqdn(), fqdn)) {
return ambariAgent;
}
}
return null;
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testDescendantsWithExplicitIncludeSelf() throws Exception {
Asserts.assertEqualsIgnoringOrder(Entities.descendants(app, Predicates.alwaysTrue(), true), ImmutableList.of(app, entity, entity2));
Asserts.assertEqualsIgnoringOrder(Entities.descendants(app, Predicates.alwaysTrue(), false), ImmutableList.of(entity, entity2));
Asserts.assertEqualsIgnoringOrder(Entities.descendants(entity, Predicates.alwaysTrue(), true), ImmutableList.of(entity));
Asserts.assertEqualsIgnoringOrder(Entities.descendants(entity, Predicates.alwaysTrue(), false), ImmutableList.of());
}
代码示例来源:origin: io.brooklyn.ambari/brooklyn-ambari
@Override
public void customize() {
List<String> extraStackDefinitions = getExtraStackDefinitionUrls();
ImmutableList.Builder<String> builder = ImmutableList.<String>builder();
if (!extraStackDefinitions.isEmpty()) {
for (String extraStackDefinition : extraStackDefinitions) {
String tmpLocation = copyToTmp(extraStackDefinition);
builder.add(getUnpackCommand(tmpLocation));
}
}
AmbariCluster ambariCluster = getParentAmbariCluster();
for (Entity customService: Entities.descendants(ambariCluster, Predicates.instanceOf(CustomService.class), false)) {
if (Entities.isManaged(customService)) {
((CustomService)customService).customizeService();
}
}
builder.add(sudo("ambari-server setup -s"));
newScript(CUSTOMIZING)
.body.append(builder.build())
.failOnNonZeroResultCode()
.execute();
}
代码示例来源:origin: io.brooklyn.ambari/brooklyn-ambari
for (ExtraService extraService : Entities.descendants(this, ExtraService.class)) {
if (extraService.getConfig(ExtraService.SERVICE_NAME) == null && extraService.getConfig(ExtraService.COMPONENT_NAMES) == null) {
continue;
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testThrottleAppliesAfterRebind() throws Exception {
DynamicCluster cluster = origApp.createAndManageChild(EntitySpec.create(DynamicCluster.class)
.configure(DynamicCluster.MAX_CONCURRENT_CHILD_COMMANDS, 1)
.configure(DynamicCluster.INITIAL_SIZE, 1)
.configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(DynamicClusterTest.ThrowOnAsyncStartEntity.class))
.configure(DynamicClusterTest.ThrowOnAsyncStartEntity.COUNTER, new AtomicInteger()));
app().start(ImmutableList.of(origApp.newLocalhostProvisioningLocation()));
EntityAsserts.assertAttributeEquals(cluster, DynamicCluster.GROUP_SIZE, 1);
rebind(RebindOptions.create().terminateOrigManagementContext(true));
cluster = Entities.descendants(app(), DynamicCluster.class).iterator().next();
cluster.resize(10);
EntityAsserts.assertAttributeEqualsEventually(cluster, DynamicCluster.GROUP_SIZE, 10);
EntityAsserts.assertAttributeEquals(cluster, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
}
内容来源于网络,如有侵权,请联系作者删除!