Search in sources :

Example 1 with MemoryMetaStoreAttribute

use of org.pentaho.metastore.stores.memory.MemoryMetaStoreAttribute in project pentaho-kettle by pentaho.

the class PurRepositoryMetaStoreTest method testDataNodeConversion.

@Test
public void testDataNodeConversion() throws Exception {
    IMetaStoreElement expected = new MemoryMetaStoreElement();
    expected.setName("parent");
    expected.addChild(new MemoryMetaStoreAttribute("date", new Date()));
    expected.addChild(new MemoryMetaStoreAttribute("long", 32L));
    expected.addChild(new MemoryMetaStoreAttribute("double", 3.2));
    expected.addChild(new MemoryMetaStoreAttribute("string", "value"));
    MemoryMetaStoreAttribute collection = new MemoryMetaStoreAttribute("collection", "collection-value");
    for (int i = 0; i < 10; i++) {
        collection.addChild(new MemoryMetaStoreAttribute("key-" + i, "value-" + i));
    }
    expected.addChild(collection);
    DataNode dataNode = new DataNode("test");
    metaStore.elementToDataNode(expected, dataNode);
    IMetaStoreElement verify = new MemoryMetaStoreElement();
    metaStore.dataNodeToElement(dataNode, verify);
    assertEquals(expected.getName(), verify.getName());
    validate(expected, verify);
}
Also used : MemoryMetaStoreAttribute(org.pentaho.metastore.stores.memory.MemoryMetaStoreAttribute) DataNode(org.pentaho.platform.api.repository2.unified.data.node.DataNode) IMetaStoreElement(org.pentaho.metastore.api.IMetaStoreElement) Date(java.util.Date) MemoryMetaStoreElement(org.pentaho.metastore.stores.memory.MemoryMetaStoreElement) Test(org.junit.Test)

Aggregations

Date (java.util.Date)1 Test (org.junit.Test)1 IMetaStoreElement (org.pentaho.metastore.api.IMetaStoreElement)1 MemoryMetaStoreAttribute (org.pentaho.metastore.stores.memory.MemoryMetaStoreAttribute)1 MemoryMetaStoreElement (org.pentaho.metastore.stores.memory.MemoryMetaStoreElement)1 DataNode (org.pentaho.platform.api.repository2.unified.data.node.DataNode)1