本文整理了Java中org.apache.brooklyn.api.mgmt.EntityManager.isManaged()
方法的一些代码示例,展示了EntityManager.isManaged()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EntityManager.isManaged()
方法的具体详情如下:
包路径:org.apache.brooklyn.api.mgmt.EntityManager
类名称:EntityManager
方法名:isManaged
[英]whether the entity is under management by this management context
[中]实体是否受此管理上下文的管理
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
private void testLocationUnmanagedOnStop(LocationSpec<? extends Location> locationSpec) {
EntitySpec<BasicApplication> appSpec = EntitySpec.create(BasicApplication.class)
.location(locationSpec);
BasicApplication app = mgmt.getEntityManager().createEntity(appSpec);
app.start(ImmutableList.<Location>of());
Location appLocation = Iterables.getOnlyElement(app.getLocations());
NamedStringTag ownerEntityTag = BrooklynTags.findFirst(BrooklynTags.OWNER_ENTITY_ID, appLocation.tags().getTags());
Assert.assertNotNull(ownerEntityTag);
Assert.assertEquals(ownerEntityTag.getContents(), app.getId());
app.stop();
Assert.assertFalse(mgmt.getEntityManager().isManaged(app));
Set<Location> locs = ImmutableSet.copyOf(mgmt.getLocationManager().getLocations());
Assert.assertFalse(locs.contains(appLocation), locs + " should not contain " + appLocation);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
private void testLocationUnmanagedOnStop(LocationSpec<? extends Location> locationSpec) {
EntitySpec<BasicApplication> appSpec = EntitySpec.create(BasicApplication.class)
.location(locationSpec)
.child(EntitySpec.create(EmptySoftwareProcess.class)
.configure(BrooklynConfigKeys.SKIP_ON_BOX_BASE_DIR_RESOLUTION, Boolean.TRUE)
.configure(EmptySoftwareProcess.USE_SSH_MONITORING, Boolean.FALSE));
BasicApplication app = mgmt.getEntityManager().createEntity(appSpec);
Entity child = Iterables.getOnlyElement(app.getChildren());
Assert.assertEquals(child.getLocations(), ImmutableList.of());
app.start(ImmutableList.<Location>of());
Location appLocation = Iterables.getOnlyElement(app.getLocations());
assertOwned(app, appLocation);
Location entityLocation = Iterables.getOnlyElement(child.getLocations());
// No owner tag because it's created by SoftwareProcess, not by Brooklyn internals
assertNotOwned(entityLocation);
app.stop();
Assert.assertEquals(child.getLocations(), ImmutableList.of());
Assert.assertFalse(mgmt.getEntityManager().isManaged(child));
Assert.assertFalse(mgmt.getEntityManager().isManaged(app));
Set<Location> locs = ImmutableSet.copyOf(mgmt.getLocationManager().getLocations());
Assert.assertFalse(locs.contains(entityLocation), locs + " should not contain " + entityLocation);
Assert.assertFalse(locs.contains(appLocation), locs + " should not contain " + appLocation);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
assertFalse(mgmt.getEntityManager().isManaged(app), "App should already be unmanaged");
内容来源于网络,如有侵权,请联系作者删除!