예제 #1
0
 protected String getId(Transformer transformer, Column column) {
   return getIdPrefix()
       + "_"
       + transformer.getClass().getSimpleName()
       + "_column_"
       + column.getId();
 }
예제 #2
0
  @Test
  public void testGetAttributeKeys() {
    GraphStore store = new GraphStore();
    Column column = generateBasicColumn(store);

    NodeImpl node = new NodeImpl("0", store);
    Set<String> pk = node.getAttributeKeys();
    Assert.assertTrue(pk.contains(column.getId()));
    Assert.assertEquals(pk.size(), 1 + getElementPropertiesLength());
  }
예제 #3
0
  @Test
  public void testGetAttributeKey() {
    GraphStore store = new GraphStore();
    Column column = generateBasicColumn(store);

    NodeImpl node = new NodeImpl("0", store);
    node.setAttribute(column, 1);
    Object res = node.getAttribute(column.getId());
    Assert.assertEquals(res, 1);
  }
예제 #4
0
  @Test
  public void testGetDefaultValue() {
    GraphStore store = new GraphStore();
    Integer defaultValue = 25;
    Column column =
        new ColumnImpl("age", Integer.class, "Age", defaultValue, Origin.DATA, true, false);
    store.nodeTable.store.addColumn(column);

    NodeImpl node = new NodeImpl("0", store);
    Object res = node.getAttribute(column.getId());
    Assert.assertEquals(res, defaultValue);

    node.setAttribute(column, null);
    res = node.getAttribute(column.getId());
    Assert.assertEquals(res, defaultValue);

    node.setAttribute(column, 1);
    res = node.getAttribute(column.getId());
    Assert.assertEquals(res, 1);
  }
예제 #5
0
 protected String getIdCol(Column column) {
   return (AttributeUtils.isNodeColumn(column) ? "node" : "edge") + "_column_" + column.getId();
 }