org.apache.brooklyn.api.mgmt.EntityManager.findEntitiesInApplication()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中org.apache.brooklyn.api.mgmt.EntityManager.findEntitiesInApplication()方法的一些代码示例,展示了EntityManager.findEntitiesInApplication()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EntityManager.findEntitiesInApplication()方法的具体详情如下:
包路径:org.apache.brooklyn.api.mgmt.EntityManager
类名称:EntityManager
方法名:findEntitiesInApplication

EntityManager.findEntitiesInApplication介绍

[英]All entities managed as part of the given application that match the given filter
[中]作为给定应用程序的一部分管理的、与给定筛选器匹配的所有实体

代码示例

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

@Override
public Collection<Entity> findEntitiesInApplication(Application application, Predicate<? super Entity> filter) {
  if (isInitialManagementContextReal()) {
    return initialManagementContext.getEntityManager().findEntitiesInApplication(application, filter);
  } else {
    return Collections.emptyList();
  }
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

@Test
public void testGetEntities() {
  TestApplication app2 = mgmt.getEntityManager().createEntity(EntitySpec.create(TestApplication.class));
  TestEntity entity = app.createAndManageChild(EntitySpec.create(TestEntity.class));
  TestEntity child = entity.createAndManageChild(EntitySpec.create(TestEntity.class));
  
  Asserts.assertEqualsIgnoringOrder(entityManager.getEntitiesInApplication(app), ImmutableList.of(app, entity, child));
  Asserts.assertEqualsIgnoringOrder(entityManager.getEntities(), ImmutableList.of(app, entity, child, app2));
  Asserts.assertEqualsIgnoringOrder(entityManager.findEntities(Predicates.instanceOf(TestApplication.class)), ImmutableList.of(app, app2));
  Asserts.assertEqualsIgnoringOrder(entityManager.findEntitiesInApplication(app, Predicates.instanceOf(TestApplication.class)), ImmutableList.of(app));
}

相关文章