當前位置: 首頁>>代碼示例>>Java>>正文


Java Flow.addNode方法代碼示例

本文整理匯總了Java中azkaban.flow.Flow.addNode方法的典型用法代碼示例。如果您正苦於以下問題:Java Flow.addNode方法的具體用法?Java Flow.addNode怎麽用?Java Flow.addNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在azkaban.flow.Flow的用法示例。


在下文中一共展示了Flow.addNode方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createExecutableFlow

import azkaban.flow.Flow; //導入方法依賴的package包/類
/**
 * Creates a linear executable flow with the specified nodes.
 *
 * @param nodes
 * @return
 */
private ExecutableFlow createExecutableFlow(List<Node> nodes) {
  if (nodes == null || nodes.size() == 0) {
    return new ExecutableFlow();
  }

  Flow flow = new Flow("flow1");
  Node prevNode = nodes.get(0);
  flow.addNode(prevNode);

  for (int i = 1; i < nodes.size(); i++) {
    Node nextNode = nodes.get(i);
    flow.addNode(nextNode);

    Edge edge = new Edge(prevNode.getId(), nextNode.getId());
    flow.addEdge(edge);

    prevNode = nextNode;
  }

  flow.initialize();

  Project project = new Project(1, "project1");

  return new ExecutableFlow(project, flow);
}
 
開發者ID:azkaban,項目名稱:azkaban-plugins,代碼行數:32,代碼來源:ReportalUtilTest.java

示例2: testFlowUpload

import azkaban.flow.Flow; //導入方法依賴的package包/類
@Ignore @Test
public void testFlowUpload() throws ProjectManagerException {
  ProjectLoader loader = createLoader();
  ((JdbcProjectLoader) loader)
      .setDefaultEncodingType(JdbcProjectLoader.EncodingType.GZIP);
  String projectName = "mytestFlowUpload1";
  String projectDescription = "This is my new project";
  User user = new User("testUser");
  String group = "";

  Project project =
      loader.createNewProject(projectName, projectDescription, user, group);

  Flow flow = new Flow("MyNewFlow");

  flow.addNode(new Node("A"));
  flow.addNode(new Node("B"));
  flow.addNode(new Node("C"));
  flow.addNode(new Node("D"));

  flow.addEdge(new Edge("A", "B"));
  flow.addEdge(new Edge("A", "C"));
  flow.addEdge(new Edge("B", "D"));
  flow.addEdge(new Edge("C", "D"));

  flow.initialize();

  loader.uploadFlow(project, 4, flow);
  project.setVersion(4);
  Flow newFlow = loader.fetchFlow(project, flow.getId());
  Assert.assertTrue(newFlow != null);
  Assert.assertEquals(flow.getId(), newFlow.getId());
  Assert.assertEquals(flow.getEdges().size(), newFlow.getEdges().size());
  Assert.assertEquals(flow.getNodes().size(), newFlow.getNodes().size());
}
 
開發者ID:JasonBian,項目名稱:azkaban,代碼行數:36,代碼來源:JdbcProjectLoaderTest.java

示例3: testFlowUploadPlain

import azkaban.flow.Flow; //導入方法依賴的package包/類
@Ignore @Test
public void testFlowUploadPlain() throws ProjectManagerException {
  ProjectLoader loader = createLoader();
  ((JdbcProjectLoader) loader)
      .setDefaultEncodingType(JdbcProjectLoader.EncodingType.PLAIN);
  String projectName = "mytestFlowUpload2";
  String projectDescription = "This is my new project";
  User user = new User("testUser");
  String group = "";

  Project project =
      loader.createNewProject(projectName, projectDescription, user, group);

  Flow flow = new Flow("MyNewFlow2");

  flow.addNode(new Node("A1"));
  flow.addNode(new Node("B1"));
  flow.addNode(new Node("C1"));
  flow.addNode(new Node("D1"));

  flow.addEdge(new Edge("A1", "B1"));
  flow.addEdge(new Edge("A1", "C1"));
  flow.addEdge(new Edge("B1", "D1"));
  flow.addEdge(new Edge("C1", "D1"));

  flow.initialize();

  loader.uploadFlow(project, 4, flow);
  project.setVersion(4);
  Flow newFlow = loader.fetchFlow(project, flow.getId());
  Assert.assertTrue(newFlow != null);
  Assert.assertEquals(flow.getId(), newFlow.getId());
  Assert.assertEquals(flow.getEdges().size(), newFlow.getEdges().size());
  Assert.assertEquals(flow.getNodes().size(), newFlow.getNodes().size());

  List<Flow> flows = loader.fetchAllProjectFlows(project);
  Assert.assertTrue(flows.size() == 1);
}
 
開發者ID:JasonBian,項目名稱:azkaban,代碼行數:39,代碼來源:JdbcProjectLoaderTest.java

示例4: testFlowUpload

import azkaban.flow.Flow; //導入方法依賴的package包/類
@Test
public void testFlowUpload() throws ProjectManagerException {
	ProjectLoader loader = createLoader();
	((JdbcProjectLoader)loader).setDefaultEncodingType(JdbcProjectLoader.EncodingType.GZIP);
	String projectName = "mytestFlowUpload1";
	String projectDescription = "This is my new project";
	User user = new User("testUser");

	Project project = loader.createNewProject(projectName, projectDescription, user);

	Flow flow = new Flow("MyNewFlow");

	flow.addNode(new Node("A"));
	flow.addNode(new Node("B"));
	flow.addNode(new Node("C"));
	flow.addNode(new Node("D"));

	flow.addEdge(new Edge("A", "B"));
	flow.addEdge(new Edge("A", "C"));
	flow.addEdge(new Edge("B", "D"));
	flow.addEdge(new Edge("C", "D"));

	flow.initialize();

	loader.uploadFlow(project, 4, flow);
	project.setVersion(4);
	Flow newFlow = loader.fetchFlow(project, flow.getId());
	Assert.assertTrue(newFlow != null);
	Assert.assertEquals(flow.getId(), newFlow.getId());
	Assert.assertEquals(flow.getEdges().size(), newFlow.getEdges().size());
	Assert.assertEquals(flow.getNodes().size(), newFlow.getNodes().size());
}
 
開發者ID:zhizhounq,項目名稱:azkaban-customization,代碼行數:33,代碼來源:JdbcProjectLoaderTest.java

示例5: testFlowUploadPlain

import azkaban.flow.Flow; //導入方法依賴的package包/類
@Test
public void testFlowUploadPlain() throws ProjectManagerException {
	ProjectLoader loader = createLoader();
	((JdbcProjectLoader)loader).setDefaultEncodingType(JdbcProjectLoader.EncodingType.PLAIN);
	String projectName = "mytestFlowUpload2";
	String projectDescription = "This is my new project";
	User user = new User("testUser");

	Project project = loader.createNewProject(projectName, projectDescription, user);

	Flow flow = new Flow("MyNewFlow2");

	flow.addNode(new Node("A1"));
	flow.addNode(new Node("B1"));
	flow.addNode(new Node("C1"));
	flow.addNode(new Node("D1"));

	flow.addEdge(new Edge("A1", "B1"));
	flow.addEdge(new Edge("A1", "C1"));
	flow.addEdge(new Edge("B1", "D1"));
	flow.addEdge(new Edge("C1", "D1"));

	flow.initialize();

	loader.uploadFlow(project, 4, flow);
	project.setVersion(4);
	Flow newFlow = loader.fetchFlow(project, flow.getId());
	Assert.assertTrue(newFlow != null);
	Assert.assertEquals(flow.getId(), newFlow.getId());
	Assert.assertEquals(flow.getEdges().size(), newFlow.getEdges().size());
	Assert.assertEquals(flow.getNodes().size(), newFlow.getNodes().size());

	List<Flow> flows = loader.fetchAllProjectFlows(project);
	Assert.assertTrue(flows.size() == 1);
}
 
開發者ID:zhizhounq,項目名稱:azkaban-customization,代碼行數:36,代碼來源:JdbcProjectLoaderTest.java


注:本文中的azkaban.flow.Flow.addNode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。