org.apache.brooklyn.core.entity.Entities.unmanage()方法的使用及代码示例

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

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

Entities.unmanage介绍

暂无

代码示例

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

@Override
  public void run() {
    Entities.unmanage(dryRunChild);
  }
}

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

protected void discardNode(Entity entity) {
  removeMember(entity);
  try {
    Entities.unmanage(entity);
  } catch (IllegalStateException e) {
    //probably already unmanaged
    LOG.debug("Exception during removing member of cluster " + this + ", unmanaging node " + entity + ". The node is probably already unmanaged.", e);
  }
}

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

@Test
public void testAddingUnmanagedMemberDoesNotFailBadly() throws Exception {
  Entities.unmanage(entity1);
  group.addMember(entity1);
  Entities.unmanage(group);
}

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

@Test
public void testAddingUnmanagedGroupDoesNotFailBadly() throws Exception {
  Entities.unmanage(group);
  entity1.groups().add(group);
  Entities.unmanage(entity1);
}

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

@Override public Void call() {
      try {
        containerToStop.offloadAndStop(containers.get(containers.size()-1));
        Entities.unmanage(containerToStop);
      } catch (Throwable t) {
        LOG.error("Error stopping container "+containerToStop, t);
      }
      return null;
    }});
}

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

@Override public void run() {
  try {
    addingMemberReachedLatch.await();
  } catch (InterruptedException e) {
    throw Exceptions.propagate(e);
  }
  Entities.unmanage(e2);
}});

代码示例来源:origin: io.brooklyn.clocker/brooklyn-clocker-docker

@Override
public void removeHost(DockerHost host) {
  SdnAgent agent = host.sensors().get(SdnAgent.SDN_AGENT);
  if (agent == null) {
    LOG.warn("{} cannot find Weave service: {}", this, host);
    return;
  }
  agent.stop();
  getAgents().removeMember(agent);
  Entities.unmanage(agent);
  LOG.debug("{} removed Weave service {}", this, agent);
}

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

@Test
public void testManaged() throws Exception {
  assertTrue(EntityPredicates.isManaged().apply(entity));
  Entities.unmanage(entity);
  assertFalse(EntityPredicates.isManaged().apply(entity));
}

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

protected void stopAndRemoveNode(Entity member) {
  removeMember(member);
  try {
    if (member instanceof Startable) {
      Task<?> task = newThrottledEffectorTask(member, Startable.STOP, Collections.<String, Object>emptyMap());
      DynamicTasks.queueIfPossible(task).orSubmitAsync();
      task.getUnchecked();
    }
  } finally {
    Entities.unmanage(member);
  }
}

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

@Test(groups = "Integration")
public void testTargetMappingsRemovesUnmanagedMember() {
  Iterable<StubAppServer> members = Iterables.filter(cluster.getChildren(), StubAppServer.class);
  assertEquals(Iterables.size(members), 2);
  StubAppServer target1 = Iterables.get(members, 0);
  StubAppServer target2 = Iterables.get(members, 1);
  
  // First wait for targets to be listed
  assertExpectedTargetsEventually(members);
  
  // Unmanage one member, and expect the URL Mapping to be updated accordingly
  Entities.unmanage(target1);
  assertExpectedTargetsEventually(ImmutableSet.of(target2));
}

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

@Test
public void testUnmanagedMemberAutomaticallyRemoved() throws Exception {
  group.addMember(entity1);
  Entities.unmanage(entity1);
  assertGroupMembers(new Entity[0]);
}

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

@Test
public void testUnmanagedGroupAutomaticallyRemovedMembers() throws Exception {
  group.addMember(entity1);
  Entities.unmanage(group);
  Asserts.assertEqualsIgnoringOrder(entity1.groups(), ImmutableSet.of());
}

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

@Test
public void testStartOnManagedAppDoesNotStartUnmanagedChildren() {
  TestEntity child = app.createAndManageChild(EntitySpec.create(TestEntity.class));
  Entities.unmanage(child);
  
  app.start(locs);
  assertEquals(child.getCallHistory(), ImmutableList.of());
}

代码示例来源:origin: io.brooklyn.clocker/brooklyn-clocker-mesos

@Override
public void deleteUnmanagedTasks() {
  for (Entity member : getTaskCluster().getMembers()) {
    if (member instanceof MesosTask && Boolean.FALSE.equals(member.config().get(MesosTask.MANAGED))) {
      // TODO Presumably `unmanage(member)` would be enough, but leaving like this
      // because that is what Andrew previously used!
      getTaskCluster().removeMember(member);
      getTaskCluster().removeChild(member);
      Entities.unmanage(member);
    }
  }
}

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

@Test
public void testStopDoesNotStopUnmanagedChildren() {
  TestEntity child = app.createAndManageChild(EntitySpec.create(TestEntity.class));
  
  app.start(locs);
  assertEquals(child.getCallHistory(), ImmutableList.of("start"));
  
  Entities.unmanage(child);
  
  app.stop();
  assertEquals(child.getCallHistory(), ImmutableList.of("start"));
}

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

@Test
public void testUnmanageEntityRemovedAsChild() {
  Entity e = app.addChild(EntitySpec.create(TestEntity.class));
  Entities.unmanage(e);
  
  assertEqualsIgnoringOrder(app.getChildren(), ImmutableList.of());
  assertEquals(e.getParent(), null);
}

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

@Test
public void testStartManagementFailsIfAppDeleted() throws Exception {
  TestApplication app2 = mgmt.getEntityManager().createEntity(EntitySpec.create(TestApplication.class));
  Entities.unmanage(app2);
  
  try {
    Entities.startManagement(app2, mgmt);
    fail("Managed deleted app "+app2+" in "+mgmt);
  } catch (IllegalStateException e) {
    if (!(e.toString().contains("No concrete entity known"))) throw e;
  }
}

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

@Test
public void testContainerRemovedWillRemoveItsItems() throws Exception {
  MockContainerEntity containerA = newContainer(app, "A", "ingroup");
  MockItemEntity item1 = newItem(app, containerA, "1");
  assertItemsEventually(item1);
  
  Entities.unmanage(containerA);
  assertItemsEventually();
}

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

@Test
public void testGroupRemovesUnmanagedEntity() throws Exception {
  group.setEntityFilter(EntityPredicates.idEqualTo(e1.getId()));
  assertEqualsIgnoringOrder(group.getMembers(), ImmutableSet.of(e1));
  
  Entities.unmanage(e1);
  
  Asserts.succeedsEventually(new Runnable() {
    @Override
    public void run() {
      assertEqualsIgnoringOrder(group.getMembers(), ImmutableSet.of());
    }});
}

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

@Override
  public Void call() throws Exception {
    TestEntity entity = app.addChild(EntitySpec.create(TestEntity.class));
    entity.sensors().set(TestEntity.SERVICE_UP, true);
    entity.sensors().set(TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
    Thread.sleep(10);
    assertEquals(entity.sensors().get(TestEntity.SERVICE_UP), Boolean.TRUE);
    assertEquals(entity.sensors().get(TestEntity.SERVICE_STATE_ACTUAL), Lifecycle.RUNNING);
    Entities.unmanage(entity);
    return null;
  }});
futures.add(future);

相关文章