use of org.apache.gobblin.service.modules.template.StaticFlowTemplate in project incubator-gobblin by apache.
the class BaseFlowGraphTest method setUp.
@BeforeClass
public void setUp() throws URISyntaxException, DataNode.DataNodeCreationException {
Properties properties = new Properties();
properties.put("key1", "val1");
Config node1Config = ConfigUtils.propertiesToConfig(properties).withValue(FlowGraphConfigurationKeys.DATA_NODE_ID_KEY, ConfigValueFactory.fromAnyRef("node1"));
node1 = new BaseDataNode(node1Config);
properties = new Properties();
properties.put("key2", "val2");
Config node2Config = ConfigUtils.propertiesToConfig(properties).withValue(FlowGraphConfigurationKeys.DATA_NODE_ID_KEY, ConfigValueFactory.fromAnyRef("node2"));
node2 = new BaseDataNode(node2Config);
properties = new Properties();
properties.put("key3", "val3");
Config node3Config = ConfigUtils.propertiesToConfig(properties).withValue(FlowGraphConfigurationKeys.DATA_NODE_ID_KEY, ConfigValueFactory.fromAnyRef("node3"));
node3 = new BaseDataNode(node3Config);
// Create a clone of node3
node3c = new BaseDataNode(node3Config);
FlowTemplate flowTemplate1 = new StaticFlowTemplate(new URI("FS:///uri1"), "", "", ConfigFactory.empty(), null, null);
FlowTemplate flowTemplate2 = new StaticFlowTemplate(new URI("FS:///uri2"), "", "", ConfigFactory.empty(), null, null);
FlowTemplate flowTemplate3 = new StaticFlowTemplate(new URI("FS:///uri3"), "", "", ConfigFactory.empty(), null, null);
// Create edge instances
edgeId1 = "node1:node2:edge1";
edgeId2 = "node2:node3:edge2";
edgeId3 = "node3:node1:edge3";
edge1 = new BaseFlowEdge(Lists.newArrayList("node1", "node2"), edgeId1, flowTemplate1, null, ConfigFactory.empty(), true);
edge2 = new BaseFlowEdge(Lists.newArrayList("node2", "node3"), edgeId2, flowTemplate2, null, ConfigFactory.empty(), true);
edge3 = new BaseFlowEdge(Lists.newArrayList("node3", "node1"), edgeId3, flowTemplate3, null, ConfigFactory.empty(), true);
// Create a clone of edge3
edge3c = new BaseFlowEdge(Lists.newArrayList("node3", "node1"), edgeId3, flowTemplate3, null, ConfigFactory.empty(), true);
// Create a FlowGraph
graph = new BaseFlowGraph();
// Add nodes
Assert.assertTrue(graph.addDataNode(node1));
Assert.assertTrue(graph.addDataNode(node2));
Assert.assertTrue(graph.addDataNode(node3));
Assert.assertEquals(graph.getEdges(node1).size(), 0);
Assert.assertEquals(graph.getEdges(node2).size(), 0);
Assert.assertEquals(graph.getEdges(node3).size(), 0);
// Add edges
Assert.assertTrue(graph.addFlowEdge(edge1));
Assert.assertTrue(graph.addFlowEdge(edge2));
Assert.assertTrue(graph.addFlowEdge(edge3));
}
Aggregations