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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations