org.apache.brooklyn.api.entity.Entity.relations()方法的使用及代码示例

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

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

Entity.relations介绍

暂无

代码示例

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

public void testCustomEntityRelation() throws Exception {
  TestEntity origT1 = origApp.createAndManageChild(EntitySpec.create(TestEntity.class));
  TestEntity origT2 = origApp.createAndManageChild(EntitySpec.create(TestEntity.class));
  origT1.relations().add(EntityRelations.HAS_TARGET, origT2);
  
  TestApplication newApp = rebind();
  Iterator<Entity> ci = newApp.getChildren().iterator();
  Entity t1 = ci.next();
  Entity t2 = ci.next();
  
  Assert.assertEquals(t1.relations().getRelations(EntityRelations.HAS_TARGET), Collections.singleton(t2));
  Assert.assertEquals(t2.relations().getRelations(EntityRelations.HAS_TARGET), Collections.emptySet());
  Assert.assertEquals(t2.relations().getRelations(EntityRelations.TARGETTED_BY), Collections.singleton(t1));
}

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

entity.relations().add(DockerContainer.RUNNING.getInverseRelationshipType(), this);

相关文章