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

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

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

EntityManager.getEntitiesInApplication介绍

[英]All entities managed as part of the given application
[中]作为给定应用程序的一部分管理的所有实体

代码示例

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

@Override
public Collection<Entity> getEntitiesInApplication(Application application) {
  if (isInitialManagementContextReal()) {
    return initialManagementContext.getEntityManager().getEntitiesInApplication(application);
  } else {
    return Collections.emptyList();
  }
}

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

@Test(groups = "Integration")
private void testReadAndWriteDifferentRouters() {
  MongoDBShardedDeployment deployment = makeAndStartDeployment();
  EntityAsserts.assertAttributeEqualsEventually(deployment, Startable.SERVICE_UP, true);
  MongoDBRouter router1 = (MongoDBRouter) Iterables.get(deployment.getRouterCluster().getMembers(), 0);
  MongoDBRouter router2 = (MongoDBRouter) Iterables.get(deployment.getRouterCluster().getMembers(), 1);
  EntityAsserts.assertAttributeEqualsEventually(router1, Startable.SERVICE_UP, true);
  EntityAsserts.assertAttributeEqualsEventually(router2, Startable.SERVICE_UP, true);
  
  String documentId = MongoDBTestHelper.insert(router1, "meaning-of-life", 42);
  DBObject docOut = MongoDBTestHelper.getById(router2, documentId);
  Assert.assertEquals(docOut.get("meaning-of-life"), 42);
  
  for (Entity entity : Iterables.filter(app.getManagementContext().getEntityManager().getEntitiesInApplication(app), AbstractMongoDBServer.class)) {
    EntityAsserts.assertAttributeEqualsEventually(entity, Startable.SERVICE_UP, true);
  }
}

代码示例来源: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));
}

相关文章