Ejemplo n.º 1
0
  @SuppressWarnings("unused")
  @Test
  public void testComponent() {
    God god = new God(true);
    god.setName("THEGOD");
    Universe universe1 = new Universe(god);
    universe1.setName("universe1");
    SpaceTime st1 = new SpaceTime(universe1);
    Space s1 = new Space(st1);
    Time t1 = new Time(st1);

    db.commit();
    Assert.assertEquals(5, countVertices());
    Assert.assertEquals(5, countEdges());
  }
  @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")));
  }