add test cases for FlowExecuteService
This commit is contained in:
parent
851a07ad65
commit
0b110642e3
|
@ -12,7 +12,7 @@ public class DirectedCycle {
|
||||||
public DirectedCycle(Digraph G){
|
public DirectedCycle(Digraph G){
|
||||||
marked = new boolean[G.getV()];
|
marked = new boolean[G.getV()];
|
||||||
onStack = new boolean[G.getV()];
|
onStack = new boolean[G.getV()];
|
||||||
cycle = new Stack<Integer>();
|
edgeTo = new int[G.getV()];
|
||||||
dfs(G, G.getStartNode());
|
dfs(G, G.getStartNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,16 @@
|
||||||
package haflow.module.basic;
|
package haflow.module.basic;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.StringReader;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
import org.xml.sax.InputSource;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
import haflow.module.Module;
|
import haflow.module.Module;
|
||||||
import haflow.module.ModuleConfiguration;
|
import haflow.module.ModuleConfiguration;
|
||||||
|
@ -13,7 +21,22 @@ import haflow.module.ModuleMetadata;
|
||||||
public class EndModule implements ModuleMetadata {
|
public class EndModule implements ModuleMetadata {
|
||||||
|
|
||||||
public Document generate(Map<String, String> configurations) {
|
public Document generate(Map<String, String> configurations) {
|
||||||
// TODO Auto-generated method stub
|
String xml = "<start to=\"java-node\"/>";
|
||||||
|
|
||||||
|
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||||
|
try {
|
||||||
|
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||||
|
StringReader sr = new StringReader(xml);
|
||||||
|
InputSource is = new InputSource(sr);
|
||||||
|
Document doc = db.parse(is);
|
||||||
|
return doc;
|
||||||
|
} catch (SAXException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (ParserConfigurationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,44 @@
|
||||||
package haflow.module.basic;
|
package haflow.module.basic;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
|
|
||||||
import haflow.module.Module;
|
import haflow.module.Module;
|
||||||
import haflow.module.ModuleConfiguration;
|
import haflow.module.ModuleConfiguration;
|
||||||
import haflow.module.ModuleMetadata;
|
import haflow.module.ModuleMetadata;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.StringReader;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.xml.sax.InputSource;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
@Module(id = "9208d7d2-a8ff-2493-64c2-36f50bc95752", name = "Start", category = "Basic")
|
@Module(id = "9208d7d2-a8ff-2493-64c2-36f50bc95752", name = "Start", category = "Basic")
|
||||||
@ModuleConfiguration(configurationKeys = { "aaa" }, configurationDisplayNames = { "bbb" })
|
@ModuleConfiguration(configurationKeys = { "aaa" }, configurationDisplayNames = { "bbb" })
|
||||||
public class StartModule implements ModuleMetadata {
|
public class StartModule implements ModuleMetadata {
|
||||||
|
|
||||||
public Document generate(Map<String, String> configurations) {
|
public Document generate(Map<String, String> configurations) {
|
||||||
// TODO Auto-generated method stub
|
//<start to="java-node"/>
|
||||||
|
|
||||||
|
String xml = "<start to=\"java-node\"/>";
|
||||||
|
|
||||||
|
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||||
|
try {
|
||||||
|
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||||
|
StringReader sr = new StringReader(xml);
|
||||||
|
InputSource is = new InputSource(sr);
|
||||||
|
Document doc = db.parse(is);
|
||||||
|
return doc;
|
||||||
|
} catch (SAXException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (ParserConfigurationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class ClassHelper {
|
||||||
classFilePath = classFilePath.replace("\\", ".");
|
classFilePath = classFilePath.replace("\\", ".");
|
||||||
classFilePath = classFilePath.replace("/", ".");
|
classFilePath = classFilePath.replace("/", ".");
|
||||||
classFilePath = classFilePath.substring(
|
classFilePath = classFilePath.substring(
|
||||||
classFilePath.indexOf(".classes") + 9,
|
classFilePath.indexOf("classes") + 8,
|
||||||
classFilePath.lastIndexOf("."));
|
classFilePath.lastIndexOf("."));
|
||||||
|
|
||||||
classNames.add(classFilePath);
|
classNames.add(classFilePath);
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package haflow.test;
|
||||||
|
|
||||||
|
import haflow.service.FlowExecuteService;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class FlowExecuteServiceTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test() {
|
||||||
|
ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"servlet-context.xml"});
|
||||||
|
// ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("servlet-context.xml");
|
||||||
|
FlowExecuteService fes = context.getBean(FlowExecuteService.class);
|
||||||
|
fes.runFlow(UUID.fromString("67f1811e-c2b3-4a32-b70a-32f486a0a947"));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue