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

update tests

parent 5db4b622
No related branches found
No related tags found
1 merge request!17Get impletemented stages and Java 8
package kieker.analysis.graph; package kieker.analysis.graph;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import kieker.analysis.graph.export.graphml.GraphMLExporter; import kieker.analysis.graph.export.graphml.GraphMLExporter;
import kieker.analysis.graph.impl.GraphImpl; import kieker.analysis.graph.impl.GraphImpl;
import kieker.analysis.util.dot.DotWriter;
public class GraphTester { public class GraphTester {
...@@ -106,26 +101,27 @@ public class GraphTester { ...@@ -106,26 +101,27 @@ public class GraphTester {
// dotExporter.export(graph, System.out); // dotExporter.export(graph, System.out);
// Could be useful for testing // Could be useful for testing
System.out.println("DotWriter Test"); //
// System.out.println("DotWriter Test");
DotWriter dotWriter = new DotWriter(new PrintWriter(System.out)); //
try { // DotWriter dotWriter = new DotWriter(new PrintWriter(System.out));
dotWriter.start("G"); // try {
dotWriter.addGraphAttribute("rotate", "90"); // dotWriter.start("G");
Map<String, String> defaultNodeAttributes = new HashMap<>(); // dotWriter.addGraphAttribute("rotate", "90");
defaultNodeAttributes.put("style", "filled"); // Map<String, String> defaultNodeAttributes = new HashMap<>();
dotWriter.addDefaultNodeAttributes(defaultNodeAttributes); // defaultNodeAttributes.put("style", "filled");
Map<String, String> nodeAttributes = new HashMap<>(); // dotWriter.addDefaultNodeAttributes(defaultNodeAttributes);
nodeAttributes.put("label", "LABEL Title"); // Map<String, String> nodeAttributes = new HashMap<>();
dotWriter.addNode("102", nodeAttributes); // nodeAttributes.put("label", "LABEL Title");
dotWriter.addNode("#id", nodeAttributes); // dotWriter.addNode("102", nodeAttributes);
dotWriter.addEdge("102", "#id", new HashMap<>()); // dotWriter.addNode("#id", nodeAttributes);
dotWriter.finish(); // dotWriter.addEdge("102", "#id", new HashMap<>());
// dotWriter.finish();
} catch (IOException e) { //
// TODO Auto-generated catch block // } catch (IOException e) {
e.printStackTrace(); // // TODO Auto-generated catch block
} // e.printStackTrace();
// }
} }
......
...@@ -27,13 +27,13 @@ public class GraphMLExporter { ...@@ -27,13 +27,13 @@ public class GraphMLExporter {
graphmlType.getGraphOrData().add(graphType); graphmlType.getGraphOrData().add(graphType);
try { try {
JAXBContext context = JAXBContext.newInstance(GraphmlType.class);
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, FORMATTED_OUTPUT);
ObjectFactory objectFactory = new ObjectFactory(); ObjectFactory objectFactory = new ObjectFactory();
JAXBElement<GraphmlType> rootElement = objectFactory.createGraphml(graphmlType); JAXBElement<GraphmlType> rootElement = objectFactory.createGraphml(graphmlType);
JAXBContext context = JAXBContext.newInstance(rootElement.getValue().getClass());
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, FORMATTED_OUTPUT);
marshaller.marshal(rootElement, outputStream); marshaller.marshal(rootElement, outputStream);
} catch (JAXBException e) { } catch (JAXBException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
......
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