Search in sources :

Example 1 with MultivalueAndSuperset

use of org.tmdmaker.core.model.MultivalueAndSuperset in project tmdmaker by tmdmaker.

the class ModelFeatureTest method testCanCreateMultivalueOr.

/**
 * モデル毎の多値のOR作成可否をテスト
 */
@Test
public void testCanCreateMultivalueOr() {
    CombinationTable t = new CombinationTable();
    assertEquals(true, t.canCreateMultivalueOr());
    Entity e = new Entity();
    assertEquals(true, e.canCreateMultivalueOr());
    Detail d = new Detail();
    assertEquals(true, d.canCreateMultivalueOr());
    Laputa l = new Laputa();
    assertEquals(false, l.canCreateMultivalueOr());
    MappingList m = new MappingList();
    assertEquals(true, m.canCreateMultivalueOr());
    MultivalueAndSuperset ms = new MultivalueAndSuperset();
    assertEquals(false, ms.canCreateMultivalueOr());
    MultivalueOrEntity mo = new MultivalueOrEntity();
    assertEquals(true, mo.canCreateMultivalueOr());
    RecursiveTable r = new RecursiveTable();
    assertEquals(true, r.canCreateMultivalueOr());
    SubsetEntity s = new SubsetEntity();
    assertEquals(true, s.canCreateMultivalueOr());
    VirtualEntity v = new VirtualEntity();
    assertEquals(false, v.canCreateMultivalueOr());
    VirtualSuperset vs = new VirtualSuperset();
    assertEquals(false, vs.canCreateMultivalueOr());
    Memo mm = new Memo();
    assertEquals(false, mm.canCreateMultivalueOr());
    TurboFile tb = new TurboFile();
    assertEquals(false, tb.canCreateMultivalueOr());
}
Also used : SubsetEntity(org.tmdmaker.core.model.SubsetEntity) MultivalueOrEntity(org.tmdmaker.core.model.MultivalueOrEntity) SubsetEntity(org.tmdmaker.core.model.SubsetEntity) Entity(org.tmdmaker.core.model.Entity) VirtualEntity(org.tmdmaker.core.model.VirtualEntity) MultivalueAndSuperset(org.tmdmaker.core.model.MultivalueAndSuperset) TurboFile(org.tmdmaker.core.model.other.TurboFile) MappingList(org.tmdmaker.core.model.MappingList) MultivalueOrEntity(org.tmdmaker.core.model.MultivalueOrEntity) VirtualSuperset(org.tmdmaker.core.model.VirtualSuperset) CombinationTable(org.tmdmaker.core.model.CombinationTable) VirtualEntity(org.tmdmaker.core.model.VirtualEntity) RecursiveTable(org.tmdmaker.core.model.RecursiveTable) Laputa(org.tmdmaker.core.model.Laputa) Detail(org.tmdmaker.core.model.Detail) Memo(org.tmdmaker.core.model.other.Memo) Test(org.junit.Test)

Example 2 with MultivalueAndSuperset

use of org.tmdmaker.core.model.MultivalueAndSuperset 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 3 with MultivalueAndSuperset

use of org.tmdmaker.core.model.MultivalueAndSuperset in project tmdmaker by tmdmaker.

the class ModelFeatureTest method testCanCreateSubset.

/**
 * モデル毎のサブセットの作成可否をテスト
 */
@Test
public void testCanCreateSubset() {
    CombinationTable t = new CombinationTable();
    assertEquals(true, t.canCreateSubset());
    Entity e = new Entity();
    assertEquals(true, e.canCreateSubset());
    Detail d = new Detail();
    assertEquals(true, d.canCreateSubset());
    Laputa l = new Laputa();
    assertEquals(false, l.canCreateSubset());
    MappingList m = new MappingList();
    assertEquals(true, m.canCreateSubset());
    MultivalueAndSuperset ms = new MultivalueAndSuperset();
    assertEquals(false, ms.canCreateSubset());
    MultivalueOrEntity mo = new MultivalueOrEntity();
    assertEquals(true, mo.canCreateSubset());
    RecursiveTable r = new RecursiveTable();
    assertEquals(true, r.canCreateSubset());
    SubsetEntity s = new SubsetEntity();
    assertEquals(true, s.canCreateSubset());
    VirtualEntity v = new VirtualEntity();
    assertEquals(false, v.canCreateSubset());
    VirtualSuperset vs = new VirtualSuperset();
    assertEquals(false, vs.canCreateSubset());
    Memo mm = new Memo();
    assertEquals(false, mm.canCreateSubset());
    TurboFile tb = new TurboFile();
    assertEquals(false, tb.canCreateSubset());
}
Also used : SubsetEntity(org.tmdmaker.core.model.SubsetEntity) MultivalueOrEntity(org.tmdmaker.core.model.MultivalueOrEntity) SubsetEntity(org.tmdmaker.core.model.SubsetEntity) Entity(org.tmdmaker.core.model.Entity) VirtualEntity(org.tmdmaker.core.model.VirtualEntity) MultivalueAndSuperset(org.tmdmaker.core.model.MultivalueAndSuperset) TurboFile(org.tmdmaker.core.model.other.TurboFile) MappingList(org.tmdmaker.core.model.MappingList) MultivalueOrEntity(org.tmdmaker.core.model.MultivalueOrEntity) VirtualSuperset(org.tmdmaker.core.model.VirtualSuperset) CombinationTable(org.tmdmaker.core.model.CombinationTable) VirtualEntity(org.tmdmaker.core.model.VirtualEntity) RecursiveTable(org.tmdmaker.core.model.RecursiveTable) Laputa(org.tmdmaker.core.model.Laputa) Detail(org.tmdmaker.core.model.Detail) Memo(org.tmdmaker.core.model.other.Memo) Test(org.junit.Test)

Example 4 with MultivalueAndSuperset

use of org.tmdmaker.core.model.MultivalueAndSuperset in project tmdmaker by tmdmaker.

the class ModelFeatureTest method testCanCreateVirtualEntity.

/**
 * モデル毎のみなしエンティティ作成可否をテスト
 */
@Test
public void testCanCreateVirtualEntity() {
    CombinationTable t = new CombinationTable();
    assertEquals(true, t.canCreateVirtualEntity());
    Entity e = new Entity();
    assertEquals(true, e.canCreateVirtualEntity());
    Detail d = new Detail();
    assertEquals(true, d.canCreateVirtualEntity());
    Laputa l = new Laputa();
    assertEquals(false, l.canCreateVirtualEntity());
    MappingList m = new MappingList();
    assertEquals(true, m.canCreateVirtualEntity());
    MultivalueAndSuperset ms = new MultivalueAndSuperset();
    assertEquals(false, ms.canCreateVirtualEntity());
    MultivalueOrEntity mo = new MultivalueOrEntity();
    assertEquals(true, mo.canCreateVirtualEntity());
    RecursiveTable r = new RecursiveTable();
    assertEquals(true, r.canCreateVirtualEntity());
    SubsetEntity s = new SubsetEntity();
    assertEquals(true, s.canCreateVirtualEntity());
    VirtualEntity v = new VirtualEntity();
    assertEquals(false, v.canCreateVirtualEntity());
    VirtualSuperset vs = new VirtualSuperset();
    assertEquals(false, vs.canCreateVirtualEntity());
    Memo mm = new Memo();
    assertEquals(false, mm.canCreateVirtualEntity());
    TurboFile tb = new TurboFile();
    assertEquals(false, tb.canCreateVirtualEntity());
}
Also used : SubsetEntity(org.tmdmaker.core.model.SubsetEntity) MultivalueOrEntity(org.tmdmaker.core.model.MultivalueOrEntity) SubsetEntity(org.tmdmaker.core.model.SubsetEntity) Entity(org.tmdmaker.core.model.Entity) VirtualEntity(org.tmdmaker.core.model.VirtualEntity) MultivalueAndSuperset(org.tmdmaker.core.model.MultivalueAndSuperset) TurboFile(org.tmdmaker.core.model.other.TurboFile) MappingList(org.tmdmaker.core.model.MappingList) MultivalueOrEntity(org.tmdmaker.core.model.MultivalueOrEntity) VirtualSuperset(org.tmdmaker.core.model.VirtualSuperset) CombinationTable(org.tmdmaker.core.model.CombinationTable) VirtualEntity(org.tmdmaker.core.model.VirtualEntity) RecursiveTable(org.tmdmaker.core.model.RecursiveTable) Laputa(org.tmdmaker.core.model.Laputa) Detail(org.tmdmaker.core.model.Detail) Memo(org.tmdmaker.core.model.other.Memo) Test(org.junit.Test)

Example 5 with MultivalueAndSuperset

use of org.tmdmaker.core.model.MultivalueAndSuperset in project tmdmaker by tmdmaker.

the class MultivalueAndTest method testDetail.

@Test
public void testDetail() {
    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(e1);
    Header2DetailRelationship r1 = new Header2DetailRelationship(e1);
    r1.connect();
    MultivalueAndSuperset sp = r1.getMultivalueAndSuperset();
    assertEquals(true, sp != null);
    Detail dtl = (Detail) r1.getTarget();
    assertEquals(true, dtl.isDeletable());
    assertEquals(e1.getIdentifier(), dtl.getOriginalReusedIdentifier().getIdentifiers().get(0).getOriginal());
    assertEquals(false, dtl.isEntityTypeEditable());
    AbstractConnectionModel r2 = Relationship.of(dtl, e2);
    r2.connect();
    assertEquals(false, dtl.isDeletable());
    AbstractConnectionModel r3 = Relationship.of(dtl, e3);
    r3.connect();
    // Detailへの個体指定子変更伝播
    e1.setIdentifierName("テスト1番号変更");
    Map<AbstractEntityModel, ReusedIdentifier> reused1 = dtl.getReusedIdentifiers();
    assertEquals(2, reused1.size());
    ReusedIdentifier ri1 = reused1.get(e1);
    assertEquals("テスト1番号変更", ri1.getIdentifiers().get(0).getName());
    Map<AbstractEntityModel, ReusedIdentifier> reused2 = e3.getReusedIdentifiers();
    assertEquals(1, reused2.size());
    ReusedIdentifier dri1 = reused2.get(dtl);
    assertEquals(2, dri1.getIdentifiers().size());
    assertEquals("テスト1番号変更", dri1.getIdentifiers().get(0).getName());
    assertEquals("テスト1明細番号", dri1.getIdentifiers().get(1).getName());
    // Detailからの個体指定子変更伝播
    dtl.setDetailIdentifierName("テスト1明細番号変更");
    Map<AbstractEntityModel, ReusedIdentifier> reused3 = e3.getReusedIdentifiers();
    assertEquals(1, reused3.size());
    ReusedIdentifier dri2 = reused3.get(dtl);
    assertEquals(2, dri2.getIdentifiers().size());
    assertEquals("テスト1番号変更", dri2.getIdentifiers().get(0).getName());
    assertEquals("テスト1明細番号変更", dri2.getIdentifiers().get(1).getName());
    dtl.setDetailIdentifier(new Identifier("テスト1明細番号変更2"));
    Map<AbstractEntityModel, ReusedIdentifier> reused4 = e3.getReusedIdentifiers();
    assertEquals(1, reused4.size());
    ReusedIdentifier dri3 = reused4.get(dtl);
    assertEquals(2, dri3.getIdentifiers().size());
    assertEquals("テスト1番号変更", dri3.getIdentifiers().get(0).getName());
    // 伝播しない
    assertEquals("テスト1明細番号変更", dri3.getIdentifiers().get(1).getName());
}
Also used : ReusedIdentifier(org.tmdmaker.core.model.ReusedIdentifier) 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) Detail(org.tmdmaker.core.model.Detail) AbstractEntityModel(org.tmdmaker.core.model.AbstractEntityModel) Diagram(org.tmdmaker.core.model.Diagram) AbstractConnectionModel(org.tmdmaker.core.model.AbstractConnectionModel) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)5 Detail (org.tmdmaker.core.model.Detail)5 Entity (org.tmdmaker.core.model.Entity)5 MultivalueAndSuperset (org.tmdmaker.core.model.MultivalueAndSuperset)5 CombinationTable (org.tmdmaker.core.model.CombinationTable)3 Laputa (org.tmdmaker.core.model.Laputa)3 MappingList (org.tmdmaker.core.model.MappingList)3 MultivalueOrEntity (org.tmdmaker.core.model.MultivalueOrEntity)3 RecursiveTable (org.tmdmaker.core.model.RecursiveTable)3 SubsetEntity (org.tmdmaker.core.model.SubsetEntity)3 VirtualEntity (org.tmdmaker.core.model.VirtualEntity)3 VirtualSuperset (org.tmdmaker.core.model.VirtualSuperset)3 Memo (org.tmdmaker.core.model.other.Memo)3 TurboFile (org.tmdmaker.core.model.other.TurboFile)3 Diagram (org.tmdmaker.core.model.Diagram)2 Header2DetailRelationship (org.tmdmaker.core.model.Header2DetailRelationship)2 Identifier (org.tmdmaker.core.model.Identifier)2 ReusedIdentifier (org.tmdmaker.core.model.ReusedIdentifier)2 AbstractConnectionModel (org.tmdmaker.core.model.AbstractConnectionModel)1 AbstractEntityModel (org.tmdmaker.core.model.AbstractEntityModel)1