@Test public void testQualifierToAbstractClass() { Q q = new Q(); q.setName("q1"); ConcreteQ1 concreteQ1 = new ConcreteQ1(); concreteQ1.setName("concreteQ11"); q.addToAbstractQ(concreteQ1); ConcreteQ1 concreteQ2 = new ConcreteQ1(); concreteQ2.setName("concreteQ12"); q.addToAbstractQ(concreteQ2); ConcreteQ2 concreteQ21 = new ConcreteQ2(); concreteQ21.setName("concreteQ21"); q.addToAbstractQ(concreteQ21); ConcreteQ2 concreteQ22 = new ConcreteQ2(); concreteQ22.setName("concreteQ22"); q.addToAbstractQ(concreteQ22); UMLG.get().commit(); q.reload(); Assert.assertEquals(4, q.getAbstractQ().size()); Assert.assertNotNull( q.getAbstractQForAbstractQNameQualifier(Pair.of(Compare.eq, "concreteQ11"))); Assert.assertNotNull( q.getAbstractQForAbstractQNameQualifier(Pair.of(Compare.eq, "concreteQ12"))); Assert.assertNotNull( q.getAbstractQForAbstractQNameQualifier(Pair.of(Compare.eq, "concreteQ21"))); Assert.assertNotNull( q.getAbstractQForAbstractQNameQualifier(Pair.of(Compare.eq, "concreteQ22"))); Assert.assertEquals( concreteQ1, q.getAbstractQForAbstractQNameQualifier(Pair.of(Compare.eq, "concreteQ11"))); Assert.assertEquals( concreteQ2, q.getAbstractQForAbstractQNameQualifier(Pair.of(Compare.eq, "concreteQ12"))); Assert.assertEquals( concreteQ21, q.getAbstractQForAbstractQNameQualifier(Pair.of(Compare.eq, "concreteQ21"))); Assert.assertEquals( concreteQ22, q.getAbstractQForAbstractQNameQualifier(Pair.of(Compare.eq, "concreteQ22"))); }
@Test public void testQualifierOnManyToManySet() { God god = new God(true); god.setName("THEGOD"); Many1 many1_1 = new Many1(true); many1_1.setName("many1_1"); many1_1.addToGod(god); Many1 many1_2 = new Many1(true); many1_2.setName("many1_1"); many1_2.addToGod(god); Many1 many1_3 = new Many1(true); many1_3.setName("many1_1"); many1_3.addToGod(god); Many1 many1_4 = new Many1(true); many1_4.setName("many1_4"); many1_4.addToGod(god); Many2 many2_1 = new Many2(true); many2_1.setName("many2_1"); many2_1.addToGod(god); Many2 many2_2 = new Many2(true); many2_2.setName("many2_2"); many2_2.addToGod(god); Many2 many2_3 = new Many2(true); many2_3.setName("many2_3"); many2_3.addToGod(god); Many2 many2_4 = new Many2(true); many2_4.setName("many2_4"); many2_4.addToGod(god); many1_1.addToMany2(many2_1); many1_1.addToMany2(many2_2); many1_1.addToMany2(many2_3); many1_1.addToMany2(many2_4); many1_2.addToMany2(many2_1); many1_2.addToMany2(many2_2); many1_2.addToMany2(many2_3); many1_2.addToMany2(many2_4); many1_3.addToMany2(many2_1); many1_3.addToMany2(many2_2); many1_3.addToMany2(many2_3); many1_3.addToMany2(many2_4); many1_4.addToMany2(many2_1); many1_4.addToMany2(many2_2); many1_4.addToMany2(many2_3); many1_4.addToMany2(many2_4); db.commit(); Assert.assertEquals(9, countVertices()); Assert.assertEquals(25, countEdges()); Many1 m = new Many1(many1_1.getVertex()); Assert.assertNotNull(m.getMany2ForMany2Qualifier1(Pair.of(Compare.eq, "many2_1"))); Assert.assertNotNull(m.getMany2ForMany2Qualifier1(Pair.of(Compare.eq, "many2_2"))); Assert.assertNotNull(m.getMany2ForMany2Qualifier1(Pair.of(Compare.eq, "many2_3"))); Assert.assertNotNull(m.getMany2ForMany2Qualifier1(Pair.of(Compare.eq, "many2_4"))); Many2 m2 = new Many2(many2_1.getVertex()); Assert.assertNotNull(m2.getMany1ForMany1Qualifier1(Pair.of(Compare.eq, "many1_1"))); Assert.assertNotNull(m2.getMany1ForMany1Qualifier1(Pair.of(Compare.eq, "many1_1"))); Assert.assertNotNull(m2.getMany1ForMany1Qualifier1(Pair.of(Compare.eq, "many1_1"))); Assert.assertNotNull(m2.getMany1ForMany1Qualifier1(Pair.of(Compare.eq, "many1_1"))); Assert.assertNotNull(m2.getMany1ForMany1Qualifier1(Pair.of(Compare.eq, "many1_4"))); Assert.assertNotNull(m2.getMany1ForMany1Qualifier1(Pair.of(Compare.eq, "many1_4"))); Assert.assertNotNull(m2.getMany1ForMany1Qualifier1(Pair.of(Compare.eq, "many1_4"))); Assert.assertNotNull(m2.getMany1ForMany1Qualifier1(Pair.of(Compare.eq, "many1_4"))); }