use of org.tmdmaker.core.model.Identifier in project tmdmaker by tmdmaker.
the class MultivalueAndTest method testBuilder.
@Test
public void testBuilder() {
Diagram diagram = new Diagram();
Entity e1 = Entity.ofEvent(new Identifier("テスト1番号")).withDefaultAttribute();
diagram.addChild(e1);
Entity e2 = Entity.ofResource(new Identifier("テスト2番号")).withDefaultAttribute();
diagram.addChild(e2);
Entity e3 = Entity.ofEvent(new Identifier("テスト3番号")).withDefaultAttribute();
diagram.addChild(e3);
AbstractRelationship r = Relationship.of(e2, e1);
r.connect();
r.setSourceCardinality(Cardinality.MANY);
r.setTargetCardinality(Cardinality.MANY);
MultivalueAndBuilder builder = e1.multivalueAnd().builder();
builder.build();
assertTrue(e1.isHeaderDetail());
assertTrue(e1.multivalueAnd().aggregator() != null);
assertTrue(e1.multivalueAnd().superset() != null);
assertTrue(e1.multivalueAnd().detail() != null);
builder.rollback();
assertTrue(!e1.isHeaderDetail());
assertTrue(e1.multivalueAnd().aggregator() == null);
assertTrue(e1.multivalueAnd().superset() == null);
assertTrue(e1.multivalueAnd().detail() == null);
}
use of org.tmdmaker.core.model.Identifier in project tmdmaker by tmdmaker.
the class MultivalueAndTest method testSuperset.
@Test
public void testSuperset() {
Diagram diagram = new Diagram();
Entity e1 = Entity.ofEvent(new Identifier("テスト1番号")).withDefaultAttribute();
diagram.addChild(e1);
Entity e2 = Entity.ofResource(new Identifier("テスト2番号")).withDefaultAttribute();
diagram.addChild(e2);
Header2DetailRelationship r = new Header2DetailRelationship(e1);
assertEquals(false, r.isConnected());
assertEquals(false, r.isSupersetConnected());
r.connect();
assertEquals(true, r.isConnected());
assertEquals(true, r.isSupersetConnected());
MultivalueAndSuperset sp = r.getMultivalueAndSuperset();
assertEquals(true, sp.isDeletable());
assertEquals(false, sp.isEntityTypeEditable());
assertEquals(true, sp.isNotImplement());
assertEquals(true, sp.createReusedIdentifier() == null);
assertEquals(true, r.isDeletable());
Detail d1 = sp.getDetail();
TransfarReuseKeysToTargetRelationship r2 = new TransfarReuseKeysToTargetRelationship(e2, d1);
r2.connect();
assertEquals(false, sp.isDeletable());
assertEquals(false, r.isDeletable());
assertEquals(r.getAggregator().getSuperset(), sp);
MultivalueAndAggregator a = r.getAggregator();
assertEquals(a.getSubsetList().get(0), e1);
assertEquals(a.getSubsetList().get(1), r.getTarget());
r.disconnect();
assertEquals(false, r.isConnected());
assertEquals(false, r.isSupersetConnected());
}
use of org.tmdmaker.core.model.Identifier in project tmdmaker by tmdmaker.
the class MultivalueOrTest method testSuperset.
@Test
public void testSuperset() {
Diagram diagram = new Diagram();
Entity e1 = Entity.ofEvent(new Identifier("テスト1番号")).withDefaultAttribute();
diagram.addChild(e1);
MultivalueOrBuilder builder = e1.multivalueOr().builder();
builder.typeName("テスト種別").build();
assertEquals(1, e1.multivalueOr().all().size());
builder.rollback();
assertEquals(0, e1.multivalueOr().all().size());
}
use of org.tmdmaker.core.model.Identifier in project tmdmaker by tmdmaker.
the class RelatedRelationshipTest method testTableHelper.
/**
* Test method for {@link org.tmdmaker.core.model.RelatedRelationship}
* .
*/
@Test
public void testTableHelper() {
Diagram diagram = new Diagram();
Entity e1 = Entity.ofResource(new Identifier("テスト1番号")).withDefaultAttribute();
diagram.addChild(e1);
Entity e2 = Entity.ofResource(new Identifier("テスト2番号")).withDefaultAttribute();
diagram.addChild(e2);
AbstractRelationship r = Relationship.of(e1, e2);
r.connect();
CombinationTable t1 = (CombinationTable) r.getTable();
RelatedRelationship rr = (RelatedRelationship) t1.getModelTargetConnections().get(0);
assertEquals("テスト1", rr.getSourceName());
assertEquals("テスト2", rr.getTargetName());
}
use of org.tmdmaker.core.model.Identifier in project tmdmaker by tmdmaker.
the class RelatedRelationshipTest method testVirtualSupersetHelper.
/**
* Test method for {@link org.tmdmaker.core.model.RelatedRelationship}
* .
*/
@Test
public void testVirtualSupersetHelper() {
Diagram diagram = new Diagram();
Entity e1 = Entity.ofEvent(new Identifier("テスト1番号")).withDefaultAttribute();
diagram.addChild(e1);
Entity e2 = Entity.ofEvent(new Identifier("テスト2番号")).withDefaultAttribute();
diagram.addChild(e2);
VirtualSuperset vsp = VirtualSuperset.of(new ModelName("スーパーセット"));
VirtualSupersetType type = new VirtualSupersetType();
diagram.addChild(vsp);
diagram.addChild(type);
RelatedRelationship t2v = new RelatedRelationship(type, vsp);
Entity2VirtualSupersetTypeRelationship m2t1 = new Entity2VirtualSupersetTypeRelationship(e1, type);
Entity2VirtualSupersetTypeRelationship m2t2 = new Entity2VirtualSupersetTypeRelationship(e2, type);
t2v.connect();
m2t1.connect();
m2t2.connect();
assertEquals(true, t2v.isDeletable());
assertEquals("スーパーセット", t2v.getSourceName());
assertEquals("テスト1,テスト2", t2v.getTargetName());
assertEquals("スーパーセット", m2t1.getSourceName());
assertEquals("テスト1", m2t1.getTargetName());
}
Aggregations