コード例 #1
0
ファイル: ModelTests.java プロジェクト: CategoricalData/easik
  /*
   * Creates two entityNodes with the same name and adds them at the same time
   * Not really sure what shoud happen here
   */
  @Test
  public void testDuplicateNameCreation() {
    EntityNode en = new EntityNode("TestNode", _sketch);
    EntityNode en1 = new EntityNode("TestNode", _sketch);

    _sketch.addEntity(en, en1);

    assertEquals("Names should not be equal", false, en.getName().equals(en1.getName()));
  }
コード例 #2
0
ファイル: ModelTests.java プロジェクト: CategoricalData/easik
  /*
   * Tries to query an attribute that does exist
   * Should work fine
   */
  @Test
  public void testQueryExistingAtt() throws QueryException {
    EntityNode en = new EntityNode("H", _sketch);
    en.addEntityAttribute(
        new EntityAttribute<SketchFrame, SketchGraphModel, Sketch, EntityNode, SketchEdge>(
            "h", new Int(), en));
    _sketch.addEntity(en);

    QueryNode qn = new QueryNode("TestNode", _view, "");
    qn.setQuery("Select h from H");
    _view.addEntity(qn);

    assertEquals(
        "We only queried h from H so must be h", "h", qn.getEntityAttributes().get(0).getName());
  }
コード例 #3
0
ファイル: ModelTests.java プロジェクト: CategoricalData/easik
  /*
   * Creates two EntityNodes, an edge between them, queries them both
   * and then renames everything.
   */
  @Test
  public void testModelNameChanges() throws QueryException {
    EntityNode en = new EntityNode("oldK", _sketch);
    EntityNode en1 = new EntityNode("oldL", _sketch);
    _sketch.addEntity(en, en1);

    NormalEdge sk = new NormalEdge(en, en1, "old");
    _sketch.addEdge(sk);

    QueryNode qn = new QueryNode("v_K", _view, "Select * from oldK");
    QueryNode qn1 = new QueryNode("v_L", _view, "Select * from oldL");
    _view.addEntity(qn, qn1);

    assertEquals("Edge name in view should be old", true, _view.getEdges().containsKey("old"));

    sk.setName("new");
    en.setName("newK");
    en1.setName("newL");

    assertEquals("Queried Node in v_K should be newK", "newK", qn.getQueriedEntity().getName());
    assertEquals("Queried Node in v_L should be newL", "newL", qn1.getQueriedEntity().getName());
    assertEquals(
        "Edge name in view should have changed to new", true, _view.getEdges().containsKey("new"));
  }