@Test public void testLinkTypes() { assertTrue( "Link type is wrong", DictionaryHelper.isStructuralLinkType(DictionaryConst.LINK_CONTAINS)); assertFalse( "Link type is wrong", DictionaryHelper.isDataFlowLinkType(DictionaryConst.LINK_CONTAINS)); }
@Test public void testIsEntityType() { DictionaryHelper.ENTITY_NODE_TYPES.remove("newEntityType"); assertFalse(DictionaryHelper.ENTITY_NODE_TYPES.contains("noEntityType")); DictionaryHelper.registerEntityType("newEntityType"); assertTrue(DictionaryHelper.ENTITY_NODE_TYPES.contains("newEntityType")); assertFalse(DictionaryHelper.isEntityType("noEntityType")); assertTrue(DictionaryHelper.isEntityType("newEntityType")); }
@Test public void testCategoryColors() { assertEquals( "Color is wrong", DictionaryConst.COLOR_DATASOURCE, DictionaryHelper.getColorForCategory(DictionaryConst.CATEGORY_DATASOURCE)); assertEquals( "Color is wrong", DictionaryConst.COLOR_OTHER, DictionaryHelper.getColorForCategory("bogus")); }
@Test public void testNodesAndLinks() { Properties props = new Properties(); props.put(DictionaryConst.PROPERTY_AUTHOR, "fred"); props.put(DictionaryConst.PROPERTY_LAST_MODIFIED, "2014-07-10 17:34:45"); IMetaverseNode transNode = DictionaryHelper.createMetaverseNode( DictionaryConst.NODE_TYPE_TRANS + "~my transform.ktr", "my transform", DictionaryConst.NODE_TYPE_TRANS, props); IMetaverseNode stepNode = DictionaryHelper.addChildNode( DictionaryConst.NODE_TYPE_TRANS_STEP + "~my transform.ktr~Table Input", "Table Input", DictionaryConst.NODE_TYPE_TRANS_STEP, null, transNode, DictionaryConst.LINK_CONTAINS); MetaverseTransientNode node1 = (MetaverseTransientNode) transNode; MetaverseTransientNode node2 = (MetaverseTransientNode) stepNode; assertNotNull("Links is null", node1.getLinks()); assertEquals("Links count is wrong", 1, node1.getLinks().size()); assertEquals("Links node is wrong", node1, node1.getLinks().get(0).getFromNode()); assertEquals("Links node is wrong", node2, node1.getLinks().get(0).getToNode()); assertEquals( "Links type is wrong", DictionaryConst.LINK_CONTAINS, node1.getLinks().get(0).getLabel()); assertEquals("Property is wrong", "fred", node1.getProperty(DictionaryConst.PROPERTY_AUTHOR)); node1.removeProperty(DictionaryConst.PROPERTY_AUTHOR); assertEquals("Property is wrong", null, node1.getProperty(DictionaryConst.PROPERTY_AUTHOR)); node1.removeLink(node1.getLinks().get(0)); assertEquals("Links count is wrong", 0, node1.getLinks().size()); }