diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/FSProjectDAOImpl.java b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/FSProjectDAOImpl.java index d9ccf5c136afbd5bc4875e711b28eaee62202811..6813a20f4644833d9f79055f0d20e755f08b4ddf 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/FSProjectDAOImpl.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/FSProjectDAOImpl.java @@ -248,8 +248,8 @@ public class FSProjectDAOImpl implements IProjectDAO, ReleaseListener { final Map<String, String> propertyDescriptions = new HashMap<String, String>(); final Map<String, String> displayDescriptions = new HashMap<String, String>(); boolean fullyInitialized; - String description; - String dependency; + String description = ""; + String dependency = ""; // Create a new instance for the model final MIPlugin plugin; @@ -263,15 +263,17 @@ public class FSProjectDAOImpl implements IProjectDAO, ReleaseListener { // Those are the attributes which can go wrong because of the lazy class loading try { + description = FSProjectDAOImpl.getDescription(clazz, classAndMethodContainer); + dependency = FSProjectDAOImpl.getDependencies(clazz, classAndMethodContainer); + FSProjectDAOImpl.fillProperties(clazz, plugin, classAndMethodContainer, propertyDescriptions); FSProjectDAOImpl.fillPorts(clazz, plugin, classAndMethodContainer); FSProjectDAOImpl.fillDisplays(clazz, plugin, classAndMethodContainer, displayDescriptions); - description = FSProjectDAOImpl.getDescription(clazz, classAndMethodContainer); - dependency = FSProjectDAOImpl.getDependencies(clazz, classAndMethodContainer); fullyInitialized = true; } catch (final ComponentInitializationException ex) { - // This exception can occur if (for example) a class is missing. We clear the component as far as possible + // This exception can occur if (for example) a class is missing. We clear the component as far as possible - except for the description and the + // dependencies. This is important plugin.getProperties().clear(); plugin.getOutputPorts().clear(); propertyDescriptions.clear(); @@ -279,8 +281,8 @@ public class FSProjectDAOImpl implements IProjectDAO, ReleaseListener { if (plugin instanceof MIFilter) { ((MIFilter) plugin).getInputPorts().clear(); } - description = ""; - dependency = ""; + // description = ""; + // dependency = ""; fullyInitialized = false; @@ -348,8 +350,8 @@ public class FSProjectDAOImpl implements IProjectDAO, ReleaseListener { private static RepositoryContainer convertRepository(final Class<AbstractRepository> clazz, final ClassAndMethodContainer classAndMethodContainer) { final Map<String, String> propertyDescriptions = new HashMap<String, String>(); boolean fullyInitialized; - String description; - String dependency; + String description = ""; + String dependency = ""; // Create a new instance for the model final MIRepository repository = FSProjectDAOImpl.FACTORY.createRepository(); @@ -359,16 +361,15 @@ public class FSProjectDAOImpl implements IProjectDAO, ReleaseListener { // Those are the attributes which can go wrong because of the lazy class loading try { - FSProjectDAOImpl.fillProperties(clazz, repository, classAndMethodContainer, propertyDescriptions); description = FSProjectDAOImpl.getDescription(clazz, classAndMethodContainer); dependency = FSProjectDAOImpl.getDependencies(clazz, classAndMethodContainer); + FSProjectDAOImpl.fillProperties(clazz, repository, classAndMethodContainer, propertyDescriptions); fullyInitialized = true; } catch (final ComponentInitializationException ex) { - // This exception can occur if (for example) a class is missing. We clear the component as far as possible + // This exception can occur if (for example) a class is missing. We clear the component as far as possible - except for the description and the + // dependencies. This is important repository.getProperties().clear(); - description = ""; - dependency = ""; fullyInitialized = false; diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/GraphLayoutServiceImpl.java b/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/GraphLayoutServiceImpl.java index 86570b148d66f14a37158fc884d3f8f6900074a3..49ea5c406abcd4a432d1f4c27a363b7b36e2af6f 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/GraphLayoutServiceImpl.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/GraphLayoutServiceImpl.java @@ -211,7 +211,10 @@ public final class GraphLayoutServiceImpl implements IGraphLayoutService { layoutInformation.getEdges().add(ea++, edge); } + } + private static String[] correctEmptyArray(final String[] arr) { + return ((arr.length == 1) && arr[0].isEmpty()) ? new String[0] : arr; } /** @@ -223,9 +226,11 @@ public final class GraphLayoutServiceImpl implements IGraphLayoutService { * The string containing the information about the edges. * @return An object containing the layout information for the graph. */ - private static LayoutInformation assembleLayoutInformation(final String nodesStr, final String edgesStr) { - final String[] edgeInfo = edgesStr.split(" "); - final String[] positions = nodesStr.split(" "); + private static LayoutInformation assembleLayoutInformation(final String nodesStr, final String edgesStr) throws UninitializedGraphException, + InvalidInputSizeException { + final String[] edgeInfo = GraphLayoutServiceImpl.correctEmptyArray(edgesStr.split(" ")); + final String[] positions = GraphLayoutServiceImpl.correctEmptyArray(nodesStr.split(" ")); + final List<List<KLabeledGraphElement>> children = new ArrayList<List<KLabeledGraphElement>>(positions.length / 2); final List<KEdge> edges = new ArrayList<KEdge>(edgeInfo.length / 4); final LayoutInformation layoutInformation = new LayoutInformation(KimlUtil.createInitializedNode(), children, edges); @@ -236,7 +241,9 @@ public final class GraphLayoutServiceImpl implements IGraphLayoutService { return layoutInformation; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see kieker.webgui.service.impl.IGraphLayoutService#layoutGraph(java.lang.String, java.lang.String) */ @Override diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorBean.java index 81fbdbc0eedffcbbaaf10adfb4e05e4dc9389990..a072e809c09dc7b8ef080d57094e3438f06cd0e9 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorBean.java @@ -476,6 +476,8 @@ public final class CurrentAnalysisEditorBean { for (final MIRepository repository : this.project.getRepositories()) { this.currentAnalysisEditorGraphBean.addRepository(repository); } + // The API demands the graph to be repainted at this point + this.currentAnalysisEditorGraphBean.refreshGraph(); // Now initialize the connections between filters... for (final MIPlugin plugin : this.project.getPlugins()) { diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorGraphBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorGraphBean.java index 4c30b4442780f7495d8dfb88736dc0116505648c..9bc11cda50291d2f9e04728b8d2a746a44e020dd 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorGraphBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorGraphBean.java @@ -103,19 +103,19 @@ public final class CurrentAnalysisEditorGraphBean { /** * This is the javascript code to add a filter to the graph. */ - private static final String JS_CMD_ADD_FILTER = "graph.addNode(%d, %d, %s,[%s],[%s],[%s],'Filter');"; + private static final String JS_CMD_ADD_FILTER = "graph.addNode(%d, %d, %s,[%s],[%s],[%s],'Filter', false);"; /** * This is the javascript code to add a reader to the graph. */ - private static final String JS_CMD_ADD_READER = "graph.addNode(%d, %d, %s,[%s],null,[%s], 'Reader');"; + private static final String JS_CMD_ADD_READER = "graph.addNode(%d, %d, %s,[%s],null,[%s], 'Reader', false);"; /** * This is the javascript code to add a repository to the graph. */ - private static final String JS_CMD_ADD_REPOSITORY = "graph.addNode(%d, %d, %s, null, [%s], null, 'Repository');"; + private static final String JS_CMD_ADD_REPOSITORY = "graph.addNode(%d, %d, %s, null, [%s], null, 'Repository',false);"; /** * This is the javascript code to add an edge to the graph. */ - private static final String JS_CMD_ADD_EDGE = "graph.addEdge(\"%s\", \"%s\", \"%s\");"; + private static final String JS_CMD_ADD_EDGE = "graph.addEdge(\"%s\", \"%s\", \"%s\", false, false);"; /** * This is the javascript code to redraw the command. */ @@ -129,11 +129,11 @@ public final class CurrentAnalysisEditorGraphBean { /** * This is the javascript code to enable the grid within the graph. */ - private static final String JS_CMD_ENABLE_GRID = "graph.setGridVisible(true);"; + private static final String JS_CMD_ENABLE_GRID = "graph.setGridVisible(true, false);"; /** * This is the javascript code to disable the grid within the graph. */ - private static final String JS_CMD_DISABLE_GRID = "graph.setGridVisible(false);"; + private static final String JS_CMD_DISABLE_GRID = "graph.setGridVisible(false, false);"; /** * This is the javascript code to enable the grid snap within the graph. */ @@ -149,11 +149,11 @@ public final class CurrentAnalysisEditorGraphBean { /** * This is the javascript code the set the color of the grid. */ - private static final String JS_CMD_SET_GRID_COLOR = "graph.setGridColor('%s');"; + private static final String JS_CMD_SET_GRID_COLOR = "graph.setGridColor('%s', false);"; /** * This is the javascript code the set the size of the grid. */ - private static final String JS_CMD_SET_GRID_SIZE = "graph.setGridSize(%d);"; + private static final String JS_CMD_SET_GRID_SIZE = "graph.setGridSize(%d, false);"; /** * This is the name of the (only) input port of every repository. */ @@ -575,7 +575,6 @@ public final class CurrentAnalysisEditorGraphBean { public synchronized void setGridColor(final String color) { final String cmd = String.format(CurrentAnalysisEditorGraphBean.JS_CMD_SET_GRID_COLOR, "#" + color); RequestContext.getCurrentInstance().execute(cmd); - this.refreshGraph(); } /** @@ -587,7 +586,6 @@ public final class CurrentAnalysisEditorGraphBean { public synchronized void setGridSize(final int size) { final String cmd = String.format(CurrentAnalysisEditorGraphBean.JS_CMD_SET_GRID_SIZE, size); RequestContext.getCurrentInstance().execute(cmd); - this.refreshGraph(); } /** @@ -608,7 +606,6 @@ public final class CurrentAnalysisEditorGraphBean { } this.gridEnabled ^= true; // this.gridEnabled = !this.gridEnabled; - this.refreshGraph(); } /** diff --git a/Kieker.WebGUI/src/main/webapp/js/flowEditor.js b/Kieker.WebGUI/src/main/webapp/js/flowEditor.js index e1a3a557533670b8e8912ffd2c1a1799c9e1a308..1bfdf40ee75b3442ae3edd5b8f18e44008627fc2 100644 --- a/Kieker.WebGUI/src/main/webapp/js/flowEditor.js +++ b/Kieker.WebGUI/src/main/webapp/js/flowEditor.js @@ -168,6 +168,113 @@ function GraphFlow(){ return positions; } + /** + Changes one or more properties of a node immediately. + @nodeID - the ID of the node that needs changing + @properties - a data object that may contain any field from + node.data as well as "name" and "id". Data fields + must start with a $. + @noPlot - if true, the graph will not be plotted anew + */ + this.setNodeData = function(nodeID, properties, noPlot){ + + // check argument + if(!validArg("setNodeData()", nodeID, "string")){ + return; + } + + var value; + var node = getNode(nodeID), + domNode = fd.graph.getNode(nodeID); + + // iterate through properties object + for(var field in properties){ + value = properties[field]; + + // make changes to data + if(field[0] == '$'){ + + // treat a new font name by appending the font size as well + if(field == "$font"){ + if(!value){ + value = "Lucida Console"; + } + value = 0.83 * node.data.$dim +"px " + value; + } + // apply new value to data + node.data[field] = value; + domNode.data[field] = value; + } + + // make changes to name or id + else{ + node[field] = value; + domNode[field] = value; + } + } + + // recalculate node dimensions in case we changed the font or name + updateNodeWidth(node, domNode); + + // apply visual changes + if(!noPlot){ fd.plot();} + } + + /** + Recalculates the width of a node and repositions the ports. + Applies the change immediately. + @param jsonNode - the node in the json array + @param domNode - the node of the actual displayed graph + */ + function updateNodeWidth(jsonNode, domNode){ + var data = jsonNode.data; + + // reserve icon space + var iconSpace = 0; + if(nodeIcons[data.$nodeType]){iconSpace = 6;} + + // calculate width of name + var width = (jsonNode.name.length+4+iconSpace) * vertexLabelSize; + + // check if classname is longer than width + if(data.$nodeClass){ + var classWidth = (data.$nodeClass.length+6+iconSpace)*(vertexLabelSize-2); + width = Math.max(width, classWidth); + } + + // update width + jsonNode.data.$width = width; + domNode.data.$width = width; + + width /= 2; + + // update port positions + var port, domPort, relX, pos, offset, x, y; + for(var p = data.$portIndex+ jsonCapacity.max, l = p + data.$portCount; p < l; p++){ + port = json[p]; + domPort = fd.graph.getNode(port.id); + if(port.data.$relativeX){ + relX = port.data.$relativeX; + if(relX < 0){ + offset = -width; + }else{ + offset = width; + } + + // update relative position + port.data.$relativeX = offset; + domPort.data.$relativeX = offset; + } + + // update position + pos = domPort.pos.getc(true); + x = pos.x+offset-relX; + y = pos.y; + domPort.pos.setc(x, y); + port.data.$xPos = x; + port.data.$yPos = y; + } + } /** Reads nodefamily positions out of a string, which was created with @@ -317,7 +424,9 @@ function GraphFlow(){ { var inputSplit = input.split("#"); positions = inputSplit[0].split(" "); - if(inputSplit[1]){ + + // bend points are optional + if(inputSplit[1] && inputSplit[1].length > 0){ bendPoints = inputSplit[1].split(" "); } @@ -457,35 +566,69 @@ function GraphFlow(){ } /** - Changes the color of the grid. Requires a refresh(). + Changes the color of the grid. + @param newColor - the new color of the grid + @param noPlot - if true, the graph will not be plotted anew */ - this.setGridColor = function(newColor){ + this.setGridColor = function(newColor, noPlot){ if(validArgColor('setGridColor()', newColor)){ grid.data.$color = newColor; + + // apply changes immediately + if(grid.visible){ + var domGrid = fd.graph.getNode(grid.id); + domGrid.data.$color = newColor; + + // apply visual changes + if(!noPlot){ fd.plot();} + } } } /** - Changes the size of the grid. Requires a refresh(). + Changes the size of the grid. + @param newSize - the new size of the grid + @param noPlot - if true, the graph will not be plotted anew */ - this.setGridSize = function(newSize){ + this.setGridSize = function(newSize, noPlot){ if(validArg('setGridSize()', newSize, 'number')){ grid.data.$dim = newSize; + + // apply changes immediately + if(grid.visible){ + var domGrid = fd.graph.getNode(grid.id); + domGrid.data.$dim = newSize; + // apply visual changes + if(!noPlot){ fd.plot();} + } } } /** - Changes the visibility of the grid. Requires a refresh(). + Changes whether Nodes should snap to grid. + @param snap - must be true if Nodes should snap */ - this.setGridVisible = function(visibility){ - grid.visible = visibility; + this.setGridSnap = function(snap){ + grid.snap = snap; } /** - Changes whether Nodes should snap to grid. Requires a refresh(). + Changes the visibility of the grid. + @param visibility - must be true to display the graph + @param noPlot - if true, the graph will not be plotted anew */ - this.setGridSnap = function(snap){ - grid.snap = snap; + this.setGridVisible = function(visibility, noPlot){ + grid.visible = visibility; + + // apply changes immediately + if(visibility){ + fd.graph.addNode(grid); + } + else{ + fd.graph.removeNode(grid.id); + } + // apply visual changes + if(!noPlot){ fd.plot();} } /** @@ -613,7 +756,7 @@ function GraphFlow(){ }else{ addPortSizeRel = addPortSize; } - if(portData.$relativeX != undefined){ + if(portData.$relativeX){ portData.$relativeX += addPortSizeRel; } portData.$xPos += addPortSizeRel; @@ -879,7 +1022,7 @@ function GraphFlow(){ /** Permits or prohibits node and edge deletion/creation and hides the deletion-cross - accordingly. + accordingly. Requires a refresh() to hide/show the deletion-crosses. @param deleteCreate - if true, one can change the graph in any way @param move - if true, one can change the graph in any way */ @@ -983,7 +1126,7 @@ function GraphFlow(){ } // check if this nodeType has a defined icon - if(nodeIcons[nodeType] != undefined){ + if(nodeIcons[nodeType]){ iconSpace = 6; } @@ -1000,6 +1143,9 @@ function GraphFlow(){ // change node color, depending on its type var nodeColor = nodeFillColor["nodeFamily"], strokeColor = nodeStrokeColor["nodeFamily"]; + var font = nodeFamily.font; + if(!font){font = "Lucida Console"} + var newNode = { "data": { "$dim": size, @@ -1016,6 +1162,7 @@ function GraphFlow(){ "$nodeType": nodeType, "$xPos": xPosition, "$yPos": yPosition, + "$font": 0.83 * size +"px "+font, "$tooltip": nodeFamily.tooltip }, "id": nodeFamily.id, @@ -1346,7 +1493,10 @@ function GraphFlow(){ } /** - + Adds bendpoints to an edge. + @param sourceID - the id of the node from which the edge starts + @param targetID - the id of the node where the edge ends + @param bendPoints - an array of {x,y} objects. */ this.addBendPoints = function(sourceID, targetID, bendPoints){ // check for valid arguments @@ -1393,9 +1543,10 @@ function GraphFlow(){ * @param edgeLabel - the label of the edge. Can be null if no label is required * @param forced - if true, creates the edge unconditionally and does not trigger a listener event + @param noPlot - if true, the graph will not be plotted anew * @return true - if the edge was successfully added */ - this.addEdge = function(sourceID, targetID, edgeLabel, forced){ + this.addEdge = function(sourceID, targetID, edgeLabel, forced, noPlot){ // check for valid arguments if(!validArg("addEdge()", sourceID, "string")){ @@ -1477,16 +1628,24 @@ function GraphFlow(){ "$color" : edgeColor} }; + // add label if(edgeLabel){ edge.data.$label = edgeLabel; } - adja.push(edge); - + // mouse edge if(sourceID == mouseNode.id || targetID == mouseNode.id){ edge.data.$type = "mouseArrow"; } + adja.push(edge); + + // apply changes immediately + var domSource = fd.graph.getNode(sourceID), + domTarget = fd.graph.getNode(targetID); + fd.graph.addAdjacence(domSource, domTarget, edge.data); + if(!noPlot){ fd.plot();} + return true; } @@ -1496,13 +1655,14 @@ function GraphFlow(){ @param sourceID - the ID of the connected outputPort @param targetID - the ID of the connected inputPort @param bendPoints - an array of {"x":..., "y":...} objects + @param noPlot - if true, the graph will not be plotted anew */ - this.setBendPoints = function(sourceID, targetID, bendPoints){ + this.setBendPoints = function(sourceID, targetID, bendPoints, noPlot){ // check for valid arguments - if(!validArg("addEdge()", sourceID, "string")){ + if(!validArg("setBendPoints()", sourceID, "string")){ return false; } - if(!validArg("addEdge()", targetID, "string")){ + if(!validArg("setBendPoints()", targetID, "string")){ return false; } @@ -1516,7 +1676,10 @@ function GraphFlow(){ fd.graph.getAdjacence(sourceID, targetID).data.$bendPoints = bendPoints; break; } - } + } + + // plot visual changes + if(!noPlot){ fd.plot(); } } /** @@ -1525,8 +1688,9 @@ function GraphFlow(){ @param targetID - the id of the target Node @param forced - if true, removes the edge unconditionally and does not trigger a listener event + @param noPlot - if true, the graph will not be plotted anew */ - this.removeEdge = function(sourceID, targetID, forced){ + this.removeEdge = function(sourceID, targetID, forced, noPlot){ // check for valid arguments if(!validArg("removeEdge()", sourceID, "string")){ return; @@ -1591,6 +1755,9 @@ function GraphFlow(){ } } + // apply changes immediately + fd.graph.removeAdjacence(sourceID, targetID); + if(!noPlot){ fd.plot();} } /** @@ -1989,13 +2156,12 @@ function GraphFlow(){ // add edge to mouseNode if(selectedNode.from == "inputPort"){ - addEdge(mouseNode.id, node.id); + addEdge(mouseNode.id, node.id, null, false, true); } else{ - addEdge(node.id, mouseNode.id); + addEdge(node.id, mouseNode.id, null, false, true); } var pos = node.pos.getc(true); - refresh(); // set mouse position mouseNode.pos.setc(pos.x, pos.y); @@ -2022,13 +2188,15 @@ function GraphFlow(){ // no selection yet if(selectedNode == null){ selectedNode = {"id":node.data.$direction[0], "from":"outputPort", "label":node.data.$label};//nodeTo + // remove selectedEdge var label = node.data.$label; - removeEdge(selectedNode.id, node.data.$direction[1]); + removeEdge(selectedNode.id, node.data.$direction[1],false, true); + // add edge to mouseNode - addEdge(selectedNode.id, mouseNode.id, label); + addEdge(selectedNode.id, mouseNode.id, label, false, true); var pos = eventInfo.getPos(); - refresh(); + // set mouse position mouseNode.pos.setc(pos.x, pos.y-2); fd.plot(); @@ -2046,7 +2214,6 @@ function GraphFlow(){ } selectedNode = null; - refresh(); } callListener("onClick", [node, eventInfo, e]); navi.isDragging = false; @@ -2060,12 +2227,8 @@ function GraphFlow(){ levelDistance: 0 }); - // load JSON data. - fd.loadGraphFlowJSON(json,jsonCapacity.max); - // compute positions refresh(); - // end } // initialize graph diff --git a/Kieker.WebGUI/src/main/webapp/js/jit.js b/Kieker.WebGUI/src/main/webapp/js/jit.js index bffdc8ba3ee35cf9f873affaace68b2531bd0553..6029803abc635343a90c934e92ee4fceb892d6b2 100644 --- a/Kieker.WebGUI/src/main/webapp/js/jit.js +++ b/Kieker.WebGUI/src/main/webapp/js/jit.js @@ -8077,7 +8077,7 @@ var Loader = { return ans; }, - /** A specialized version that accepts null nodes */ + /** A specialized version that accepts null nodes and refreshes the graph afterwards*/ loadGraphFlowJSON: function(json, i) { this.json = json; //if they're canvas labels erase them. @@ -17883,9 +17883,10 @@ $jit.FlowGraph.$extend = true; var name = node.name; var midX, midY, textWidth; + if(name != undefined){ ctx.fillStyle = node.getData('color'); - ctx.font = 0.83 * dim +"px Lucida Console"; + ctx.font = node.data.$font; textWidth = ctx.measureText(name).width/2; midX = tX - textWidth; diff --git a/Kieker.WebGUI/src/test/java/kieker/webgui/service/impl/GraphLayoutServiceImplTest.java b/Kieker.WebGUI/src/test/java/kieker/webgui/service/impl/GraphLayoutServiceImplTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4eb9216be2d44c3d7be81fd28e5dc8de0404265b --- /dev/null +++ b/Kieker.WebGUI/src/test/java/kieker/webgui/service/impl/GraphLayoutServiceImplTest.java @@ -0,0 +1,55 @@ +/*************************************************************************** + * Copyright 2012 Kieker Project (http://kieker-monitoring.net) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ***************************************************************************/ + +package kieker.webgui.service.impl; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Test class for {@link GraphLayoutServiceImpl}. + * + * @author Nils Christian Ehmke + */ +public class GraphLayoutServiceImplTest { + + /** + * Default constructor. <b>Do not use this constructor. This is just a test class and not to be used outside a JUnit test!</b> + */ + public GraphLayoutServiceImplTest() { + // No code necessary + } + + /** + * A test of this test class. + */ + @Test + public void test() { + final GraphLayoutServiceImpl layouter = new GraphLayoutServiceImpl(); + + // We assert that nothing goes wrong here + layouter.layoutGraph( + "12 140 72 0 0 0 0 1 42 240 72 1 42 0 0 1 42 210 132 4 36 0 0 2 60 190 108 3 36 0 0 2 48 420 96 1 54 1 36 1 72 768 144 1 78 1 36 3 72 420 84 1 48 0 36 2 36 792 120 1 66 1 36 2 72 250 72 1 42 1 42 0 72 280 72 0 42 1 42 0 72 270 72 1 42 0 42 0 72", + "0 1 0 0 1 2 1 3 1 2 1 2 2 3 4 0 3 4 3 0 4 10 1 0 4 5 2 0 5 10 1 0 5 8 2 0 6 7 1 0 7 10 1 0 7 8 3 0 8 10 1 0 9 10 0 0 "); + + // Something should go wrong here + try { + layouter.layoutGraph(" ", " 1 "); + Assert.fail(); + } catch (final Exception ex) { + } + } +}