本文整理了Java中org.apache.brooklyn.core.entity.Entities.isManaged()
方法的一些代码示例,展示了Entities.isManaged()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entities.isManaged()
方法的具体详情如下:
包路径:org.apache.brooklyn.core.entity.Entities
类名称:Entities
方法名:isManaged
暂无
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Override
public boolean apply(@Nullable Entity input) {
return (input != null) && Entities.isManaged(input);
}
@Override
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Override
public void run() {
log.debug("destroying app "+app+" (managed? "+isManaged(app)+"; mgmt is "+mgmt+")");
try {
destroy(app);
log.debug("destroyed app "+app+"; mgmt now "+mgmt);
} catch (Exception e) {
log.warn("problems destroying app "+app+" (mgmt now "+mgmt+", will rethrow at least one exception): "+e);
error.compareAndSet(null, e);
}
}}));
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
@Override
public void run() {
assertFalse(Entities.isManaged(node));
}
});
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
@Override
public void run() {
assertTrue(!Entities.isManaged(entity));
assertTrue(!Entities.isManaged(app));
}
});
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testStartAndStopWhenManagedCallsChildren() {
TestEntity child = app.createAndManageChild(EntitySpec.create(TestEntity.class));
assertTrue(Entities.isManaged(app));
assertTrue(Entities.isManaged(child));
app.start(locs);
assertEquals(child.getCallHistory(), ImmutableList.of("start"));
app.stop();
assertEquals(child.getCallHistory(), ImmutableList.of("start", "stop"));
assertFalse(Entities.isManaged(child));
assertFalse(Entities.isManaged(app));
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
/** convenience for starting an entity, esp a new Startable instance which has been created dynamically
* (after the application is started) */
public static void start(Entity e, Collection<? extends Location> locations) {
if (!isManaged(e) && !manage(e)) {
log.warn("Using deprecated discouraged mechanism to start management -- Entities.start(Application, Locations) -- caller should create and use the preferred management context");
startManagement(e);
}
if (e instanceof Startable) Entities.invokeEffector(e, e, Startable.START,
MutableMap.of("locations", locations)).getUnchecked();
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-policy
@Override public void run() {
Set<Entity> newMembers = Sets.difference(ImmutableSet.copyOf(cluster.getMembers()), initialMembers);
Set<Entity> removedMembers = Sets.difference(initialMembers, ImmutableSet.copyOf(cluster.getMembers()));
assertEquals(removedMembers, ImmutableSet.of(e1));
assertEquals(newMembers.size(), 1);
assertEquals(((TestEntity)Iterables.getOnlyElement(newMembers)).getCallHistory(), ImmutableList.of("start"));
assertEquals(e1.getCallHistory(), ImmutableList.of("start", "stop"));
assertFalse(Entities.isManaged(e1));
}});
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-policy
@Override public void run() {
Set<Entity> newMembers = Sets.difference(ImmutableSet.copyOf(cluster.getMembers()), initialMembers);
Set<Entity> removedMembers = Sets.difference(initialMembers, ImmutableSet.copyOf(cluster.getMembers()));
assertEquals(removedMembers, ImmutableSet.of(e1));
assertEquals(newMembers.size(), 1);
assertEquals(((TestEntity)Iterables.getOnlyElement(newMembers)).getCallHistory(), ImmutableList.of("start"));
assertEquals(e1.getCallHistory(), ImmutableList.of("start", "stop"));
assertFalse(Entities.isManaged(e1));
}});
代码示例来源:origin: org.apache.brooklyn/brooklyn-policy
@Override public void run() {
Set<Entity> newMembers = Sets.difference(ImmutableSet.copyOf(newCluster.getMembers()), initialMembers);
Set<Entity> removedMembers = Sets.difference(initialMembers, ImmutableSet.copyOf(newCluster.getMembers()));
assertEquals(removedMembers, ImmutableSet.of(e1));
assertEquals(newMembers.size(), 1);
assertEquals(((TestEntity)Iterables.getOnlyElement(newMembers)).getCallHistory(), ImmutableList.of("start"));
// TODO e1 not reporting "start" after rebind because callHistory is a field rather than an attribute, so was not persisted
Asserts.assertEqualsIgnoringOrder(e1.getCallHistory(), ImmutableList.of("stop"));
assertFalse(Entities.isManaged(e1));
}});
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
@Override
public Integer call() {
if (!Entities.isManaged(MyServiceWithFeedsImpl.this)) {
feedCalledWhenNotManaged = true;
throw new IllegalStateException("Entity "+MyServiceWithFeedsImpl.this+" is not managed in feed.call");
}
Integer oldVal = sensors().get(COUNTER);
return (oldVal == null ? 0 : oldVal) + 1;
}
}))
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testExpungeMembersWithoutStop() throws Exception {
group.addMember(e1);
group.addMember(e2);
group.expungeMembers(false);
assertFalse(Entities.isManaged(e1));
assertFalse(Entities.isManaged(e2));
assertEquals(e1.getCallHistory(), ImmutableList.of());
assertEquals(e2.getCallHistory(), ImmutableList.of());
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testStartManagementOfEntityIsNoop() throws Exception {
Entity app2 = mgmt.getEntityManager().createEntity(EntitySpec.create(TestApplication.class));
assertTrue(Entities.isManaged(app2));
Entities.startManagement(app2);
assertTrue(Entities.isManaged(app2));
listener.assertEventsEqualsEventually(ImmutableList.of(new ChangeEvent(ChangeType.ADDED, app2)));
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testStopOnManagedAppDoesNotStopPremanagedChildren() {
app.start(locs);
// deliberately unmanaged
TestEntity child = new TestEntityImpl(app);
assertFalse(Entities.isManaged(child));
app.stop();
assertEquals(child.getCallHistory(), ImmutableList.of());
}
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testAddedChildSpec() throws Exception {
TestEntity e = app.addChild(EntitySpec.create(TestEntity.class));
assertTrue(Entities.isManaged(e));
listener.assertEventsEqualsEventually(ImmutableList.of(new ChangeEvent(ChangeType.ADDED, e)));
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testNewApp() throws Exception {
TestApplication app2 = mgmt.getEntityManager().createEntity(EntitySpec.create(TestApplication.class));
assertTrue(Entities.isManaged(app2));
assertTrue(mgmt.getApplications().contains(app2), "app="+app2+"; apps="+mgmt.getApplications());
app.addChild(app2);
assertTrue(Entities.isManaged(app2));
listener.assertEventsEqualsEventually(ImmutableList.of(new ChangeEvent(ChangeType.ADDED, app2)));
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testNewEntityWithParent() throws Exception {
TestEntity e = app.addChild(EntitySpec.create(TestEntity.class)
.parent(app));
assertTrue(Entities.isManaged(e));
assertEquals(e.getParent(), app);
listener.assertEventsEqualsEventually(ImmutableList.of(new ChangeEvent(ChangeType.ADDED, e)));
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testNewOrphanedEntityCanBeAddedToChild() throws Exception {
TestEntity e = mgmt.getEntityManager().createEntity(EntitySpec.create(TestEntity.class));
app.addChild(e);
assertTrue(Entities.isManaged(e));
listener.assertEventsEqualsEventually(ImmutableList.of(new ChangeEvent(ChangeType.ADDED, e)));
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testAddingSameChildAgainIsNoop() throws Exception {
TestEntity e = app.addChild(EntitySpec.create(TestEntity.class)
.parent(app));
app.addChild(e);
assertTrue(Entities.isManaged(e));
assertEquals(e.getParent(), app);
listener.assertEventsEqualsEventually(ImmutableList.of(new ChangeEvent(ChangeType.ADDED, e)));
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testNewOrphanedEntityIsManaged() throws Exception {
TestEntity e = mgmt.getEntityManager().createEntity(EntitySpec.create(TestEntity.class));
assertTrue(Entities.isManaged(e));
listener.assertEventsEqualsEventually(ImmutableList.of(new ChangeEvent(ChangeType.ADDED, e)));
// Check that orphaned entity doesn't interfere with getApplications
Asserts.assertEqualsIgnoringOrder(mgmt.getApplications(), ImmutableList.of(app));
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testManageIsNoop() throws Exception {
TestEntity child = mgmt.getEntityManager().createEntity(EntitySpec.create(TestEntity.class)
.parent(app));
Entities.manage(child);
assertTrue(Entities.isManaged(child));
listener.assertEventsEqualsEventually(ImmutableList.of(new ChangeEvent(ChangeType.ADDED, child)));
}
内容来源于网络,如有侵权,请联系作者删除!