Skip to content
Snippets Groups Projects
Commit 0222eb21 authored by Sören Henning's avatar Sören Henning
Browse files

tests, bug fixes and clean up

parent 7ad846b1
No related branches found
No related tags found
1 merge request!17Get impletemented stages and Java 8
package kieker.analysis.graph;
import kieker.analysis.graph.export.graphml.GraphMLExporter;
import kieker.analysis.graph.export.dot.DotExporter;
import kieker.analysis.graph.impl.GraphImpl;
public class GraphTester {
......@@ -80,34 +80,11 @@ public class GraphTester {
System.out.println(edge.getId());
}
GraphMLExporter graphMLExporter = new GraphMLExporter();
graphMLExporter.export(graph, System.out);
// JAXB Test
//
// GraphmlType graphmlType = new GraphmlType();
// graphmlType.getKey().add(new KeyType());
// GraphType graphType = new GraphType();
// graphType.getDataOrNodeOrEdge().add(new NodeType());
// graphType.getDataOrNodeOrEdge().add(new NodeType());
// graphType.getDataOrNodeOrEdge().add(new EdgeType());
// graphmlType.getGraphOrData().add(graphType);
//
// try {
// JAXBContext context = JAXBContext.newInstance(GraphmlType.class);
// Marshaller m = context.createMarshaller();
// m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
//
// ObjectFactory objectFactory = new ObjectFactory();
// JAXBElement<GraphmlType> element = objectFactory.createGraphml(graphmlType);
//
// m.marshal(element, System.out);
// } catch (JAXBException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// GraphMLExporter graphMLExporter = new GraphMLExporter();
// graphMLExporter.export(graph, System.out);
DotExporter dotExporter = new DotExporter();
dotExporter.export(graph, System.out);
}
......
package kieker.analysis.graph.export.dot;
import java.io.OutputStream;
import java.io.PrintWriter;
import kieker.analysis.graph.Graph;
......@@ -12,6 +13,10 @@ public class DotExporter {
// TODO Receiving a dot object would be (maybe) better
String dotString = graphTransformer.transform();
PrintWriter printWriter = new PrintWriter(outputStream);
printWriter.write(dotString);
printWriter.close();
}
}
......@@ -25,10 +25,9 @@ public class GraphTransformer extends AbstractTransformer<String> {
protected void mapVertex(final Vertex vertex) {
if (vertex.hasChildGraph()) {
Graph childGraph = vertex.getChildGraph();
GraphTransformer graphTransformer = new GraphTransformer(childGraph);
GraphTransformer graphTransformer = new GraphTransformer(childGraph, false);
String childGraphString = graphTransformer.transform();
// TODO We need a subgraph cluster_XYZ { ... }
// TODO dotBuilder.addCluster();
dotBuilder.addSubgraph(childGraphString);
} else {
dotBuilder.addNode(vertex.getId().toString());
// TODO Add style, label, etc
......
......@@ -104,6 +104,10 @@ public class DotBuilder {
addElement('"' + source + '"' + " -> " + '"' + target + '"', extendEdgeProperties(properties));
}
public void addSubgraph(final String subgraph) {
body.append(subgraph + '\n');
}
private void addElement(final String element, final Map<String, String> properties) {
body.append(element);
if (properties != null && !properties.isEmpty()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment