Search in sources :

Example 6 with Identifier

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);
}
Also used : Entity(org.tmdmaker.core.model.Entity) ReusedIdentifier(org.tmdmaker.core.model.ReusedIdentifier) Identifier(org.tmdmaker.core.model.Identifier) AbstractRelationship(org.tmdmaker.core.model.AbstractRelationship) MultivalueAndBuilder(org.tmdmaker.core.model.multivalue.MultivalueAndBuilder) Diagram(org.tmdmaker.core.model.Diagram) Test(org.junit.Test)

Example 7 with Identifier

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());
}
Also used : Entity(org.tmdmaker.core.model.Entity) ReusedIdentifier(org.tmdmaker.core.model.ReusedIdentifier) Identifier(org.tmdmaker.core.model.Identifier) MultivalueAndSuperset(org.tmdmaker.core.model.MultivalueAndSuperset) Header2DetailRelationship(org.tmdmaker.core.model.Header2DetailRelationship) TransfarReuseKeysToTargetRelationship(org.tmdmaker.core.model.TransfarReuseKeysToTargetRelationship) MultivalueAndAggregator(org.tmdmaker.core.model.MultivalueAndAggregator) Detail(org.tmdmaker.core.model.Detail) Diagram(org.tmdmaker.core.model.Diagram) Test(org.junit.Test)

Example 8 with Identifier

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());
}
Also used : Entity(org.tmdmaker.core.model.Entity) Identifier(org.tmdmaker.core.model.Identifier) MultivalueOrBuilder(org.tmdmaker.core.model.multivalue.MultivalueOrBuilder) Diagram(org.tmdmaker.core.model.Diagram) Test(org.junit.Test)

Example 9 with Identifier

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());
}
Also used : Entity(org.tmdmaker.core.model.Entity) Identifier(org.tmdmaker.core.model.Identifier) AbstractRelationship(org.tmdmaker.core.model.AbstractRelationship) RelatedRelationship(org.tmdmaker.core.model.RelatedRelationship) Diagram(org.tmdmaker.core.model.Diagram) CombinationTable(org.tmdmaker.core.model.CombinationTable) Test(org.junit.Test)

Example 10 with Identifier

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());
}
Also used : Entity(org.tmdmaker.core.model.Entity) VirtualSupersetType(org.tmdmaker.core.model.VirtualSupersetType) Identifier(org.tmdmaker.core.model.Identifier) ModelName(org.tmdmaker.core.model.parts.ModelName) Entity2VirtualSupersetTypeRelationship(org.tmdmaker.core.model.Entity2VirtualSupersetTypeRelationship) RelatedRelationship(org.tmdmaker.core.model.RelatedRelationship) VirtualSuperset(org.tmdmaker.core.model.VirtualSuperset) Diagram(org.tmdmaker.core.model.Diagram) Test(org.junit.Test)

Aggregations

Identifier (org.tmdmaker.core.model.Identifier)38 Entity (org.tmdmaker.core.model.Entity)28 Test (org.junit.Test)25 Diagram (org.tmdmaker.core.model.Diagram)23 ModelName (org.tmdmaker.core.model.parts.ModelName)18 AbstractEntityModel (org.tmdmaker.core.model.AbstractEntityModel)11 ArrayList (java.util.ArrayList)10 VirtualSuperset (org.tmdmaker.core.model.VirtualSuperset)8 VirtualSupersetType (org.tmdmaker.core.model.VirtualSupersetType)5 Attribute (org.tmdmaker.core.model.Attribute)4 Detail (org.tmdmaker.core.model.Detail)4 Header2DetailRelationship (org.tmdmaker.core.model.Header2DetailRelationship)4 ReusedIdentifier (org.tmdmaker.core.model.ReusedIdentifier)4 VirtualSubsetBuilder (org.tmdmaker.core.model.virtual.VirtualSubsetBuilder)4 AbstractRelationship (org.tmdmaker.core.model.AbstractRelationship)3 RelatedRelationship (org.tmdmaker.core.model.RelatedRelationship)3 EditPart (org.eclipse.gef.EditPart)2 Before (org.junit.Before)2 AbstractConnectionModel (org.tmdmaker.core.model.AbstractConnectionModel)2 Entity2VirtualSupersetTypeRelationship (org.tmdmaker.core.model.Entity2VirtualSupersetTypeRelationship)2