diff --git a/.gitignore b/.gitignore index 95f17e4a..37a89db8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,22 @@ .project .settings/ +# Intellij stuff # +################## +*.iml +*.ipr +*.iws +.idea/ + # Build and unit tests stuff # ############################# logs/ target/ +work/ +amps-standalone/ +*/dependency-reduced-pom.xml + +# Mac stuff # +############# +.DS_Store diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..54d1be4e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: java +jdk: + - openjdk7 + +# whitelist +branches: + only: + - master + +env: + global: + - secure: "Si+FksmD04Qev09hkYqWYN4rYQderrvMt6/kZBTgEek/v4Bd8QVCcbkZemYQCLnfhm94fNJDVrvpbrZhkeSWhCXKnnsYMH9oaxQWSd4aUI55V9QAseVAWMod5d2TSD7kTIo1owV5xh9LHTLmwnv4v6WmV3dSHSQc0zQh09dFC/M=" + - secure: "IVcJyf13GCwLkpYKqygwTH9f3EG1YiqdmXWPCt5d9DXKKLjbSq/MFQ/nwdgfgfJAsgrSXN0I+6fIf8/INtI4YcKTpzAblXdeAkWdVrD4xpRSC7TpEHdEGMWEBtSWzJy8b92F2cxCXuk/QPDK4d8/QuelkFD9C9IztmgSqq7fQQg=" + +before_install: + - sudo apt-get update -qq + +install: + mvn -q clean install -DskipTests=true diff --git a/README.md b/README.md index 5171a68f..98fe7da6 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,98 @@ -# GraphWalker - -GraphWalker is a Model-Based Testing tool. It parses models [finite-state machines] which are designed -using the yEd, http://www.yworks.com/en/products_yed_about.html, and generates test sequences. -The tool generates offline and more importanly, online test sequences from Finite State Machines and -Extended Finite State Machines. -See also: http://graphwalker.org - -The main features of GraphWalker are: - -### No UML ### - -GraphWalker's own ruleset in conjunction with GraphML, is easier to get started with than UML. As testers, we do not need all functionality that UML has to offer. - -###No exit/stop points ### -The idea behind this, is that we want long, unpredictable test sequences. We do not want to walk the same path every time we execute a test. We want variation, spiced with randomness. This will create a better 'test coverage' of the system under test. -The way to tell GraphWalker to stop generating test sequences are done by means of Stop Criterias, passed as arguments to the tool. +# Deprecated, all development is now @ https://github.com/graphwalker -### Online ### -It supports online test sequence generation. Using the online mode, the tool is capable of testing non-deterministic systems. In essence, this means that the path walked through the model is decided runtime, during the actual test execution. This is very helpful if your test execution tool needs to communicate with the model during the test. -### Event-driven ### -GraphWalker supports the possibility to switch model caused by an event. For example, let's say we have a model that executes the navigation of the GUI of a mobile phone. At any point in that execution, an incoming call will be such an event that will switch from navigating the GUI, to a model that handles the call. -## Reporting Issues - -https://github.com/KristianKarl/GraphWalker/issues - -## Build - -mvn assembly:assembly - -## Test - -mvn test +# GraphWalker -## Examples and Help +[![Build Status](https://travis-ci.org/nilols/GraphWalker.png)](https://travis-ci.org/nilols/GraphWalker) + +GraphWalker is a Model-Based Testing tool. It parses models and generates test sequences. + +## Table of Contents +1\. [Modules](#modules) +1\.1 [graphwalker-core](#graphwalker-core) +1\.2 [graphwalker-maven-plugin](#graphwalker-maven-plugin) +1\.3 [graphwalker-jenkins-plugin](#graphwalker-jenkins-plugin) +1\.4 [graphwalker-example](#graphwalker-example) +2\. [Example](#example) +2\.1 [pom.xml](#example-pom-xml) +2\.2 [Example.java](#example-example-java) +3\. [License](#license) + + +## 1\. Modules + +### 1\.1 graphwalker-core +Contains the GraphWalker implementation + + +### 1\.2 graphwalker-maven-plugin + + +### 1\.3 graphwalker-jenkins-plugin + + +### 1\.4 graphwalker-example +Showcase the GraphWalker project + +```sh +mvn graphwalker:test +``` + + +## 2\. Example + + +### 2\.1 pom.xml +Defines the dependencies needed to implement the model and the plugin needed to execution the model. A model can use actions and guards of any JSR 223 engine, but we need to add the dependency for the script engine. + +```xml +... + + + org.graphwalker + graphwalker-core + 3.0-SNAPSHOT + + + groovy + grovvy-all + 1.1-rc-1 + + +... + + + + org.graphwalker + graphwalker-maven-plugin + 3.0-SNAPSHOT + + + +... +``` + + +### 2\.2 Example.java +Implements all the vertices and edges defined by the model, in this case the Example.graphml. Through the annotation we can define a stop condition that differs from the default one, if we create a class that implements the StopCondition interface we can tell GraphWalker to use that implementation through the stopCondition parameter in the @GraphWalker annotation. + +```java +... +import my.package.MyStopCondition; +... +@GraphWalker(id = "MyExample", model = "models/Example.graphml", stopCondition = MyStopCondition.class) +public class Example { +... +``` + + +## 3\. License + +http://graphwalker.org/license/ -http://graphwalker.org/documentation/ -## License -http://graphwalker.org/license/ \ No newline at end of file diff --git a/graphwalker-cli/.gitignore b/graphwalker-cli/.gitignore new file mode 100644 index 00000000..07f1530d --- /dev/null +++ b/graphwalker-cli/.gitignore @@ -0,0 +1,3 @@ +# ignore temporary OpenOffice.org files +doc/.~lock.* + diff --git a/graphwalker-cli/doc/CLI.odt b/graphwalker-cli/doc/CLI.odt new file mode 100644 index 00000000..4bd42123 Binary files /dev/null and b/graphwalker-cli/doc/CLI.odt differ diff --git a/graphwalker-cli/pom.xml b/graphwalker-cli/pom.xml new file mode 100644 index 00000000..f6d39569 --- /dev/null +++ b/graphwalker-cli/pom.xml @@ -0,0 +1,64 @@ + + + 4.0.0 + + + org.graphwalker + graphwalker + 3.0-BETA-SNAPSHOT + + + graphwalker-cli + GraphWalker Command Line Interface + + + + org.apache.maven.plugins + maven-shade-plugin + 1.7.1 + + + package + + shade + + + + + org.graphwalker.cli.CLI + + + + + + + + + + + + org.graphwalker + graphwalker-core + ${project.version} + + + org.graphwalker + graphwalker-io + ${project.version} + + + com.beust + jcommander + 1.35 + + + junit + junit + 4.11 + test + + + + \ No newline at end of file diff --git a/graphwalker-cli/src/main/java/org/graphwalker/cli/CLI.java b/graphwalker-cli/src/main/java/org/graphwalker/cli/CLI.java new file mode 100644 index 00000000..57bbb525 --- /dev/null +++ b/graphwalker-cli/src/main/java/org/graphwalker/cli/CLI.java @@ -0,0 +1,178 @@ +/* + * #%L + * GraphWalker Command Line Interface + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.cli; + +import com.beust.jcommander.JCommander; +import org.graphwalker.cli.commands.Offline; +import org.graphwalker.core.*; +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.model.Element; +import org.graphwalker.io.factory.GraphMLModelFactory; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.Iterator; +import java.util.Properties; + +public class CLI { + JCommander jc; + Options options; + Offline offline; + + public static void main(String[] args) { + CLI cli = new CLI(); + try { + cli.run(args); + } catch (Exception e) { + // We should have caught all exceptions up until here, but there + // might have been problems with the command parser for instance... + System.err.println(e); + } + } + + /** + * Parses the command line. + * + * @param args + */ + private void run(String[] args) { + options = new Options(); + jc = new JCommander(options); + jc.setProgramName("java -jar graphwalker.jar"); + + offline = new Offline(); + jc.addCommand("offline", offline); + + try { + jc.parse(args); + + // Parse for commands + if (jc.getParsedCommand() != null) { + if (jc.getParsedCommand().equals("offline")) { + RunCommandOffline(); + } + } + + // Parse for arguments + else if (options.version) { + System.out.println(printVersionInformation()); + } + + // No commands or options were found + else { + jc.usage(); + } + + } catch (Exception e) { + System.err.println(e.getMessage()); + System.out.println(); + jc.usage(); + } + } + + private void RunCommandOffline() throws Exception { + GraphMLModelFactory factory = new GraphMLModelFactory(); + + Iterator itr = offline.model.iterator(); + while(itr.hasNext()) { + Model model = factory.create((String)itr.next()); + PathGenerator pathGenerator = GeneratorParser.parse((String)itr.next()); + + ExecutionContext context = new ExecutionContext(model, pathGenerator); + Machine machine = new SimpleMachine(context); + while (machine.hasNextStep()) { + Element e = machine.getNextStep(); + System.out.println(e.getName()); + } + } + + } + + private String printVersionInformation() { + String version = "org.graphwalker version: " + getVersionString() + System.getProperty("line.separator"); + version += System.getProperty("line.separator"); + + version += "org.graphwalker is open source software licensed under MIT license" + System.getProperty("line.separator"); + version += "The software (and it's source) can be downloaded from http://graphwalker.org" + System.getProperty("line.separator"); + version += "For a complete list of this package software dependencies, see TO BE DEFINED" + System.getProperty("line.separator"); + + return version; + } + + private String getVersionString() { + Properties properties = new Properties(); + InputStream inputStream = null; + try { + inputStream = getClass().getResourceAsStream("/org/graphwalker/resources/version.properties"); + properties.load(inputStream); + inputStream.close(); + } catch (IOException e) { + ; + } finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (Exception e) { + // ignore all exceptions + } + } + } + StringBuilder stringBuilder = new StringBuilder(); + if (properties.containsKey("version.major")) { + stringBuilder.append(properties.getProperty("version.major")); + } + if (properties.containsKey("version.minor")) { + stringBuilder.append("."); + stringBuilder.append(properties.getProperty("version.minor")); + } + if (properties.containsKey("version.fix")) { + stringBuilder.append("."); + stringBuilder.append(properties.getProperty("version.fix")); + } + if (properties.containsKey("version.git.commit")) { + stringBuilder.append(", git commit "); + stringBuilder.append(properties.getProperty("version.git.commit")); + } + return stringBuilder.toString(); + } + + private String generateListOfValidGenerators() { + return ""; + } + + private String generateListOfValidStopConditions() { + return ""; + } + + private boolean helpNeeded(String module, boolean condition, String message) { + if (condition) { + System.out.println(message); + System.out.println("Type 'java -jar graphwalker.jar help " + module + "' for help."); + } + return condition; + } +} diff --git a/graphwalker-cli/src/main/java/org/graphwalker/cli/GeneratorParser.java b/graphwalker-cli/src/main/java/org/graphwalker/cli/GeneratorParser.java new file mode 100644 index 00000000..2e6e974d --- /dev/null +++ b/graphwalker-cli/src/main/java/org/graphwalker/cli/GeneratorParser.java @@ -0,0 +1,153 @@ +/* + * #%L + * GraphWalker Command Line Interface + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.cli; + + +import org.graphwalker.core.PathGenerator; +import org.graphwalker.core.StopCondition; +import org.graphwalker.core.condition.AlternativeCondition; +import org.graphwalker.core.condition.BaseStopCondition; +import org.graphwalker.core.condition.CombinationalCondition; +import org.graphwalker.core.generator.BasePathGenerator; +import org.graphwalker.core.generator.CombinedPathGenerator; + +import java.util.List; + +import static org.graphwalker.cli.Lexer.lex; + +public class GeneratorParser { + + private static int readStopConditions(BasePathGenerator generator, List tokens, int i) { + + // Check parentheses + if (tokens.get(i).type != Lexer.TokenType.LPARENTHESES) { + throw new IllegalArgumentException("Expected a left parentheses, not: " + tokens.get(i).data); + } + int numberOfTokens = 0; + int parenthesesBalance = 0; + for (; i < tokens.size(); i++) { + if (tokens.get(i).type == Lexer.TokenType.LPARENTHESES) { + parenthesesBalance++; + } else if (tokens.get(i).type == Lexer.TokenType.RPARENTHESES) { + parenthesesBalance--; + } + + if (parenthesesBalance == 0) { + break; + } + numberOfTokens++; + } + + if (parenthesesBalance != 0) { + throw new IllegalArgumentException("Problem with parentheses balance."); + } + + BaseStopCondition stopCondition = null; + + // Check if whether we have single, alternative or combinatorial stop condition + List generatorTokens = tokens.subList(i - numberOfTokens, i); + for (int x = 0; x < generatorTokens.size(); x++) { + if (tokens.get(x).type == Lexer.TokenType.OR) { + stopCondition = new AlternativeCondition(); + break; + } else if (tokens.get(x).type == Lexer.TokenType.AND) { + stopCondition = new CombinationalCondition(); + break; + } + } + + parenthesesBalance = 0; + BaseStopCondition currentConditon = null; + for (int j = i - numberOfTokens; j < tokens.size(); j++) { + if (tokens.get(j).data instanceof StopCondition) { + currentConditon = (BaseStopCondition) tokens.get(j).data; + if (stopCondition instanceof AlternativeCondition) { + ((AlternativeCondition) stopCondition).add(currentConditon); + } else if (stopCondition instanceof CombinationalCondition) { + ((CombinationalCondition) stopCondition).add(currentConditon); + } else { + currentConditon = stopCondition = (BaseStopCondition) tokens.get(j).data; + } + continue; + } + if (tokens.get(j).type == Lexer.TokenType.NUMBER) { + currentConditon.setValue((String) tokens.get(j).data); + continue; + } + if (tokens.get(j).type == Lexer.TokenType.STRING) { + currentConditon.setValue((String) tokens.get(j).data); + continue; + } + + if (tokens.get(j).type == Lexer.TokenType.LPARENTHESES) { + parenthesesBalance++; + } else if (tokens.get(j).type == Lexer.TokenType.RPARENTHESES) { + parenthesesBalance--; + } + + if (parenthesesBalance == 0) { + break; + } + } + generator.setStopCondition(stopCondition); + + return i; + } + + public static PathGenerator parse(String str) { + + BasePathGenerator generator = null; + List tokens = lex(str); + + // Check if whether we have more than one generator + int numOfGenerators = 0; + for (Lexer.Token t : tokens) { + if (t.data instanceof PathGenerator) { + numOfGenerators++; + if (numOfGenerators >= 2) { + generator = new CombinedPathGenerator(); + break; + } + } + } + + for (int i = 0; i < tokens.size(); i++) { + // First we expect a generator + if (tokens.get(i).data instanceof PathGenerator) { + if (generator instanceof CombinedPathGenerator) { + ((CombinedPathGenerator) generator).addPathGenerator((PathGenerator) tokens.get(i).data); + } else { + generator = (BasePathGenerator) tokens.get(i).data; + } + i = readStopConditions((BasePathGenerator) tokens.get(i).data, tokens, ++i); + + } + } + + + return generator; + } +} diff --git a/graphwalker-cli/src/main/java/org/graphwalker/cli/Lexer.java b/graphwalker-cli/src/main/java/org/graphwalker/cli/Lexer.java new file mode 100644 index 00000000..5a65b35a --- /dev/null +++ b/graphwalker-cli/src/main/java/org/graphwalker/cli/Lexer.java @@ -0,0 +1,140 @@ +/* + * #%L + * GraphWalker Command Line Interface + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.cli; + +import org.graphwalker.core.condition.*; +import org.graphwalker.core.generator.AStarPath; +import org.graphwalker.core.generator.RandomPath; + +import java.util.ArrayList; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class Lexer { + public static ArrayList lex(String input) { + // The tokens to return + ArrayList tokens = new ArrayList(); + + // Lexer logic begins here + StringBuffer tokenPatternsBuffer = new StringBuffer(); + for (TokenType tokenType : TokenType.values()) + tokenPatternsBuffer.append(String.format("|(?<%s>%s)", tokenType.name(), tokenType.pattern)); + Pattern tokenPatterns = Pattern.compile(new String(tokenPatternsBuffer.substring(1))); + + // Begin matching tokens + Matcher matcher = tokenPatterns.matcher(input.toLowerCase()); + while (matcher.find()) { + if (matcher.group(TokenType.RANDOMGENERATOR.name()) != null) { + tokens.add(new Token(TokenType.RANDOMGENERATOR, new RandomPath())); + + } else if (matcher.group(TokenType.ASTARGENERATOR.name()) != null) { + tokens.add(new Token(TokenType.ASTARGENERATOR, new AStarPath())); + + } else if (matcher.group(TokenType.NEVER.name()) != null) { + tokens.add(new Token(TokenType.NEVER, new Never())); + + } else if (matcher.group(TokenType.EDGECOVERAGECONDITION.name()) != null) { + tokens.add(new Token(TokenType.EDGECOVERAGECONDITION, new EdgeCoverage())); + + } else if (matcher.group(TokenType.VERTEXCOVERAGECONDITION.name()) != null) { + tokens.add(new Token(TokenType.VERTEXCOVERAGECONDITION, new VertexCoverage())); + + } else if (matcher.group(TokenType.REACHEDEDGECONDITION.name()) != null) { + tokens.add(new Token(TokenType.REACHEDEDGECONDITION, new ReachedEdge())); + + } else if (matcher.group(TokenType.REACHEDVERTEXCONDITION.name()) != null) { + tokens.add(new Token(TokenType.REACHEDVERTEXCONDITION, new ReachedVertex())); + + } else if (matcher.group(TokenType.TIMEDURATIONCONDITION.name()) != null) { + tokens.add(new Token(TokenType.TIMEDURATIONCONDITION, new TimeDuration())); + + } else if (matcher.group(TokenType.OR.name()) != null) { + tokens.add(new Token(TokenType.OR, matcher.group(TokenType.OR.name()))); + + } else if (matcher.group(TokenType.AND.name()) != null) { + tokens.add(new Token(TokenType.AND, matcher.group(TokenType.AND.name()))); + + } else if (matcher.group(TokenType.STRING.name()) != null) { + // Remove quotation marks + String str = matcher.group(TokenType.STRING.name()); + tokens.add(new Token(TokenType.STRING, input.substring(matcher.start() + 1, matcher.end() - 1))); + + } else if (matcher.group(TokenType.NUMBER.name()) != null) { + tokens.add(new Token(TokenType.NUMBER, matcher.group(TokenType.NUMBER.name()))); + + } else if (matcher.group(TokenType.LPARENTHESES.name()) != null) { + tokens.add(new Token(TokenType.LPARENTHESES, matcher.group(TokenType.LPARENTHESES.name()))); + + } else if (matcher.group(TokenType.RPARENTHESES.name()) != null) { + tokens.add(new Token(TokenType.RPARENTHESES, matcher.group(TokenType.RPARENTHESES.name()))); + + } else if (matcher.group(TokenType.WHITESPACE.name()) != null) + ; + } + + return tokens; + } + + public static enum TokenType { + // Token types cannot have underscores + RANDOMGENERATOR("random"), + ASTARGENERATOR("a_star"), + EDGECOVERAGECONDITION("edge_coverage"), + VERTEXCOVERAGECONDITION("vertex_coverage"), + REACHEDEDGECONDITION("reached_edge"), + REACHEDVERTEXCONDITION("reached_vertex"), + TIMEDURATIONCONDITION("time_duration"), + NEVER("never"), + OR(" or "), + AND(" and "), + LPARENTHESES("[(]{1}"), + RPARENTHESES("[)]{1}"), + STRING("\"\\p{ASCII}+?\""), + NUMBER("-?[0-9]+"), + WHITESPACE("[\\s]+"); + + public final String pattern; + + private TokenType(String pattern) { + this.pattern = pattern; + } + } + + public static class Token { + public TokenType type; + public Object data; + + public Token(TokenType type, Object data) { + this.type = type; + this.data = data; + } + + @Override + public String toString() { + return String.format("(%s %s)", type.name(), data.toString()); + } + } +} \ No newline at end of file diff --git a/graphwalker-cli/src/main/java/org/graphwalker/cli/Options.java b/graphwalker-cli/src/main/java/org/graphwalker/cli/Options.java new file mode 100644 index 00000000..45d9e5e0 --- /dev/null +++ b/graphwalker-cli/src/main/java/org/graphwalker/cli/Options.java @@ -0,0 +1,39 @@ +/* + * #%L + * GraphWalker Command Line Interface + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.cli; + +import com.beust.jcommander.Parameter; + +import java.util.ArrayList; +import java.util.List; + +public class Options { + @Parameter(names = { "--help", "-h" }, help = true, description = "Prints help text") + private boolean help; + + @Parameter(names = { "--version", "-v" }, description = "Prints the version of graphwalker") + public boolean version = false; +} diff --git a/graphwalker-cli/src/main/java/org/graphwalker/cli/commands/Offline.java b/graphwalker-cli/src/main/java/org/graphwalker/cli/commands/Offline.java new file mode 100644 index 00000000..8e5bcc88 --- /dev/null +++ b/graphwalker-cli/src/main/java/org/graphwalker/cli/commands/Offline.java @@ -0,0 +1,41 @@ +/* + * #%L + * GraphWalker Command Line Interface + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.cli.commands; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.Parameters; + +import java.util.ArrayList; +import java.util.List; + +@Parameters(commandDescription = "Generate a test sequence offline. The sequence is printed to the standard output") +public class Offline { + + @Parameter(names = {"--model", "-m"}, required = true, arity = 2, + description = "The model, as a graphml file followed by generator with stop condition. " + + "The format is GENERATOR(STOP_CONDITION) See HTML DOC") + public List model = new ArrayList(); +} diff --git a/graphwalker-cli/src/main/resources/org/graphwalker/resources/version.properties b/graphwalker-cli/src/main/resources/org/graphwalker/resources/version.properties new file mode 100644 index 00000000..0d368911 --- /dev/null +++ b/graphwalker-cli/src/main/resources/org/graphwalker/resources/version.properties @@ -0,0 +1,28 @@ +### +# #%L +# GraphWalker Command Line Interface +# %% +# Copyright (C) 2011 - 2014 GraphWalker +# %% +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# #L% +### +version.major=3 +version.minor=0 +version.fix=0 diff --git a/graphwalker-cli/src/test/java/org/graphwalker/RegexMatcher.java b/graphwalker-cli/src/test/java/org/graphwalker/RegexMatcher.java new file mode 100644 index 00000000..ae0ecc1b --- /dev/null +++ b/graphwalker-cli/src/test/java/org/graphwalker/RegexMatcher.java @@ -0,0 +1,54 @@ +/* + * #%L + * GraphWalker Command Line Interface + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker; + + +import org.hamcrest.BaseMatcher; +import org.hamcrest.Description; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class RegexMatcher extends BaseMatcher { + private final String regex; + + public RegexMatcher(String regex){ + this.regex = regex; + } + + public boolean matches(Object o){ + Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); + return pattern.matcher((String)o).find(); + } + + public void describeTo(Description description){ + description.appendText("matches regex="); + } + + public static RegexMatcher matches(String regex){ + return new RegexMatcher(regex); + } +} \ No newline at end of file diff --git a/graphwalker-cli/src/test/java/org/graphwalker/cli/CLITest.java b/graphwalker-cli/src/test/java/org/graphwalker/cli/CLITest.java new file mode 100644 index 00000000..c0497287 --- /dev/null +++ b/graphwalker-cli/src/test/java/org/graphwalker/cli/CLITest.java @@ -0,0 +1,251 @@ +/* + * #%L + * GraphWalker Command Line Interface + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +// This file is part of the GraphWalker java package +// The MIT License +// +// Copyright (c) 2010 graphwalker.org +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package org.graphwalker.cli; + +import static org.graphwalker.RegexMatcher.matches; +import static org.hamcrest.CoreMatchers.*; + +import org.graphwalker.cli.CLI; +import org.junit.Assert; +import org.junit.Test; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintStream; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static org.hamcrest.core.Is.is; + + +public class CLITest { + + Pattern pattern; + Matcher matcher; + StringBuffer stdOutput; + StringBuffer errOutput; + String outMsg; + String errMsg; + String usageMsg = "^Usage: java -jar graphwalker.jar .*"; + + static Logger logger = Logger.getAnonymousLogger(); + private CLI commandLineInterface; + + private OutputStream redirectOut() { + return new OutputStream() { + @Override + public void write(int b) throws IOException { + stdOutput.append(Character.toString((char) b)); + } + }; + } + + private OutputStream redirectErr() { + return new OutputStream() { + @Override + public void write(int b) throws IOException { + errOutput.append(Character.toString((char) b)); + } + }; + } + + private InputStream redirectIn() { + return new InputStream() { + @Override + public int read() throws IOException { + try { + Thread.sleep(300); + } catch (InterruptedException e) { + logger.log(Level.ALL, "Unit testing was interrupted", e.getStackTrace()); + } + return '0'; + } + }; + } + + private void runCommand(String args[]) { + stdOutput = new StringBuffer(); + errOutput = new StringBuffer(); + + PrintStream outStream = new PrintStream(redirectOut()); + PrintStream oldOutStream = System.out; // backup + PrintStream errStream = new PrintStream(redirectErr()); + PrintStream oldErrStream = System.err; // backup + + System.setOut(outStream); + System.setErr(errStream); + + commandLineInterface = new CLI(); + commandLineInterface.main(args); + + System.setOut(oldOutStream); + System.setErr(oldErrStream); + + outMsg = stdOutput.toString(); + errMsg = errOutput.toString(); + logger.log(Level.FINER, "stdout: " + outMsg); + logger.log(Level.FINER, "stderr: " + errMsg); + } + + private void moveMbtPropertiesFile() { + File mbt_properties = new File("graphwalker.properties"); + if (mbt_properties.exists()) { + mbt_properties.renameTo(new File("graphwalker.properties.bak")); + } + Assert.assertFalse(new File("graphwalker.properties").exists()); + } + + private void restoreMbtPropertiesFile() { + File mbt_properties = new File("graphwalker.properties.bak"); + if (mbt_properties.exists()) { + mbt_properties.renameTo(new File("graphwalker.properties")); + } + Assert.assertFalse(new File("graphwalker.properties.bak").exists()); + } + + /** + * Simulates + * java -jar graphwalker.jar -v + */ + @Test + public void testVersion() { + String args[] = {"-v"}; + runCommand(args); + Assert.assertThat( "No error messages should occur", errMsg, is("")); + Assert.assertThat( "Expected output", outMsg, matches("^org.graphwalker version: [0-9]+\\.[0-9]+\\.[0-9]+")); + } + + /** + * Simulates + * java -jar graphwalker.jar + */ + @Test + public void testNoArgs() { + String args[] = {}; + moveMbtPropertiesFile(); + runCommand(args); + restoreMbtPropertiesFile(); + Assert.assertThat( outMsg, matches(usageMsg)); + Assert.assertThat( "Nothing should be written to standard err", errMsg, is("")); + } + + /** + * Simulates + * java -jar graphwalker.jar sputnik + */ + @Test + public void testUnknownCommand() { + String args[] = {"sputnik"}; + runCommand(args); + Assert.assertThat( errMsg, containsString("Expected a command, got sputnik")); + Assert.assertThat( outMsg, matches(usageMsg)); + } + + /** + * Simulates + * java -jar graphwalker.jar offline -m graphml/UC01.graphml "random(edge_coverage(100))" + */ + @Test + public void testOfflineRandomEdgeCoverage100percent() { + String args[] = {"offline", "-m", "graphml/UC01.graphml", "random(edge_coverage(100))"}; + runCommand(args); + Assert.assertThat( "No error messages should occur", errMsg, is("")); + Assert.assertThat( outMsg, matches("^Start\n.*")); + } + + /** + * Simulates + * java -jar graphwalker.jar offline -f graphml/UC01.graphml -g A_STAR -s EDGE_COVERAGE:100 + */ + @Test + public void multipleModels() { + String args[] = {"offline", "-m", "graphml/switch_model/A.graphml", "random(edge_coverage(100))", + "-m", "graphml/switch_model/B.graphml","random(edge_coverage(100))"}; + runCommand(args); + Assert.assertThat( "No error messages should occur", errMsg, is("")); +// Assert.assertEquals("Expected 38 lines beginning with v_" , 38, getNumMatches(Pattern.compile("v_").matcher(outMsg))); +// Assert.assertEquals("Expected 38 lines beginning with e_" , 38, getNumMatches(Pattern.compile("e_").matcher(outMsg))); + } + + /** + * Simulates + */ + @Test + public void testOffline2generators() { + String args[] = {"offline", "-m", "graphml/switch_model/A.graphml", "random(edge_coverage(100)) random(vertex_coverage(100))"}; + runCommand(args); + Assert.assertThat( "No error messages should occur", errMsg, is("")); + } + + + private int getNumMatches(Matcher m) { + int numMatches = 0; + while (m.find() == true) + numMatches++; + return numMatches; + } + + /** + * Simulates + * java -jar graphwalker.jar offline -f graphml/UC01.graphml -g A_STAR -s EDGE_COVERAGE:100 + */ + @Test + public void testOfflineA_StarEdgeCoverage100percent() { + String args[] = {"offline", "-m", "graphml/UC01.graphml", "-g", "a_star(edge_coverage(100))"}; + runCommand(args); +// Assert.assertThat( "No error messages should occur", errMsg, is("")); +// Assert.assertEquals("Expected 38 lines beginning with v_" , 38, getNumMatches(Pattern.compile("v_").matcher(outMsg))); +// Assert.assertEquals("Expected 38 lines beginning with e_" , 38, getNumMatches(Pattern.compile("e_").matcher(outMsg))); + } + +} diff --git a/graphwalker-cli/src/test/java/org/graphwalker/cli/GeneratorParserTest.java b/graphwalker-cli/src/test/java/org/graphwalker/cli/GeneratorParserTest.java new file mode 100644 index 00000000..c08df3d2 --- /dev/null +++ b/graphwalker-cli/src/test/java/org/graphwalker/cli/GeneratorParserTest.java @@ -0,0 +1,144 @@ +/* + * #%L + * GraphWalker Command Line Interface + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.cli; + + +import org.graphwalker.core.PathGenerator; +import org.graphwalker.core.condition.*; +import org.graphwalker.core.generator.AStarPath; +import org.graphwalker.core.generator.CombinedPathGenerator; +import org.graphwalker.core.generator.RandomPath; +import org.junit.Assert; +import org.junit.Test; + +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsInstanceOf.instanceOf; + +public class GeneratorParserTest { + + @Test // Single stop condition + public void test1() { + PathGenerator generator = GeneratorParser.parse("random(edge_coverage(100))"); + Assert.assertThat(generator, instanceOf(RandomPath.class)); + Assert.assertThat(generator.getStopCondition(), instanceOf(EdgeCoverage.class) ); + Assert.assertThat(generator.getStopCondition().getValue(), is("100") ); + } + + @Test // Single stop condition + public void test2() { + PathGenerator generator = GeneratorParser.parse("random(vertex_coverage(100))"); + Assert.assertThat(generator, instanceOf(RandomPath.class)); + Assert.assertThat(generator.getStopCondition(), instanceOf(VertexCoverage.class) ); + Assert.assertThat(generator.getStopCondition().getValue(), is("100") ); + } + + @Test // Single stop condition + public void test3() { + PathGenerator generator = GeneratorParser.parse("a_star(reached_vertex(\"v_ABC\"))"); + Assert.assertThat(generator, instanceOf(AStarPath.class)); + Assert.assertThat(generator.getStopCondition(), instanceOf(ReachedVertex.class) ); + Assert.assertThat(generator.getStopCondition().getValue(), is("v_ABC") ); + } + + @Test // Single stop condition + public void test4() { + PathGenerator generator = GeneratorParser.parse("random(reached_edge(\"edgeName\"))"); + Assert.assertThat(generator, instanceOf(RandomPath.class)); + Assert.assertThat(generator.getStopCondition(), instanceOf(ReachedEdge.class) ); + Assert.assertThat(generator.getStopCondition().getValue(), is("edgeName") ); + } + + @Test // Single stop condition + public void test5() { + PathGenerator generator = GeneratorParser.parse("random(reached_vertex(\"vertexName\"))"); + Assert.assertThat(generator, instanceOf(RandomPath.class)); + Assert.assertThat(generator.getStopCondition(), instanceOf(ReachedVertex.class) ); + Assert.assertThat(generator.getStopCondition().getValue(), is("vertexName") ); + } + + @Test // Single stop condition + public void test6() { + PathGenerator generator = GeneratorParser.parse("random(time_duration(600))"); + Assert.assertThat(generator, instanceOf(RandomPath.class)); + Assert.assertThat(generator.getStopCondition(), instanceOf(TimeDuration.class) ); + Assert.assertThat(generator.getStopCondition().getValue(), is("600") ); + } + + @Test // 2 stop condition, logical OR'd, and with white spaces in expression + public void test7() { + PathGenerator generator = GeneratorParser.parse("random ( edge_coverage(100) and vertex_coverage (100) )"); + Assert.assertThat(generator, instanceOf(RandomPath.class)); + Assert.assertThat(generator.getStopCondition(), instanceOf(CombinationalCondition.class) ); + } + + @Test // 2 stop condition, logical OR'd, and with white spaces in expression + public void test8() { + PathGenerator generator = GeneratorParser.parse("random ( reached_vertex(\"Some_vertex\") or reached_edge ( \"Some_edge\" ) )"); + Assert.assertThat(generator, instanceOf(RandomPath.class)); + Assert.assertThat(generator.getStopCondition(), instanceOf(AlternativeCondition.class) ); + + AlternativeCondition condition = (AlternativeCondition)generator.getStopCondition(); + Assert.assertThat(condition.getStopConditionAtIndex(0), instanceOf(ReachedVertex.class) ); + Assert.assertThat(condition.getStopConditionAtIndex(0).getValue(), is("Some_vertex") ); + Assert.assertThat(condition.getStopConditionAtIndex(1), instanceOf(ReachedEdge.class) ); + Assert.assertThat(condition.getStopConditionAtIndex(1).getValue(), is("Some_edge") ); + } + + @Test // 2 stop condition, logical OR'd, and with white spaces in expression + public void test9() { + PathGenerator generator = GeneratorParser.parse("random ( edge_coverage(100) or vertex_coverage (100) )"); + Assert.assertThat(generator, instanceOf(RandomPath.class)); + Assert.assertThat(generator.getStopCondition(), instanceOf(AlternativeCondition.class) ); + } + + @Test // 2 stop condition, logical AND'd, and with white spaces in expression + public void test10() { + PathGenerator generator = GeneratorParser.parse("random( edge_coverage(100) or time_duration(500) ) a_star(reached_vertex(\"v_ABC\"))"); + Assert.assertThat(generator, instanceOf(CombinedPathGenerator.class)); + Assert.assertThat(generator.getStopCondition(), instanceOf(AlternativeCondition.class) ); + + AlternativeCondition condition = (AlternativeCondition)generator.getStopCondition(); + Assert.assertThat(condition.getStopConditionAtIndex(0), instanceOf(EdgeCoverage.class) ); + Assert.assertThat(condition.getStopConditionAtIndex(1), instanceOf(TimeDuration.class) ); + + + Assert.assertThat(((CombinedPathGenerator)generator).getPathGeneratorAtIndex(0).getStopCondition(), instanceOf(AlternativeCondition.class) ); + Assert.assertThat(((CombinedPathGenerator)generator).getPathGeneratorAtIndex(1).getStopCondition(), instanceOf(ReachedVertex.class) ); + } + + @Test // 2 stop condition, logical OR'd, and with white spaces in expression + public void test11() { + PathGenerator generator = GeneratorParser.parse("RANDOM ( REACHED_VERTEX(\"Some_vertex\") OR REACHED_EDGE ( \"Some_edge\" ) )"); + Assert.assertThat(generator, instanceOf(RandomPath.class)); + Assert.assertThat(generator.getStopCondition(), instanceOf(AlternativeCondition.class) ); + + AlternativeCondition condition = (AlternativeCondition)generator.getStopCondition(); + Assert.assertThat(condition.getStopConditionAtIndex(0), instanceOf(ReachedVertex.class) ); + Assert.assertThat(condition.getStopConditionAtIndex(0).getValue(), is("Some_vertex") ); + Assert.assertThat(condition.getStopConditionAtIndex(1), instanceOf(ReachedEdge.class) ); + Assert.assertThat(condition.getStopConditionAtIndex(1).getValue(), is("Some_edge") ); + } +} diff --git a/graphwalker-cli/src/test/java/org/graphwalker/cli/LexerTest.java b/graphwalker-cli/src/test/java/org/graphwalker/cli/LexerTest.java new file mode 100644 index 00000000..d9d1de89 --- /dev/null +++ b/graphwalker-cli/src/test/java/org/graphwalker/cli/LexerTest.java @@ -0,0 +1,66 @@ +/* + * #%L + * GraphWalker Command Line Interface + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.cli; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.graphwalker.cli.Lexer.lex; + +public class LexerTest { + + @Test + public void simple1() { + + List tokens = lex("random(never)"); + for(Lexer.Token t : tokens) { + System.out.println(t); + } + + } + + @Test + public void simple2() { + + List tokens = lex("random(edge_coverage(100) and never)"); + for(Lexer.Token t : tokens) { + System.out.println(t); + } + + } + + @Test + public void simple3() { + + List tokens = lex("random(edge_coverage(100) and never) a_star(reached_vertex(\"v_SomeName\") or edge_coverage(90))"); + for(Lexer.Token t : tokens) { + System.out.println(t); + } + + } +} \ No newline at end of file diff --git a/graphwalker-cli/src/test/resources/graphml/UC01.graphml b/graphwalker-cli/src/test/resources/graphml/UC01.graphml new file mode 100644 index 00000000..e5e1f1ef --- /dev/null +++ b/graphwalker-cli/src/test/resources/graphml/UC01.graphml @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + + v_BrowserStarted + + + + + + + + + + + + v_BaseURL + + + + + + + + + + + + v_SearchResult + + + + + + + + + + + + v_BrowserStopped + + + + + + + + + + + + v_BookInformation + + + + + + + + + + + + v_OtherBoughtBooks + + + + + + + + + + + + v_ShoppingCart + + + + + + + + + + + + e_init / num_of_books = 0; MAX_BOOKS = 5; + + + + + + + + + + + + e_EnterBaseURL + + + + + + + + + + + + e_SearchBook + + + + + + + + + + + + e_StartBrowser + + + + + + + + + + + + e_ClickBook + + + + + + + + + + + + + + + e_AddBookToCart [num_of_books<=MAX_BOOKS] / num_of_books++; + + + + + + + + + + + + + + + e_ShoppingCart + + + + + + + + + + + + + + + + + e_ShoppingCart + + + + + + + + + + + + e_ShoppingCart + + + + + + + + + + + + + + + + + e_SearchBook + + + + + + + + + + + + + + + + + e_SearchBook + + + + + + + + + + + + + + + + + e_SearchBook + + + + + + + + + + diff --git a/graphwalker-cli/src/test/resources/graphml/switch_model/A.graphml b/graphwalker-cli/src/test/resources/graphml/switch_model/A.graphml new file mode 100644 index 00000000..5220ed42 --- /dev/null +++ b/graphwalker-cli/src/test/resources/graphml/switch_model/A.graphml @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + v_ClientNotRunning + + + + + + + + + + + v_LoginPrompted + + + + + + + + + + + v_WhatsNew +SWITCH_MODEL + + + + + + + + + + + e_Init/validLogin=false;rememberMe=false + + + + + + + + + + + + + + + + e_StartClient[!rememberMe||!validLogin] + + + + + + + + + + + + + + + + + e_ValidPremiumCredentials/validLogin=true; + + + + + + + + + + + + + + + + + e_Logout + + + + + + + + + + + + + + + + + e_Exit + + + + + + + + + + + + + + + e_ToggleRememberMe/rememberMe=!rememberMe; + + + + + + + + + + + + + + + + e_Close + + + + + + + + + + + + + + + + e_StartClient[rememberMe&&validLogin] + + + + + + + + + + + + + + + e_InvalidCredentials/validLogin=false; + + + + + + + + + diff --git a/src/test/resources/graphml/multiple/switch/B.graphml b/graphwalker-cli/src/test/resources/graphml/switch_model/B.graphml similarity index 100% rename from src/test/resources/graphml/multiple/switch/B.graphml rename to graphwalker-cli/src/test/resources/graphml/switch_model/B.graphml diff --git a/graphwalker-core/pom.xml b/graphwalker-core/pom.xml new file mode 100644 index 00000000..ab013a13 --- /dev/null +++ b/graphwalker-core/pom.xml @@ -0,0 +1,55 @@ + + + 4.0.0 + + + org.graphwalker + graphwalker + 3.0-BETA-SNAPSHOT + + + graphwalker-core + GraphWalker Core + + + + org.apache.commons + commons-lang3 + + + junit + junit + test + + + + + + + org.codehaus.mojo + cobertura-maven-plugin + + + true + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + clean + check + + + + + + + \ No newline at end of file diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/Bundle.java b/graphwalker-core/src/main/java/org/graphwalker/core/Bundle.java new file mode 100644 index 00000000..9da326c1 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/Bundle.java @@ -0,0 +1,35 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2012 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core; + +/** + * @author Nils Olsson + */ +public interface Bundle { + + /** Constant NAME="core" */ + String NAME = "core"; +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/Machine.java b/graphwalker-core/src/main/java/org/graphwalker/core/Machine.java new file mode 100644 index 00000000..249c9275 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/Machine.java @@ -0,0 +1,46 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core; + +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.model.Element; +import org.graphwalker.core.script.ScriptContext; + +import java.util.List; + +/** + * @author Nils Olsson + */ +public interface Machine { + Element getNextStep(); + Element getCurrentStep(); + Boolean hasNextStep(); + ScriptContext getScriptContext(); + void restart(); + ExecutionContext getCurrentExecutionContext(); + List getExecutionContexts(); + void failCurrentStep(); +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/Model.java b/graphwalker-core/src/main/java/org/graphwalker/core/Model.java new file mode 100644 index 00000000..981f286e --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/Model.java @@ -0,0 +1,56 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core; + +import org.graphwalker.core.model.*; + +import java.util.List; + +/** + * @author Nils Olsson + */ +public interface Model { + void refresh(); + Model addEdge(Edge edge); + Model addModel(Model model); + Model addModel(Model model, boolean refresh); + Model addVertex(Vertex vertex); + List getEdges(); + List getEdges(String name); + List getEdges(Vertex vertex); + List getVertices(); + Vertex getVertex(String name); + Vertex getVertex(Vertex vertex); + String getDescription(); + List getElements(); + List getElements(Element element); + List getConnectedComponent(Element element); + Path getShortestPath(Element origin, Element destination); + int getShortestDistance(Element origin, Element destination); + int getMaximumDistance(Element destination); + List getStartVertices(); + List getRequirements(); +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/PathGenerator.java b/graphwalker-core/src/main/java/org/graphwalker/core/PathGenerator.java new file mode 100644 index 00000000..33d889e2 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/PathGenerator.java @@ -0,0 +1,38 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core; + +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.model.Element; + +/** + * @author Nils Olsson + */ +public interface PathGenerator { + Element getNextStep(ExecutionContext context); + Boolean hasNextStep(ExecutionContext context); + StopCondition getStopCondition(); +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/SimpleMachine.java b/graphwalker-core/src/main/java/org/graphwalker/core/SimpleMachine.java new file mode 100644 index 00000000..12a62f3a --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/SimpleMachine.java @@ -0,0 +1,129 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core; + +import org.graphwalker.core.event.EventSource; +import org.graphwalker.core.event.MachineSink; +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.machine.ExecutionStatus; +import org.graphwalker.core.model.Action; +import org.graphwalker.core.model.Edge; +import org.graphwalker.core.model.Element; +import org.graphwalker.core.model.Vertex; +import org.graphwalker.core.script.ScriptContext; + +import javax.script.ScriptException; +import java.util.*; + +/** + * @author Nils Olsson + */ +public final class SimpleMachine extends EventSource implements Machine { + + private final List executionContexts; + private ExecutionContext currentExecutionContext; + + public SimpleMachine(ExecutionContext executionContext) { + this(new ArrayList<>(Arrays.asList(executionContext))); + } + + public SimpleMachine(List executionContexts) { + this.executionContexts = Collections.unmodifiableList(executionContexts); + } + + @Override + public Element getNextStep() { + if (ExecutionStatus.NOT_EXECUTED.equals(getCurrentExecutionContext().getExecutionStatus())) { + getCurrentExecutionContext().setExecutionStatus(ExecutionStatus.EXECUTING); + } + Element currentStep = getCurrentExecutionContext().getCurrentElement(); + if (currentStep instanceof Vertex) { + Vertex vertex = (Vertex)currentStep; + execute(vertex.getExitActions()); + } + currentStep = getCurrentExecutionContext().getPathGenerator().getNextStep(getCurrentExecutionContext()); + if (currentStep instanceof Vertex) { + Vertex vertex = (Vertex)currentStep; + execute(vertex.getEntryActions()); + } else { + Edge edge = (Edge)currentStep; + execute(edge.getActions()); + } + return currentStep; + } + + private void execute(Set actions) { + for (Action action: actions) { + try { + getCurrentExecutionContext().getScriptEngine().eval(action.getScript()); + } catch (ScriptException e) { + e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + } + } + } + + @Override + public Element getCurrentStep() { + return getCurrentExecutionContext().getCurrentElement(); + } + + @Override + public Boolean hasNextStep() { + boolean isFulfilled = getCurrentExecutionContext().getStopCondition().isFulfilled(getCurrentExecutionContext()); + if (isFulfilled && ExecutionStatus.EXECUTING.equals(getCurrentExecutionContext().getExecutionStatus())) { + getCurrentExecutionContext().setExecutionStatus(ExecutionStatus.COMPLETED); + } + return !isFulfilled; + } + + @Override + public ScriptContext getScriptContext() { + return getCurrentExecutionContext().getScriptContext(); + } + + @Override + public void failCurrentStep() { + getCurrentExecutionContext().setExecutionStatus(ExecutionStatus.FAILED); + } + + @Override + public void restart() { + getCurrentExecutionContext().setCurrentElement(null); + } + + @Override + public ExecutionContext getCurrentExecutionContext() { + if (null == currentExecutionContext) { + currentExecutionContext = getExecutionContexts().get(0); + } + return currentExecutionContext; + } + + @Override + public List getExecutionContexts() { + return executionContexts; + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/SimpleModel.java b/graphwalker-core/src/main/java/org/graphwalker/core/SimpleModel.java new file mode 100644 index 00000000..25e0df39 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/SimpleModel.java @@ -0,0 +1,292 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core; + +import org.graphwalker.core.algorithm.AStar; +import org.graphwalker.core.algorithm.DepthFirstSearch; +import org.graphwalker.core.algorithm.FloydWarshall; +import org.graphwalker.core.event.EventSource; +import org.graphwalker.core.event.ModelSink; +import org.graphwalker.core.model.*; + +import java.util.*; + +/** + * @author Nils Olsson + */ +public final class SimpleModel extends EventSource implements Model { + + private final Map vertices; + private final Map edges; + private AStar aStar; + private DepthFirstSearch depthFirstSearch; + private FloydWarshall floydWarshall; + private final List startVertices; + private final List elementCache; + private final Map> vertexEdgeCache; + private final Map> edgeNameCache; + private final List requirementCache; + + public SimpleModel() { + this(true); + } + + public SimpleModel(boolean refresh) { + this(new HashSet(), new HashSet(), refresh); + } + + public SimpleModel(Set vertices, Set edges) { + this(vertices, edges, true); + } + + public SimpleModel(Set vertices, Set edges, boolean refresh) { + this.vertices = asUnmodifiableMap(vertices); + this.edges = asUnmodifiableMap(edges); + this.startVertices = findStartVertices(); + this.elementCache = createElementCache(); + this.vertexEdgeCache = createVertexEdgeCache(); + this.edgeNameCache = createEdgeNameCache(); + this.requirementCache = aggregateRequirements(); + if (refresh) { + refresh(); + } + } + + @Override + public void refresh() { + this.aStar = new AStar(this); + this.depthFirstSearch = new DepthFirstSearch(this); + this.floydWarshall = new FloydWarshall(this); + } + + private Map> createVertexEdgeCache() { + Map> vertexEdgeCache = new HashMap<>(); + for (Vertex vertex: vertices.values()) { + vertexEdgeCache.put(vertex, new ArrayList()); + } + for (Edge edge: edges.values()) { + vertexEdgeCache.get(edge.getSourceVertex()).add(edge); + } + Map> unmodifiableVertexEdgeCache = new HashMap<>(); + for (Vertex vertex: vertexEdgeCache.keySet()) { + unmodifiableVertexEdgeCache.put(vertex, Collections.unmodifiableList(vertexEdgeCache.get(vertex))); + } + return Collections.unmodifiableMap(unmodifiableVertexEdgeCache); + } + + private Map> createEdgeNameCache() { + Map> edgeNameCache = new HashMap<>(); + for (Edge edge: edges.keySet()) { + if (!edgeNameCache.containsKey(edge.getName())) { + edgeNameCache.put(edge.getName(), new ArrayList()); + } + edgeNameCache.get(edge.getName()).add(edge); + } + Map> unmodifiableEdgeNameCache = new HashMap<>(); + for (String name: edgeNameCache.keySet()) { + unmodifiableEdgeNameCache.put(name, Collections.unmodifiableList(edgeNameCache.get(name))); + } + return Collections.unmodifiableMap(unmodifiableEdgeNameCache); + } + + private List createElementCache() { + Set elementSet = new HashSet<>(); + elementSet.addAll(vertices.values()); + elementSet.addAll(edges.values()); + return Collections.unmodifiableList(new ArrayList<>(elementSet)); + } + + private List findStartVertices() { + Set vertexSet = new HashSet<>(vertices.values()); + for (Edge edge: edges.values()) { + vertexSet.remove(edge.getTargetVertex()); + } + return Collections.unmodifiableList(new ArrayList<>(vertexSet)); + } + + private List aggregateRequirements() { + Set requirements = new HashSet<>(); + for (Vertex vertex: vertices.keySet()) { + requirements.addAll(vertex.getRequirements()); + } + return Collections.unmodifiableList(new ArrayList<>(requirements)); + } + + private Map asUnmodifiableMap(Set set) { + Map map = new HashMap<>(); + for (T entry: set) { + map.put(entry, entry); + } + return Collections.unmodifiableMap(map); + } + + @Override + public Model addEdge(Edge edge) { + return addModel(new SimpleModel(new HashSet<>(Arrays.asList(edge.getSourceVertex() + , edge.getTargetVertex())), new HashSet<>(Arrays.asList(edge)))); + } + + @Override + public Model addVertex(Vertex vertex) { + return addModel(new SimpleModel(new HashSet<>(Arrays.asList(vertex)), new HashSet())); + } + + @Override + public Model addModel(Model model) { + return addModel(model, true); + } + + @Override + public Model addModel(Model model, boolean refresh) { + Map vertexMap = new HashMap<>(vertices); + for (Vertex vertex: model.getVertices()) { + if (vertexMap.containsKey(vertex)) { + Vertex merged = merge(vertex.getName(), vertexMap.get(vertex), vertex); + vertexMap.put(merged, merged); + } else { + vertexMap.put(vertex, vertex); + } + } + Map edgeMap = new HashMap<>(); + for (Edge edge: edges.keySet()) { + updateEdge(edge, edgeMap, vertexMap); + } + for (Edge edge: model.getEdges()) { + if (!edgeMap.containsKey(edge)) { + updateEdge(edge, edgeMap, vertexMap); + } + } + return new SimpleModel(new HashSet<>(vertexMap.values()), new HashSet<>(edgeMap.values()), refresh); + } + + private void updateEdge(Edge edge, Map edges, Map vertices) { + Vertex source = vertices.get(edge.getSourceVertex()); + Vertex target = vertices.get(edge.getTargetVertex()); + Edge updatedEdge = new Edge(edge.getName() + , source + , target + , edge.getGuard() + , edge.getActions() + , edge.isBlocked() + , edge.getWeight()); + edges.put(updatedEdge, updatedEdge); + } + + private Vertex merge(String name, Vertex... vertices) { + Set requirements = new HashSet<>(); + Set entryActions = new HashSet<>(); + Set exitActions = new HashSet<>(); + for (Vertex vertex: vertices) { + requirements.addAll(vertex.getRequirements()); + entryActions.addAll(vertex.getEntryActions()); + exitActions.addAll(vertex.getExitActions()); + } + return new Vertex(name, requirements, entryActions, exitActions); + } + + @Override + public List getEdges() { + return new ArrayList<>(edges.values()); + } + + @Override + public List getEdges(Vertex vertex) { + return vertexEdgeCache.get(vertex); + } + + @Override + public List getEdges(String name) { + return edgeNameCache.get(name); + } + + @Override + public List getVertices() { + return new ArrayList<>(vertices.values()); + } + + @Override + public Vertex getVertex(String name) { + return getVertex(new Vertex(name)); + } + + @Override + public Vertex getVertex(Vertex vertex) { + return vertices.get(vertex); + } + + @Override + public String getDescription() { + return null; + } + + @Override + public List getElements() { + return elementCache; + } + + @Override + public List getElements(Element element) { + if (null == element) { + return new ArrayList(getStartVertices()); + } else if (element instanceof Vertex) { + Vertex vertex = (Vertex)element; + return new ArrayList(getEdges(vertex)); + } else { + Edge edge = (Edge)element; + return Arrays.asList(edge.getTargetVertex()); + } + } + + @Override + public List getConnectedComponent(Element element) { + return depthFirstSearch.getConnectedComponent(element); + } + + @Override + public Path getShortestPath(Element origin, Element destination) { + return aStar.getShortestPath(origin, destination); + } + + @Override + public int getShortestDistance(Element origin, Element destination) { + return floydWarshall.getShortestDistance(origin, destination); + } + + @Override + public int getMaximumDistance(Element destination) { + return floydWarshall.getMaximumDistance(destination); + } + + @Override + public List getStartVertices() { + return startVertices; + } + + @Override + public List getRequirements() { + return requirementCache; + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/StopCondition.java b/graphwalker-core/src/main/java/org/graphwalker/core/StopCondition.java new file mode 100644 index 00000000..9c53f8c0 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/StopCondition.java @@ -0,0 +1,45 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core; + +import org.graphwalker.core.machine.ExecutionContext; + +/** + * @author Nils Olsson + */ +public interface StopCondition { + + /** Constant FULFILLMENT_LEVEL=0.999999 */ + double FULFILLMENT_LEVEL = 0.999999; + /** Constant PERCENTAGE_SCALE=100 */ + int PERCENTAGE_SCALE = 100; + /** Constant SECOND_SCALE=1000 */ + int SECOND_SCALE = 1000; + + boolean isFulfilled(ExecutionContext context); + double getFulfilment(ExecutionContext context); + String getValue(); +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/AStar.java b/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/AStar.java new file mode 100644 index 00000000..a4c2d201 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/AStar.java @@ -0,0 +1,154 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.algorithm; + +import org.graphwalker.core.Model; +import org.graphwalker.core.model.Element; +import org.graphwalker.core.model.Path; + +import java.util.*; + +/** + * @author Nils Olsson + */ +public final class AStar implements Algorithm { + + private final Model model; + + public AStar(Model model) { + this.model = model; + } + + public Path getShortestPath(Element origin, Element destination) { + Map openSet = new HashMap<>(); + PriorityQueue queue = new PriorityQueue<>(10, new AStarNodeComparator()); + Map closeSet = new HashMap<>(); + AStarNode sourceNode = new AStarNode(origin, 0, model.getShortestDistance(origin, destination)); + openSet.put(origin, sourceNode); + queue.add(sourceNode); + AStarNode targetNode = null; + while(openSet.size() > 0) { + AStarNode node = queue.poll(); + openSet.remove(node.getElement()); + if(node.getElement().equals(destination)){ + targetNode = node; + break; + }else{ + closeSet.put(node.getElement(), node); + List neighbors = model.getElements(node.getElement()); + for (Element neighbor : neighbors) { + AStarNode visited = closeSet.get(neighbor); + if (visited == null) { + double g = node.getG() + model.getShortestDistance(node.getElement(), neighbor); + AStarNode neighborNode = openSet.get(neighbor); + if (null == neighborNode) { + neighborNode = new AStarNode(neighbor, g, model.getShortestDistance(neighbor, destination)); + neighborNode.setParent(node); + openSet.put(neighbor, neighborNode); + queue.add(neighborNode); + } else if (g < neighborNode.getG()) { + neighborNode.setParent(node); + neighborNode.setG(g); + neighborNode.setH(model.getShortestDistance(neighbor, destination)); + } + } + } + } + } + if (null != targetNode) { + List path = new ArrayList<>(); + path.add(targetNode.getElement()); + AStarNode node = targetNode.getParent(); + while(null != node) { + path.add(node.getElement()); + node = node.getParent(); + } + + Collections.reverse(path); + return new Path<>(path); + } + throw new NoPathFoundException(); + } + + private class AStarNode { + + private final Element element; + private AStarNode parent; + private double g; + private double h; + + AStarNode(Element element, double g, double h) { + this.element = element; + this.g = g; + this.h = h; + } + + private Element getElement() { + return element; + } + + private AStarNode getParent() { + return parent; + } + + private void setParent(AStarNode parent) { + this.parent = parent; + } + + private double getG() { + return g; + } + + private void setG(double g) { + this.g = g; + } + + private double getH() { + return h; + } + + private void setH(double h) { + this.h = h; + } + + public double getF() { + return g+h; + } + } + + private class AStarNodeComparator implements Comparator { + + public int compare(AStarNode first, AStarNode second) { + if (first.getF() < second.getF()){ + return -1; + } else if(first.getF() > second.getF()) { + return 1; + } else { + return 0; + } + } + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/Algorithm.java b/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/Algorithm.java new file mode 100644 index 00000000..29ab565d --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/Algorithm.java @@ -0,0 +1,32 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.algorithm; + +/** + * @author Nils Olsson + */ +public interface Algorithm { +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/DepthFirstSearch.java b/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/DepthFirstSearch.java new file mode 100644 index 00000000..da18112a --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/DepthFirstSearch.java @@ -0,0 +1,90 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.algorithm; + +import org.graphwalker.core.Model; +import org.graphwalker.core.model.Edge; +import org.graphwalker.core.model.Element; +import org.graphwalker.core.model.Vertex; + +import java.util.*; + +/** + * @author Nils Olsson + */ +public final class DepthFirstSearch implements Algorithm { + + private final Model model; + + public DepthFirstSearch(Model model) { + this.model = model; + } + + public List getConnectedComponent(Element root) { + return createConnectedComponent(createElementStatusMap(model.getElements()), root); + } + + private Map createElementStatusMap(List elements) { + Map elementStatusMap = new HashMap<>(); + for (Element element: elements) { + elementStatusMap.put(element, ElementStatus.UNREACHABLE); + if (element instanceof Edge) { + Edge edge = (Edge)element; + if (edge.isBlocked()) { + elementStatusMap.put(element, ElementStatus.BLOCKED); + } + } + } + return elementStatusMap; + } + + private List createConnectedComponent(Map elementStatusMap, Element root) { + List connectedComponent = new ArrayList<>(); + Deque stack = new ArrayDeque<>(); + stack.push(root); + while (!stack.isEmpty()) { + Element element = stack.pop(); + if (ElementStatus.UNREACHABLE.equals(elementStatusMap.get(element))) { + connectedComponent.add(element); + elementStatusMap.put(element, ElementStatus.REACHABLE); + if (element instanceof Vertex) { + Vertex vertex = (Vertex)element; + for (Edge edge: model.getEdges(vertex)) { + stack.push(edge); + } + } else if (element instanceof Edge) { + Edge edge = (Edge)element; + stack.push(edge.getTargetVertex()); + } + } + } + return Collections.unmodifiableList(connectedComponent); + } + + private enum ElementStatus { + UNREACHABLE, REACHABLE, BLOCKED + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/Eulerian.java b/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/Eulerian.java new file mode 100644 index 00000000..d4e929e8 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/Eulerian.java @@ -0,0 +1,120 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.algorithm; + +import org.graphwalker.core.Model; +import org.graphwalker.core.model.Edge; +import org.graphwalker.core.model.Element; +import org.graphwalker.core.model.Path; +import org.graphwalker.core.model.Vertex; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +/** + * @author Nils Olsson + */ +public final class Eulerian implements Algorithm { + + private final Model model; + private final Map polarities; + + public Eulerian(Model model) { + this.model = model; + this.polarities = new HashMap<>(model.getVertices().size()); + polarize(); + } + + public enum EulerianType { + EULERIAN, SEMI_EULERIAN, NOT_EULERIAN + } + + private void polarize() { + for (Edge edge : model.getEdges()) { + getPolarityCounter(edge.getSourceVertex()).decrease(); + getPolarityCounter(edge.getTargetVertex()).increase(); + } + for (Vertex vertex : model.getVertices()) { + if (!polarities.get(vertex).hasPolarity()) { + polarities.remove(vertex); + } + } + } + + private PolarityCounter getPolarityCounter(Vertex vertex) { + if (!polarities.containsKey(vertex)) { + polarities.put(vertex, new PolarityCounter()); + } + return polarities.get(vertex); + } + + public EulerianType getEulerianType() { + if (polarities.isEmpty()) { + return EulerianType.EULERIAN; + } + if (2 == polarities.size()) { + return EulerianType.SEMI_EULERIAN; + } + return EulerianType.NOT_EULERIAN; + } + + public Model eulerize() { + switch (getEulerianType()) { + case EULERIAN: + break; // missing start edge + case NOT_EULERIAN: + break; // TODO: + } + return model; // SEMI_EULERIAN; + } + + public Path getEulerPath() { + // TODO: + return new Path<>(new ArrayList()); + } + + class PolarityCounter { + + private int polarity = 0; + + public void increase() { + polarity += 1; + } + + public void decrease() { + polarity -= 1; + } + + public boolean hasPolarity() { + return 0 != polarity; + } + + public int getPolarity() { + return polarity; + } + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/FloydWarshall.java b/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/FloydWarshall.java new file mode 100644 index 00000000..149d6906 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/FloydWarshall.java @@ -0,0 +1,105 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.algorithm; + +import org.graphwalker.core.Model; +import org.graphwalker.core.model.Edge; +import org.graphwalker.core.model.Element; +import org.graphwalker.core.model.Vertex; + +import java.util.Arrays; +import java.util.List; + +/** + * @author Nils Olsson + */ +public final class FloydWarshall implements Algorithm { + + private final Model model; + private final int[][] distances; + private final Element[][] predecessors; + + public FloydWarshall(Model model) { + this.model = model; + this.distances = createDistanceMatrix(model, model.getElements()); + this.predecessors = createPredecessorMatrix(model.getElements(), distances); + } + + private int[][] createDistanceMatrix(Model model, List elements) { + int[][] distances = new int[elements.size()][elements.size()]; + for (int[] row : distances) { + Arrays.fill(row, Integer.MAX_VALUE); + } + for (Element element: elements) { + if (element instanceof Edge) { + Edge edge = (Edge) element; + Vertex target = edge.getTargetVertex(); + distances[elements.indexOf(edge)][elements.indexOf(target)] = (int) Math.ceil(edge.getWeight()); + } else if (element instanceof Vertex) { + Vertex vertex = (Vertex) element; + for (Edge edge : model.getEdges(vertex)) { + if (!edge.isBlocked()) { + distances[elements.indexOf(vertex)][elements.indexOf(edge)] = 1; + } + } + } + } + return distances; + } + + private Element[][] createPredecessorMatrix(List elements, int[][] distances) { + Element[][] predecessors = new Element[elements.size()][elements.size()]; + int size = elements.size(); + for (int k = 0; k < size; k++) { + for (int i = 0; i < size; i++) { + for (int j = 0; j < size; j++) { + if (distances[i][k] != Integer.MAX_VALUE + && distances[k][j] != Integer.MAX_VALUE + && distances[i][k] + distances[k][j] < distances[i][j]) { + distances[i][j] = distances[i][k] + distances[k][j]; + predecessors[i][j] = elements.get(k); + } + } + } + } + return predecessors; + } + + public int getShortestDistance(Element origin, Element destination) { + return distances[model.getElements().indexOf(origin)][model.getElements().indexOf(destination)]; + } + + public int getMaximumDistance(Element destination) { + int maximumDistance = Integer.MIN_VALUE; + for (int[] distance : distances) { + int value = distance[model.getElements().indexOf(destination)]; + if (value != Integer.MAX_VALUE && value > maximumDistance) { + maximumDistance = value; + } + } + return maximumDistance; + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/NoPathFoundException.java b/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/NoPathFoundException.java new file mode 100644 index 00000000..67ba4084 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/NoPathFoundException.java @@ -0,0 +1,32 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.algorithm; + +/** + * @author Nils Olsson + */ +public class NoPathFoundException extends RuntimeException { +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/annotation/AfterElement.java b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/AfterElement.java new file mode 100755 index 00000000..a80c0a95 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/AfterElement.java @@ -0,0 +1,46 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2012 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.annotation; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author Nils Olsson + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(java.lang.annotation.ElementType.METHOD) +public @interface AfterElement { + + /** + *

script.

+ * + * @return a {@link java.lang.String} object. + */ + String filter() default ""; + +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/annotation/AfterExecution.java b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/AfterExecution.java new file mode 100755 index 00000000..fdd92d6f --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/AfterExecution.java @@ -0,0 +1,38 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2012 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.annotation; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author Nils Olsson + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(java.lang.annotation.ElementType.METHOD) +public @interface AfterExecution { +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/annotation/BeforeElement.java b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/BeforeElement.java new file mode 100755 index 00000000..70b2b7ee --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/BeforeElement.java @@ -0,0 +1,46 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2012 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.annotation; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author Nils Olsson + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(java.lang.annotation.ElementType.METHOD) +public @interface BeforeElement { + + /** + *

script.

+ * + * @return a {@link java.lang.String} object. + */ + String filter() default ""; + +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/annotation/BeforeExecution.java b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/BeforeExecution.java new file mode 100755 index 00000000..6f5bfe95 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/BeforeExecution.java @@ -0,0 +1,38 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2012 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.annotation; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author Nils Olsson + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(java.lang.annotation.ElementType.METHOD) +public @interface BeforeExecution { +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/annotation/Edge.java b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/Edge.java new file mode 100644 index 00000000..e218f296 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/Edge.java @@ -0,0 +1,44 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.annotation; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author Nils Olsson + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(java.lang.annotation.ElementType.METHOD) +public @interface Edge { + + String source() default ""; + + String target() default ""; + + String guard() default "true"; +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/annotation/ExceptionHandler.java b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/ExceptionHandler.java new file mode 100644 index 00000000..3d06c7c2 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/ExceptionHandler.java @@ -0,0 +1,38 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.annotation; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author Nils Olsson + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(java.lang.annotation.ElementType.METHOD) +public @interface ExceptionHandler { +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/annotation/Execute.java b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/Execute.java new file mode 100644 index 00000000..119677e5 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/Execute.java @@ -0,0 +1,79 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.annotation; + +import org.graphwalker.core.PathGenerator; +import org.graphwalker.core.StopCondition; +import org.graphwalker.core.condition.EdgeCoverage; +import org.graphwalker.core.generator.RandomPath; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author Nils Olsson + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface Execute { + + /** + *

group.

+ * + * @return a {@link java.lang.String} object. + */ + String group() default "default"; + + /** + *

pathGenerator.

+ * + * @return a {@link java.lang.Class} object. + */ + Class pathGenerator() default RandomPath.class; + + /** + *

stopCondition.

+ * + * @return a {@link java.lang.Class} object. + */ + Class stopCondition() default EdgeCoverage.class; + + /** + *

stopConditionValue.

+ * + * @return a {@link java.lang.String} object. + */ + String stopConditionValue() default "100"; + + /** + *

language.

+ * + * @return a {@link java.lang.String} object. + */ + String language() default "JavaScript"; +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/annotation/GraphWalker.java b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/GraphWalker.java new file mode 100755 index 00000000..5eb0ce02 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/GraphWalker.java @@ -0,0 +1,41 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2012 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author Nils Olsson + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface GraphWalker { + + Execute[] value() default {}; +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/annotation/Model.java b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/Model.java new file mode 100644 index 00000000..81a8375b --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/Model.java @@ -0,0 +1,47 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author Nils Olsson + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface Model { + + /** + *

file.

+ * + * @return a {@link java.lang.String} object. + */ + String file(); + +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/annotation/Vertex.java b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/Vertex.java new file mode 100644 index 00000000..109e155d --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/annotation/Vertex.java @@ -0,0 +1,40 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.annotation; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author Nils Olsson + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(java.lang.annotation.ElementType.METHOD) +public @interface Vertex { + + boolean start() default false; +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/common/Assert.java b/graphwalker-core/src/main/java/org/graphwalker/core/common/Assert.java new file mode 100644 index 00000000..e064ed02 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/common/Assert.java @@ -0,0 +1,975 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.common; + +import java.lang.reflect.Array; +import java.util.*; + +/** + * Repacked from testng 6.8.8 + * + * Assertion tool class. Presents assertion methods with a more natural parameter order. + * The order is always actualValue, expectedValue [, message]. + * + * @author Alexandru Popescu + */ +public class Assert { + + public static final Character OPENING_CHARACTER = '['; + public static final Character CLOSING_CHARACTER = ']'; + + public static final String ASSERT_LEFT = "expected " + OPENING_CHARACTER; + public static final String ASSERT_LEFT2 = "expected not same " + OPENING_CHARACTER; + public static final String ASSERT_MIDDLE = CLOSING_CHARACTER + " but found " + OPENING_CHARACTER; + public static final String ASSERT_RIGHT = Character.toString(CLOSING_CHARACTER); + + protected Assert() { + // hide constructor + } + + /** + * Asserts that a condition is true. If it isn't, + * an AssertionError, with the given message, is thrown. + * @param condition the condition to evaluate + * @param message the assertion error message + */ + public static void assertTrue(boolean condition, String message) { + if(!condition) { + failNotEquals(condition, Boolean.TRUE, message); + } + } + + /** + * Asserts that a condition is true. If it isn't, + * an AssertionError is thrown. + * @param condition the condition to evaluate + */ + public static void assertTrue(boolean condition) { + assertTrue(condition, null); + } + + /** + * Asserts that a condition is false. If it isn't, + * an AssertionError, with the given message, is thrown. + * @param condition the condition to evaluate + * @param message the assertion error message + */ + public static void assertFalse(boolean condition, String message) { + if(condition) { + failNotEquals(condition, Boolean.FALSE, message); // TESTNG-81 + } + } + + /** + * Asserts that a condition is false. If it isn't, + * an AssertionError is thrown. + * @param condition the condition to evaluate + */ + public static void assertFalse(boolean condition) { + assertFalse(condition, null); + } + + /** + * Fails a test with the given message and wrapping the original exception. + * + * @param message the assertion error message + * @param realCause the original exception + */ + public static void fail(String message, Throwable realCause) { + AssertionError ae = new AssertionError(message); + ae.initCause(realCause); + + throw ae; + } + + /** + * Fails a test with the given message. + * @param message the assertion error message + */ + public static void fail(String message) { + throw new AssertionError(message); + } + + /** + * Fails a test with no message. + */ + public static void fail() { + fail(null); + } + + /** + * Asserts that two objects are equal. If they are not, + * an AssertionError, with the given message, is thrown. + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertEquals(Object actual, Object expected, String message) { + assertObjectEquals(actual, expected, message); + } + + private static void assertObjectEquals(Object actual, Object expected, String message) { + if((expected == null) && (actual == null)) { + return; + } + if(expected != null) { + if (expected.getClass().isArray()) { + assertArrayEquals(actual, expected, message); + return; + } else if (expected.equals(actual)) { + return; + } + } + failNotEquals(actual, expected, message); + } + + /** + * Asserts that two objects are equal. It they are not, an AssertionError, + * with given message, is thrown. + * @param actual the actual value + * @param expected the expected value (should be an non-null array value) + * @param message the assertion error message + */ + private static void assertArrayEquals(Object actual, Object expected, String message) { + //is called only when expected is an array + if (actual.getClass().isArray()) { + int expectedLength = Array.getLength(expected); + if (expectedLength == Array.getLength(actual)) { + for (int i = 0 ; i < expectedLength ; i++) { + Object _actual = Array.get(actual, i); + Object _expected = Array.get(expected, i); + try { + assertEquals(_actual, _expected); + } catch (AssertionError ae) { + failNotEquals(actual, expected, message == null ? "" : message + + " (values at index " + i + " are not the same)"); + } + } + //array values matched + return; + } else { + failNotEquals(Array.getLength(actual), expectedLength, message == null ? "" : message + + " (Array lengths are not the same)"); + } + } + failNotEquals(actual, expected, message); + } + + /** + * Asserts that two objects are equal. If they are not, + * an AssertionError is thrown. + * @param actual the actual value + * @param expected the expected value + */ + public static void assertEquals(Object actual, Object expected) { + assertEquals(actual, expected, null); + } + + /** + * Asserts that two Strings are equal. If they are not, + * an AssertionError, with the given message, is thrown. + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertEquals(String actual, String expected, String message) { + assertObjectEquals(actual, expected, message); + } + + /** + * Asserts that two Strings are equal. If they are not, + * an AssertionError is thrown. + * @param actual the actual value + * @param expected the expected value + */ + public static void assertEquals(String actual, String expected) { + assertEquals(actual, expected, null); + } + + /** + * Asserts that two doubles are equal concerning a delta. If they are not, + * an AssertionError, with the given message, is thrown. If the expected + * value is infinity then the delta value is ignored. + * @param actual the actual value + * @param expected the expected value + * @param delta the absolute tolerable difference between the actual and expected values + * @param message the assertion error message + */ + public static void assertEquals(double actual, double expected, double delta, String message) { + // handle infinity specially since subtracting to infinite values gives NaN and the + // the following test fails + if(Double.isInfinite(expected)) { + if(!(expected == actual)) { + failNotEquals(actual, expected, message); + } + } + else if(!(Math.abs(expected - actual) <= delta)) { // Because comparison with NaN always returns false + failNotEquals(actual, expected, message); + } + } + + /** + * Asserts that two doubles are equal concerning a delta. If they are not, + * an AssertionError is thrown. If the expected value is infinity then the + * delta value is ignored. + * @param actual the actual value + * @param expected the expected value + * @param delta the absolute tolerable difference between the actual and expected values + */ + public static void assertEquals(double actual, double expected, double delta) { + assertEquals(actual, expected, delta, null); + } + + /** + * Asserts that two floats are equal concerning a delta. If they are not, + * an AssertionError, with the given message, is thrown. If the expected + * value is infinity then the delta value is ignored. + * @param actual the actual value + * @param expected the expected value + * @param delta the absolute tolerable difference between the actual and expected values + * @param message the assertion error message + */ + public static void assertEquals(float actual, float expected, float delta, String message) { + // handle infinity specially since subtracting to infinite values gives NaN and the + // the following test fails + if(Float.isInfinite(expected)) { + if(!(expected == actual)) { + failNotEquals(actual, expected, message); + } + } + else if(!(Math.abs(expected - actual) <= delta)) { + failNotEquals(actual, expected, message); + } + } + + /** + * Asserts that two floats are equal concerning a delta. If they are not, + * an AssertionError is thrown. If the expected + * value is infinity then the delta value is ignored. + * @param actual the actual value + * @param expected the expected value + * @param delta the absolute tolerable difference between the actual and expected values + */ + public static void assertEquals(float actual, float expected, float delta) { + assertEquals(actual, expected, delta, null); + } + + /** + * Asserts that two longs are equal. If they are not, + * an AssertionError, with the given message, is thrown. + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertEquals(long actual, long expected, String message) { + assertEquals(Long.valueOf(actual), Long.valueOf(expected), message); + } + + /** + * Asserts that two longs are equal. If they are not, + * an AssertionError is thrown. + * @param actual the actual value + * @param expected the expected value + */ + public static void assertEquals(long actual, long expected) { + assertEquals(actual, expected, null); + } + + /** + * Asserts that two booleans are equal. If they are not, + * an AssertionError, with the given message, is thrown. + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertEquals(boolean actual, boolean expected, String message) { + assertEquals( Boolean.valueOf(actual), Boolean.valueOf(expected), message); + } + + /** + * Asserts that two booleans are equal. If they are not, + * an AssertionError is thrown. + * @param actual the actual value + * @param expected the expected value + */ + public static void assertEquals(boolean actual, boolean expected) { + assertEquals(actual, expected, null); + } + + /** + * Asserts that two bytes are equal. If they are not, + * an AssertionError, with the given message, is thrown. + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertEquals(byte actual, byte expected, String message) { + assertEquals(Byte.valueOf(actual), Byte.valueOf(expected), message); + } + + /** + * Asserts that two bytes are equal. If they are not, + * an AssertionError is thrown. + * @param actual the actual value + * @param expected the expected value + */ + public static void assertEquals(byte actual, byte expected) { + assertEquals(actual, expected, null); + } + + /** + * Asserts that two chars are equal. If they are not, + * an AssertionFailedError, with the given message, is thrown. + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertEquals(char actual, char expected, String message) { + assertEquals(Character.valueOf(actual), Character.valueOf(expected), message); + } + + /** + * Asserts that two chars are equal. If they are not, + * an AssertionError is thrown. + * @param actual the actual value + * @param expected the expected value + */ + public static void assertEquals(char actual, char expected) { + assertEquals(actual, expected, null); + } + + /** + * Asserts that two shorts are equal. If they are not, + * an AssertionFailedError, with the given message, is thrown. + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertEquals(short actual, short expected, String message) { + assertEquals(Short.valueOf(actual), Short.valueOf(expected), message); + } + + /** + * Asserts that two shorts are equal. If they are not, + * an AssertionError is thrown. + * @param actual the actual value + * @param expected the expected value + */ + public static void assertEquals(short actual, short expected) { + assertEquals(actual, expected, null); + } + + /** + * Asserts that two integers are equal. If they are not, + * an AssertionFailedError, with the given message, is thrown. + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertEquals(int actual, int expected, String message) { + assertEquals(Integer.valueOf(actual), Integer.valueOf(expected), message); + } + + /** + * Asserts that two integers are equal. If they are not, + * an AssertionError is thrown. + * @param actual the actual value + * @param expected the expected value + */ + public static void assertEquals(int actual, int expected) { + assertEquals(actual, expected, null); + } + + /** + * Asserts that an object isn't null. If it is, + * an AssertionError is thrown. + * @param object the assertion object + */ + public static void assertNotNull(Object object) { + assertNotNull(object, null); + } + + /** + * Asserts that an object isn't null. If it is, + * an AssertionFailedError, with the given message, is thrown. + * @param object the assertion object + * @param message the assertion error message + */ + public static void assertNotNull(Object object, String message) { + if (object == null) { + String formatted = ""; + if(message != null) { + formatted = message + " "; + } + fail(formatted + "expected object to not be null"); + } + assertTrue(object != null, message); + } + + /** + * Asserts that an object is null. If it is not, + * an AssertionError, with the given message, is thrown. + * @param object the assertion object + */ + public static void assertNull(Object object) { + assertNull(object, null); + } + + /** + * Asserts that an object is null. If it is not, + * an AssertionFailedError, with the given message, is thrown. + * @param object the assertion object + * @param message the assertion error message + */ + public static void assertNull(Object object, String message) { + if (object != null) { + failNotSame(object, null, message); + } + } + + /** + * Asserts that two objects refer to the same object. If they do not, + * an AssertionFailedError, with the given message, is thrown. + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertSame(Object actual, Object expected, String message) { + if(expected == actual) { + return; + } + failNotSame(actual, expected, message); + } + + /** + * Asserts that two objects refer to the same object. If they do not, + * an AssertionError is thrown. + * @param actual the actual value + * @param expected the expected value + */ + public static void assertSame(Object actual, Object expected) { + assertSame(actual, expected, null); + } + + /** + * Asserts that two objects do not refer to the same objects. If they do, + * an AssertionError, with the given message, is thrown. + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertNotSame(Object actual, Object expected, String message) { + if(expected == actual) { + failSame(actual, expected, message); + } + } + + /** + * Asserts that two objects do not refer to the same object. If they do, + * an AssertionError is thrown. + * @param actual the actual value + * @param expected the expected value + */ + public static void assertNotSame(Object actual, Object expected) { + assertNotSame(actual, expected, null); + } + + private static void failSame(Object actual, Object expected, String message) { + String formatted = ""; + if(message != null) { + formatted = message + " "; + } + fail(formatted + ASSERT_LEFT2 + expected + ASSERT_MIDDLE + actual + ASSERT_RIGHT); + } + + private static void failNotSame(Object actual, Object expected, String message) { + String formatted = ""; + if(message != null) { + formatted = message + " "; + } + fail(formatted + ASSERT_LEFT + expected + ASSERT_MIDDLE + actual + ASSERT_RIGHT); + } + + private static void failNotEquals(Object actual, Object expected, String message) { + fail(format(actual, expected, message)); + } + + static String format(Object actual, Object expected, String message) { + String formatted = ""; + if (null != message) { + formatted = message + " "; + } + + return formatted + ASSERT_LEFT + expected + ASSERT_MIDDLE + actual + ASSERT_RIGHT; + } + + /** + * Asserts that two collections contain the same elements in the same order. If they do not, + * an AssertionError is thrown. + * + * @param actual the actual value + * @param expected the expected value + */ + public static void assertEquals(Collection actual, Collection expected) { + assertEquals(actual, expected, null); + } + + /** + * Asserts that two collections contain the same elements in the same order. If they do not, + * an AssertionError, with the given message, is thrown. + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertEquals(Collection actual, Collection expected, String message) { + if(actual == expected) { + return; + } + + if (actual == null || expected == null) { + if (message != null) { + fail(message); + } else { + fail("Collections not equal: expected: " + expected + " and actual: " + actual); + } + } + + assertEquals(actual.size(), expected.size(), message + ": lists don't have the same size"); + + Iterator actIt = actual.iterator(); + Iterator expIt = expected.iterator(); + int i = -1; + while(actIt.hasNext() && expIt.hasNext()) { + i++; + Object e = expIt.next(); + Object a = actIt.next(); + String explanation = "Lists differ at element [" + i + "]: " + e + " != " + a; + String errorMessage = message == null ? explanation : message + ": " + explanation; + + assertEquals(a, e, errorMessage); + } + } + + /** Asserts that two iterators return the same elements in the same order. If they do not, + * an AssertionError is thrown. + * Please note that this assert iterates over the elements and modifies the state of the iterators. + * @param actual the actual value + * @param expected the expected value + */ + public static void assertEquals(Iterator actual, Iterator expected) { + assertEquals(actual, expected, null); + } + + /** Asserts that two iterators return the same elements in the same order. If they do not, + * an AssertionError, with the given message, is thrown. + * Please note that this assert iterates over the elements and modifies the state of the iterators. + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertEquals(Iterator actual, Iterator expected, String message) { + if(actual == expected) { + return; + } + + if(actual == null || expected == null) { + if(message != null) { + fail(message); + } else { + fail("Iterators not equal: expected: " + expected + " and actual: " + actual); + } + } + + int i = -1; + while(actual.hasNext() && expected.hasNext()) { + + i++; + Object e = expected.next(); + Object a = actual.next(); + String explanation = "Iterators differ at element [" + i + "]: " + e + " != " + a; + String errorMessage = message == null ? explanation : message + ": " + explanation; + + assertEquals(a, e, errorMessage); + + } + + if(actual.hasNext()) { + + String explanation = "Actual iterator returned more elements than the expected iterator."; + String errorMessage = message == null ? explanation : message + ": " + explanation; + fail(errorMessage); + + } else if(expected.hasNext()) { + + String explanation = "Expected iterator returned more elements than the actual iterator."; + String errorMessage = message == null ? explanation : message + ": " + explanation; + fail(errorMessage); + + } + + } + + /** Asserts that two iterables return iterators with the same elements in the same order. If they do not, + * an AssertionError is thrown. + * @param actual the actual value + * @param expected the expected value + */ + public static void assertEquals(Iterable actual, Iterable expected) { + assertEquals(actual, expected, null); + } + + /** Asserts that two iterables return iterators with the same elements in the same order. If they do not, + * an AssertionError, with the given message, is thrown. + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertEquals(Iterable actual, Iterable expected, String message) { + if(actual == expected) { + return; + } + + if(actual == null || expected == null) { + if(message != null) { + fail(message); + } else { + fail("Iterables not equal: expected: " + expected + " and actual: " + actual); + } + } + + Iterator actIt = actual.iterator(); + Iterator expIt = expected.iterator(); + + assertEquals(actIt, expIt, message); + } + + + + + /** + * Asserts that two arrays contain the same elements in the same order. If they do not, + * an AssertionError, with the given message, is thrown. + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertEquals(Object[] actual, Object[] expected, String message) { + if(actual == expected) { + return; + } + + if ((actual == null && expected != null) || (actual != null && expected == null)) { + if (message != null) { + fail(message); + } else { + fail("Arrays not equal: " + Arrays.toString(expected) + " and " + Arrays.toString(actual)); + } + } + assertEquals(Arrays.asList(actual), Arrays.asList(expected), message); + } + + /** + * Asserts that two arrays contain the same elements in no particular order. If they do not, + * an AssertionError, with the given message, is thrown. + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertEqualsNoOrder(Object[] actual, Object[] expected, String message) { + if(actual == expected) { + return; + } + + if ((actual == null && expected != null) || (actual != null && expected == null)) { + failAssertNoEqual( + "Arrays not equal: " + Arrays.toString(expected) + " and " + Arrays.toString(actual), + message); + } + + if (actual.length != expected.length) { + failAssertNoEqual( + "Arrays do not have the same size:" + actual.length + " != " + expected.length, + message); + } + + List actualCollection = new ArrayList<>(); + Collections.addAll(actualCollection, actual); + for (Object o : expected) { + actualCollection.remove(o); + } + if (actualCollection.size() != 0) { + failAssertNoEqual( + "Arrays not equal: " + Arrays.toString(expected) + " and " + Arrays.toString(actual), + message); + } + } + + private static void failAssertNoEqual(String defaultMessage, String message) { + if (message != null) { + fail(message); + } else { + fail(defaultMessage); + } + } + + /** + * Asserts that two arrays contain the same elements in the same order. If they do not, + * an AssertionError is thrown. + * + * @param actual the actual value + * @param expected the expected value + */ + public static void assertEquals(Object[] actual, Object[] expected) { + assertEquals(actual, expected, null); + } + + /** + * Asserts that two arrays contain the same elements in no particular order. If they do not, + * an AssertionError is thrown. + * @param actual the actual value + * @param expected the expected value + */ + public static void assertEqualsNoOrder(Object[] actual, Object[] expected) { + assertEqualsNoOrder(actual, expected, null); + } + + /** + * Asserts that two arrays contain the same elements in the same order. If they do not, + * an AssertionError is thrown. + * + * @param actual the actual value + * @param expected the expected value + */ + public static void assertEquals(final byte[] actual, final byte[] expected) { + assertEquals(actual, expected, ""); + } + + /** + * Asserts that two arrays contain the same elements in the same order. If they do not, + * an AssertionError, with the given message, is thrown. + * + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertEquals(final byte[] actual, final byte[] expected, final String message) { + if(expected == actual) { + return; + } + if(null == expected) { + fail("expected a null array, but not null found. " + message); + } + if(null == actual) { + fail("expected not null array, but null found. " + message); + } + + assertEquals(actual.length, expected.length, "arrays don't have the same size. " + message); + + for(int i= 0; i < expected.length; i++) { + if(expected[i] != actual[i]) { + fail("arrays differ firstly at element [" + i +"]; " + + "expected value is <" + expected[i] +"> but was <" + + actual[i] + ">. " + + message); + } + } + } + + /** + * Asserts that two sets are equal. + */ + public static void assertEquals(Set actual, Set expected) { + assertEquals(actual, expected, null); + } + + /** + * Assert set equals + */ + public static void assertEquals(Set actual, Set expected, String message) { + if (actual == expected) { + return; + } + + if (actual == null || expected == null) { + // Keep the back compatible + if (message == null) { + fail("Sets not equal: expected: " + expected + " and actual: " + actual); + } else { + failNotEquals(actual, expected, message); + } + } + + if (!actual.equals(expected)) { + if (message == null) { + fail("Sets differ: expected " + expected + " but got " + actual); + } else { + failNotEquals(actual, expected, message); + } + } + } + + /** + * Asserts that two maps are equal. + */ + public static void assertEquals(Map actual, Map expected) { + if (actual == expected) { + return; + } + + if (actual == null || expected == null) { + fail("Maps not equal: expected: " + expected + " and actual: " + actual); + } + + if (actual.size() != expected.size()) { + fail("Maps do not have the same size:" + actual.size() + " != " + expected.size()); + } + + Set entrySet = actual.entrySet(); + for (Object anEntrySet : entrySet) { + Map.Entry entry = (Map.Entry) anEntrySet; + Object key = entry.getKey(); + Object value = entry.getValue(); + Object expectedValue = expected.get(key); + assertEquals(value, expectedValue, "Maps do not match for key:" + key + " actual:" + value + + " expected:" + expectedValue); + } + } + + ///// + // assertNotEquals + // + + public static void assertNotEquals(Object actual1, Object actual2, String message) { + assertObjectNotEquals(actual1, actual2, message); + } + + private static void assertObjectNotEquals(Object actual1, Object actual2, String message) { + boolean fail = false; + try { + Assert.assertEquals(actual1, actual2); + fail = true; + } catch (AssertionError e) { + // ignore + } + if (fail) { + Assert.fail(message); + } + } + + public static void assertNotEquals(Object actual1, Object actual2) { + assertNotEquals(actual1, actual2, null); + } + + public static void assertNotEquals(String actual1, String actual2, String message) { + assertObjectNotEquals(actual1, actual2, message); + } + + public static void assertNotEquals(String actual1, String actual2) { + assertNotEquals(actual1, actual2, null); + } + + public static void assertNotEquals(long actual1, long actual2, String message) { + assertNotEquals(Long.valueOf(actual1), Long.valueOf(actual2), message); + } + + public static void assertNotEquals(long actual1, long actual2) { + assertNotEquals(actual1, actual2, null); + } + + public static void assertNotEquals(boolean actual1, boolean actual2, String message) { + assertNotEquals(Boolean.valueOf(actual1), Boolean.valueOf(actual2), message); + } + + public static void assertNotEquals(boolean actual1, boolean actual2) { + assertNotEquals(actual1, actual2, null); + } + + public static void assertNotEquals(byte actual1, byte actual2, String message) { + assertNotEquals(Byte.valueOf(actual1), Byte.valueOf(actual2), message); + } + + public static void assertNotEquals(byte actual1, byte actual2) { + assertNotEquals(actual1, actual2, null); + } + + public static void assertNotEquals(char actual1, char actual2, String message) { + assertNotEquals(Character.valueOf(actual1), Character.valueOf(actual2), message); + } + + public static void assertNotEquals(char actual1, char actual2) { + assertNotEquals(actual1, actual2, null); + } + + public static void assertNotEquals(short actual1, short actual2, String message) { + assertNotEquals(Short.valueOf(actual1), Short.valueOf(actual2), message); + } + + public static void assertNotEquals(short actual1, short actual2) { + assertNotEquals(actual1, actual2, null); + } + + public static void assertNotEquals(int actual1, int actual2, String message) { + assertNotEquals(Integer.valueOf(actual1), Integer.valueOf(actual2), message); + } + + public static void assertNotEquals(int actual1, int actual2) { + assertNotEquals(actual1, actual2, null); + } + + public static void assertNotEquals(float actual1, float actual2, float delta, String message) { + boolean fail = false; + try { + Assert.assertEquals(actual1, actual2, delta, message); + fail = true; + } catch (AssertionError e) { + // ignore + } + if (fail) { + Assert.fail(message); + } + } + + public static void assertNotEquals(float actual1, float actual2, float delta) { + assertNotEquals(actual1, actual2, delta, null); + } + + public static void assertNotEquals(double actual1, double actual2, double delta, String message) { + boolean fail = false; + try { + Assert.assertEquals(actual1, actual2, delta, message); + fail = true; + } catch (AssertionError e) { + // ignore + } + if (fail) { + Assert.fail(message); + } + } + + public static void assertNotEquals(double actual1, double actual2, double delta) { + assertNotEquals(actual1, actual2, delta, null); + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/condition/AlternativeCondition.java b/graphwalker-core/src/main/java/org/graphwalker/core/condition/AlternativeCondition.java new file mode 100644 index 00000000..b28e0b46 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/condition/AlternativeCondition.java @@ -0,0 +1,77 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.condition; + +import org.graphwalker.core.StopCondition; +import org.graphwalker.core.machine.ExecutionContext; + +import java.util.Iterator; +import java.util.Vector; + +public class AlternativeCondition extends BaseStopCondition{ + + private Vector conditions = new Vector<>(); + + public void add(StopCondition condition) { + this.conditions.add(condition); + } + + public StopCondition getStopConditionAtIndex( int index) { + return conditions.elementAt(index); + } + + public boolean isFulfilled(ExecutionContext context) { + for (StopCondition condition : conditions) { + if (condition.isFulfilled(context)) { + return true; + } + } + return false; + } + + public double getFulfilment(ExecutionContext context) { + double fulfilment = 0; + for (StopCondition condition : conditions) { + double newFulfilment = condition.getFulfilment(context); + if (newFulfilment > fulfilment) { + fulfilment = newFulfilment; + } + } + return fulfilment; + } + + public String getValue() { + StringBuilder stringBuilder = new StringBuilder("("); + for (Iterator i = conditions.iterator(); i.hasNext();) { + stringBuilder.append(i.next().toString()); + if (i.hasNext()) { + stringBuilder.append(" OR "); + } + } + stringBuilder.append(")"); + return stringBuilder.toString(); + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/condition/BaseStopCondition.java b/graphwalker-core/src/main/java/org/graphwalker/core/condition/BaseStopCondition.java new file mode 100644 index 00000000..5f74e48c --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/condition/BaseStopCondition.java @@ -0,0 +1,52 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.condition; + +import org.apache.commons.lang3.Validate; +import org.graphwalker.core.StopCondition; + +/** + * @author Nils Olsson + */ +public abstract class BaseStopCondition implements StopCondition { + + private String value; + + public BaseStopCondition() { + } + + public BaseStopCondition(String value) { + this.value = Validate.notEmpty(Validate.notNull(value)); + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/condition/CombinationalCondition.java b/graphwalker-core/src/main/java/org/graphwalker/core/condition/CombinationalCondition.java new file mode 100644 index 00000000..d413c545 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/condition/CombinationalCondition.java @@ -0,0 +1,78 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.condition; + +import org.graphwalker.core.StopCondition; +import org.graphwalker.core.machine.ExecutionContext; + +import java.util.Iterator; +import java.util.Vector; + +public class CombinationalCondition extends BaseStopCondition{ + + private Vector conditions; + + public CombinationalCondition() { + this.conditions = new Vector<>(); + } + + public void add(StopCondition condition) { + this.conditions.add(condition); + } + + public StopCondition getStopConditionAtIndex( int index) { + return conditions.elementAt(index); + } + + public boolean isFulfilled(ExecutionContext context) { + for (StopCondition condition : conditions) { + if (!condition.isFulfilled(context)) { + return false; + } + } + return true; + } + + public double getFulfilment(ExecutionContext context) { + double fulfilment = 0; + for (StopCondition condition : conditions) { + fulfilment += condition.getFulfilment(context); + } + return fulfilment / conditions.size(); + } + + public String getValue() { + StringBuilder stringBuilder = new StringBuilder("("); + for (Iterator i = conditions.iterator(); i.hasNext();) { + stringBuilder.append(i.next().toString()); + if (i.hasNext()) { + stringBuilder.append(" AND "); + } + } + stringBuilder.append(")"); + return stringBuilder.toString(); + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/condition/EdgeCoverage.java b/graphwalker-core/src/main/java/org/graphwalker/core/condition/EdgeCoverage.java new file mode 100644 index 00000000..f5253222 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/condition/EdgeCoverage.java @@ -0,0 +1,58 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.condition; + +import org.apache.commons.lang3.Validate; +import org.graphwalker.core.machine.ExecutionContext; + +/** + * @author Nils Olsson + */ +public final class EdgeCoverage extends BaseStopCondition { + + private final double limit; + + public EdgeCoverage() { + this("100"); + } + + public EdgeCoverage(String value) { + super(value); + Validate.matchesPattern(value, "\\d+"); + this.limit = (double)Long.parseLong(value)/PERCENTAGE_SCALE; + Validate.inclusiveBetween(0.0, 1.0, limit); + } + + public boolean isFulfilled(ExecutionContext context) { + return getFulfilment(context) >= 1.0; + } + + public double getFulfilment(ExecutionContext context) { + double totalEdgesCount = context.getModel().getEdges().size(); + double visitedEdgesCount = context.getVisitedEdges().size(); + return (visitedEdgesCount / totalEdgesCount) / limit; + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/condition/Length.java b/graphwalker-core/src/main/java/org/graphwalker/core/condition/Length.java new file mode 100644 index 00000000..4478d9b6 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/condition/Length.java @@ -0,0 +1,51 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.condition; + +import org.apache.commons.lang3.Validate; +import org.graphwalker.core.machine.ExecutionContext; + +/** + * @author Nils Olsson + */ +public final class Length extends BaseStopCondition { + + private final long length; + + public Length(String value) { + super(value); + Validate.matchesPattern(value, "\\d+"); + this.length = Long.parseLong(value); + } + + public boolean isFulfilled(ExecutionContext context) { + return context.getVisitCount() >= length; + } + + public double getFulfilment(ExecutionContext context) { + return (double) context.getVisitCount() / length; + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/condition/Never.java b/graphwalker-core/src/main/java/org/graphwalker/core/condition/Never.java new file mode 100644 index 00000000..3394a7f3 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/condition/Never.java @@ -0,0 +1,51 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.condition; + +import org.graphwalker.core.StopCondition; +import org.graphwalker.core.machine.ExecutionContext; + +/** + * @author Nils Olsson + */ +public final class Never implements StopCondition { + + @Override + public String getValue() { + return null; + } + + @Override + public boolean isFulfilled(ExecutionContext context) { + return false; + } + + @Override + public double getFulfilment(ExecutionContext context) { + return 0; + } + +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/condition/ReachedEdge.java b/graphwalker-core/src/main/java/org/graphwalker/core/condition/ReachedEdge.java new file mode 100644 index 00000000..08049656 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/condition/ReachedEdge.java @@ -0,0 +1,67 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.condition; + +import org.graphwalker.core.Model; +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.model.Edge; + +/** + * @author Nils Olsson + */ +public final class ReachedEdge extends BaseStopCondition { + + public ReachedEdge() { + } + + public ReachedEdge(String value) { + super(value); + } + + public boolean isFulfilled(ExecutionContext context) { + return getFulfilment(context) >= FULFILLMENT_LEVEL; + } + + public double getFulfilment(ExecutionContext context) { + if (null == context.getCurrentElement()) { + return 0; + } else if (getValue().equals(context.getCurrentElement().getName())) { + return 1; + } else { + double maxFulfilment = 0; + Model model = context.getModel(); + for (Edge edge : model.getEdges(getValue())) { + int distance = model.getShortestDistance(context.getCurrentElement(), edge); + int max = model.getMaximumDistance(edge); + double fulfilment = 1 - (double) distance / max; + if (maxFulfilment < fulfilment) { + maxFulfilment = fulfilment; + } + } + return maxFulfilment; + } + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/condition/ReachedVertex.java b/graphwalker-core/src/main/java/org/graphwalker/core/condition/ReachedVertex.java new file mode 100644 index 00000000..a0a8456c --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/condition/ReachedVertex.java @@ -0,0 +1,61 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.condition; + +import org.graphwalker.core.Model; +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.model.Vertex; + +/** + * @author Nils Olsson + */ +public final class ReachedVertex extends BaseStopCondition { + + public ReachedVertex() { + } + + public ReachedVertex(String value) { + super(value); + } + + public boolean isFulfilled(ExecutionContext context) { + return getFulfilment(context) >= FULFILLMENT_LEVEL; + } + + public double getFulfilment(ExecutionContext context) { + if (null == context.getCurrentElement()) { + return 0; + } else if (getValue().equals(context.getCurrentElement().getName())) { + return 1; + } else { + Model model = context.getModel(); + Vertex vertex = model.getVertex(getValue()); + int distance = model.getShortestDistance(context.getCurrentElement(), vertex); + int max = model.getMaximumDistance(vertex); + return 1 - (double)distance/max; + } + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/condition/RequirementCoverage.java b/graphwalker-core/src/main/java/org/graphwalker/core/condition/RequirementCoverage.java new file mode 100644 index 00000000..b320f15b --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/condition/RequirementCoverage.java @@ -0,0 +1,69 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.condition; + +import org.apache.commons.lang3.Validate; +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.machine.RequirementStatus; + +/** + * @author Nils Olsson + */ +public final class RequirementCoverage extends BaseStopCondition { + + private final double limit; + + public RequirementCoverage() { + this("100"); + } + + public RequirementCoverage(String value) { + super(value); + Validate.matchesPattern(value, "\\d+(?:.\\d*)?"); + this.limit = (double)Long.parseLong(value)/ PERCENTAGE_SCALE; + Validate.inclusiveBetween(0.0, 100.0, limit); + } + + public boolean isFulfilled(ExecutionContext context) { + double totalCount = context.getModel().getRequirements().size(); + if (0 == totalCount) { + return true; + } + double passedCount = context.getRequirements(RequirementStatus.PASSED).size(); + double failedCount = context.getRequirements(RequirementStatus.FAILED).size(); + return ((passedCount+failedCount) / totalCount) >= limit; + } + + public double getFulfilment(ExecutionContext context) { + double totalCount = context.getModel().getRequirements().size(); + if (0 == totalCount) { + return 1.0; + } + double passedCount = context.getRequirements(RequirementStatus.PASSED).size(); + double failedCount = context.getRequirements(RequirementStatus.FAILED).size(); + return ((passedCount+failedCount) / totalCount) / limit; + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/condition/TimeDuration.java b/graphwalker-core/src/main/java/org/graphwalker/core/condition/TimeDuration.java new file mode 100644 index 00000000..16717096 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/condition/TimeDuration.java @@ -0,0 +1,60 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.condition; + +import org.graphwalker.core.machine.ExecutionContext; + +/** + * @author Nils Olsson + */ +public final class TimeDuration extends BaseStopCondition { + + private long duration; + private long timestamp; + + public TimeDuration() { + } + + public TimeDuration(String value) { + super(value); + this.timestamp = System.currentTimeMillis(); + this.duration = Long.parseLong(value) * SECOND_SCALE; + } + + public boolean isFulfilled(ExecutionContext context) { + return getFulfilment(context) >= FULFILLMENT_LEVEL; + } + + public double getFulfilment(ExecutionContext context) { + return (double) (System.currentTimeMillis() - timestamp) / duration; + } + + public void setValue( String value) { + super.setValue(value); + this.timestamp = System.currentTimeMillis(); + this.duration = Long.parseLong(value) * SECOND_SCALE; + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/condition/VertexCoverage.java b/graphwalker-core/src/main/java/org/graphwalker/core/condition/VertexCoverage.java new file mode 100644 index 00000000..9b1c73fc --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/condition/VertexCoverage.java @@ -0,0 +1,58 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.condition; + +import org.apache.commons.lang3.Validate; +import org.graphwalker.core.machine.ExecutionContext; + +/** + * @author Nils Olsson + */ +public final class VertexCoverage extends BaseStopCondition { + + private final double limit; + + public VertexCoverage() { + this("100"); + } + + public VertexCoverage(String value) { + super(value); + Validate.matchesPattern(value, "\\d+(?:.\\d*)?"); + this.limit = (double)Long.parseLong(value)/PERCENTAGE_SCALE; + Validate.inclusiveBetween(0.0, 100.0, limit); + } + + public boolean isFulfilled(ExecutionContext context) { + return getFulfilment(context) >= 1.0; + } + + public double getFulfilment(ExecutionContext context) { + double totalVertexCount = context.getModel().getVertices().size(); + double visitedVertexCount = context.getVisitedVertices().size(); + return (visitedVertexCount / totalVertexCount) / limit; + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/event/EventSink.java b/graphwalker-core/src/main/java/org/graphwalker/core/event/EventSink.java new file mode 100644 index 00000000..71ce5561 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/event/EventSink.java @@ -0,0 +1,32 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.event; + +/** + * @author Nils Olsson + */ +public interface EventSink { +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/event/EventSource.java b/graphwalker-core/src/main/java/org/graphwalker/core/event/EventSource.java new file mode 100644 index 00000000..f106baa2 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/event/EventSource.java @@ -0,0 +1,45 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.event; + +import java.util.HashSet; +import java.util.Set; + +/** + * @author Nils Olsson + */ +public class EventSource { + + private final Set sinks = new HashSet<>(); + + public void addSink(T sink) { + sinks.add(sink); + } + + public void removeSink(T sink) { + sinks.remove(sink); + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/event/MachineSink.java b/graphwalker-core/src/main/java/org/graphwalker/core/event/MachineSink.java new file mode 100644 index 00000000..fff7989c --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/event/MachineSink.java @@ -0,0 +1,32 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.event; + +/** + * @author Nils Olsson + */ +public interface MachineSink extends EventSink { +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/event/ModelSink.java b/graphwalker-core/src/main/java/org/graphwalker/core/event/ModelSink.java new file mode 100644 index 00000000..cc4d9c21 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/event/ModelSink.java @@ -0,0 +1,32 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.event; + +/** + * @author Nils Olsson + */ +public interface ModelSink extends EventSink { +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/generator/AStarPath.java b/graphwalker-core/src/main/java/org/graphwalker/core/generator/AStarPath.java new file mode 100644 index 00000000..35cd0296 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/generator/AStarPath.java @@ -0,0 +1,76 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.generator; + +import org.graphwalker.core.Model; +import org.graphwalker.core.StopCondition; +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.model.Edge; +import org.graphwalker.core.model.Element; +import org.graphwalker.core.model.Path; + +import java.util.List; + +/** + * @author Nils Olsson + */ +public final class AStarPath extends BasePathGenerator { + + public AStarPath() { + } + + public AStarPath(StopCondition stopCondition) { + super(stopCondition); + } + + public Element getNextStep(ExecutionContext context) { + List elements = context.getElements(context.getCurrentElement()); + if (elements.isEmpty()) { + throw new NoPathFoundException(); + } + if (null == context.getCurrentElement()) { + context.setCurrentElement(elements.get(0)); + } + Element target = null; + Model model = context.getModel(); + if (null != model.getEdges(getStopCondition().getValue())) { + int distance = Integer.MAX_VALUE; + for (Edge edge: model.getEdges(getStopCondition().getValue())) { + int edgeDistance = model.getShortestDistance(context.getCurrentElement(), edge); + if (edgeDistance < distance) { + distance = edgeDistance; + target = edge; + } + } + } + if (null != model.getVertex(getStopCondition().getValue())) { + target = model.getVertex(getStopCondition().getValue()); + } + Path path = model.getShortestPath(context.getCurrentElement(), target); + path.pollFirst(); + return context.setCurrentElement(path.getFirst()); + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/generator/BasePathGenerator.java b/graphwalker-core/src/main/java/org/graphwalker/core/generator/BasePathGenerator.java new file mode 100644 index 00000000..68a60c6c --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/generator/BasePathGenerator.java @@ -0,0 +1,58 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.generator; + +import org.apache.commons.lang3.Validate; +import org.graphwalker.core.PathGenerator; +import org.graphwalker.core.StopCondition; +import org.graphwalker.core.machine.ExecutionContext; + +/** + * @author Nils Olsson + */ +public abstract class BasePathGenerator implements PathGenerator { + + private StopCondition stopCondition; + + public BasePathGenerator() { + } + + public BasePathGenerator(StopCondition stopCondition) { + this.stopCondition = Validate.notNull(stopCondition); + } + + public Boolean hasNextStep(ExecutionContext context) { + return !stopCondition.isFulfilled(context); + } + + public StopCondition getStopCondition() { + return stopCondition; + } + + public void setStopCondition(StopCondition stopCondition) { + this.stopCondition = stopCondition; + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/generator/CombinedPathGenerator.java b/graphwalker-core/src/main/java/org/graphwalker/core/generator/CombinedPathGenerator.java new file mode 100644 index 00000000..4c1f0738 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/generator/CombinedPathGenerator.java @@ -0,0 +1,102 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.generator; + +import org.graphwalker.core.PathGenerator; +import org.graphwalker.core.StopCondition; +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.model.Element; + +import java.util.Vector; + + +public class CombinedPathGenerator extends BasePathGenerator { + private Vector generatorList = new Vector<>(); + StopCondition stopCondition = null; + private int currentGenerator = 0; + + public void addPathGenerator(PathGenerator generator) { + generatorList.add(generator); + } + + public PathGenerator getActivePathGenerator() { + return generatorList.get(currentGenerator); + } + + public PathGenerator getPathGeneratorAtIndex( int index) { + return generatorList.elementAt(index); + } + + private boolean hasPath() { + return generatorList.size() > currentGenerator; + } + + private void scrapActivePathGenerator() { + currentGenerator++; + } + + public Element getNextStep(ExecutionContext context) { + boolean nextIsAvailable = false; + + while (hasPath() && !nextIsAvailable) { + nextIsAvailable = getActivePathGenerator().hasNextStep(context); + if (!nextIsAvailable) scrapActivePathGenerator(); + } + + if (!nextIsAvailable) { + return null; + } + + return getActivePathGenerator().getNextStep(context); + } + + public Boolean hasNextStep(ExecutionContext context) { + boolean nextIsAvailable = false; + + while (hasPath() && !nextIsAvailable) { + nextIsAvailable = getActivePathGenerator().hasNextStep(context); + + if (!nextIsAvailable) { + scrapActivePathGenerator(); + } + } + + return nextIsAvailable; + } + + public StopCondition getStopCondition() { + return getActivePathGenerator().getStopCondition(); + } + + public String toString() { + StringBuilder stringBuilder = new StringBuilder(); + for (PathGenerator aGeneratorList : generatorList) { + stringBuilder.append(aGeneratorList.toString()); + stringBuilder.append(System.getProperty("line.separator")); + } + return stringBuilder.toString().trim(); + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/generator/NoPathFoundException.java b/graphwalker-core/src/main/java/org/graphwalker/core/generator/NoPathFoundException.java new file mode 100644 index 00000000..200616be --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/generator/NoPathFoundException.java @@ -0,0 +1,32 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.generator; + +/** + * @author Nils Olsson + */ +public class NoPathFoundException extends RuntimeException { +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/generator/RandomLeastVisitedPath.java b/graphwalker-core/src/main/java/org/graphwalker/core/generator/RandomLeastVisitedPath.java new file mode 100644 index 00000000..6ef74425 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/generator/RandomLeastVisitedPath.java @@ -0,0 +1,70 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.generator; + +import org.graphwalker.core.StopCondition; +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.model.Element; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +/** + * @author Nils Olsson + */ +public final class RandomLeastVisitedPath extends BasePathGenerator { + + private final Random random = new Random(System.nanoTime()); + + public RandomLeastVisitedPath(StopCondition stopCondition) { + super(stopCondition); + } + + public Element getNextStep(ExecutionContext context) { + List elements = context.getElements(context.getCurrentElement()); + if (elements.isEmpty()) { + throw new NoPathFoundException(); + } + long leastVisitedCount = Long.MAX_VALUE; + List leastVisitedElements = new ArrayList<>(); + for (Element element: elements) { + long visitCount = context.getVisitCount(element); + if (visitCount < leastVisitedCount) { + leastVisitedCount = visitCount; + leastVisitedElements = new ArrayList<>(); + leastVisitedElements.add(element); + } else if (visitCount == leastVisitedCount) { + leastVisitedElements.add(element); + } + } + if (0 < leastVisitedElements.size()) { + return context.setCurrentElement(leastVisitedElements.get(random.nextInt(leastVisitedElements.size()))); + } else { + return context.setCurrentElement(elements.get(random.nextInt(elements.size()))); + } + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/generator/RandomPath.java b/graphwalker-core/src/main/java/org/graphwalker/core/generator/RandomPath.java new file mode 100644 index 00000000..cd701efa --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/generator/RandomPath.java @@ -0,0 +1,56 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.generator; + +import org.graphwalker.core.StopCondition; +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.model.Element; + +import java.util.List; +import java.util.Random; + +/** + * @author Nils Olsson + */ +public final class RandomPath extends BasePathGenerator { + + private final Random random = new Random(System.nanoTime()); + + public RandomPath() { + } + + public RandomPath(StopCondition stopCondition) { + super(stopCondition); + } + + public Element getNextStep(ExecutionContext context) { + List elements = context.getElements(context.getCurrentElement()); + if (elements.isEmpty()) { + throw new NoPathFoundException(); + } + return context.setCurrentElement(elements.get(random.nextInt(elements.size()))); + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/generator/RandomUnvisitedFirstPath.java b/graphwalker-core/src/main/java/org/graphwalker/core/generator/RandomUnvisitedFirstPath.java new file mode 100644 index 00000000..e8a083b9 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/generator/RandomUnvisitedFirstPath.java @@ -0,0 +1,64 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.generator; + +import org.graphwalker.core.StopCondition; +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.model.Element; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +/** + * @author Nils Olsson + */ +public final class RandomUnvisitedFirstPath extends BasePathGenerator { + + private final Random random = new Random(System.nanoTime()); + + public RandomUnvisitedFirstPath(StopCondition stopCondition) { + super(stopCondition); + } + + public Element getNextStep(ExecutionContext context) { + List elements = context.getElements(context.getCurrentElement()); + if (elements.isEmpty()) { + throw new NoPathFoundException(); + } + List unvisitedElements = new ArrayList<>(); + for (Element element : elements) { + if (!context.isVisited(element)) { + unvisitedElements.add(element); + } + } + if (0 < unvisitedElements.size()) { + return context.setCurrentElement(unvisitedElements.get(random.nextInt(unvisitedElements.size()))); + } else { + return context.setCurrentElement(elements.get(random.nextInt(elements.size()))); + } + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/machine/ExecutionContext.java b/graphwalker-core/src/main/java/org/graphwalker/core/machine/ExecutionContext.java new file mode 100644 index 00000000..dd0867ec --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/machine/ExecutionContext.java @@ -0,0 +1,222 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.machine; + +import org.graphwalker.core.Model; +import org.graphwalker.core.PathGenerator; +import org.graphwalker.core.StopCondition; +import org.graphwalker.core.model.Edge; +import org.graphwalker.core.model.Element; +import org.graphwalker.core.model.Requirement; +import org.graphwalker.core.model.Vertex; +import org.graphwalker.core.script.ScriptContext; +import org.graphwalker.core.statistics.ExecutionProfiler; + +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +import javax.script.ScriptException; +import java.util.*; + +/** + * @author Nils Olsson + */ +public final class ExecutionContext { + + private final static String DEFAULT_SCRIPT_LANGUAGE = "JavaScript"; + + private final Model model; + private Element currentElement; + private final PathGenerator pathGenerator; + private final ScriptEngine scriptEngine; + private final ScriptContext context = new ScriptContext(); + private final ExecutionProfiler profiler = new ExecutionProfiler(); + private final Map requirementStatus; + private final Map elementVisitCount; + private Long totalVisitCount = 0l; + private Set visitedEdges = new HashSet<>(); + private Set visitedVertices = new HashSet<>(); + private ExecutionStatus executionStatus = ExecutionStatus.NOT_EXECUTED; + + public ExecutionContext(Model model, PathGenerator pathGenerator) { + this(model, pathGenerator, DEFAULT_SCRIPT_LANGUAGE); + } + + public ExecutionContext(Model model, PathGenerator pathGenerator, String language) { + this.model = model; + this.pathGenerator = pathGenerator; + this.scriptEngine = createScriptEngine(language); + this.requirementStatus = initializeRequirementStatus(); + this.elementVisitCount = initializeVisitCount(); + } + + private Map initializeRequirementStatus() { + Map requirementStatusMap = new HashMap<>(); + for (Requirement requirement: model.getRequirements()) { + requirementStatusMap.put(requirement, RequirementStatus.NOT_COVERED); + } + return requirementStatusMap; + } + + private Map initializeVisitCount() { + Map visitCountMap = new HashMap<>(); + for (Element element: model.getElements()) { + visitCountMap.put(element, 0l); + } + return visitCountMap; + } + + private ScriptEngine createScriptEngine(String language) { + ScriptEngineManager scriptEngineManager = new ScriptEngineManager(); + ScriptEngine scriptEngine = scriptEngineManager.getEngineByName(language); + scriptEngine.setContext(context); + return scriptEngine; + } + + public PathGenerator getPathGenerator() { + return pathGenerator; + } + + public StopCondition getStopCondition() { + return pathGenerator.getStopCondition(); + } + + public ScriptEngine getScriptEngine() { + return scriptEngine; + } + + public ScriptContext getScriptContext() { + return context; + } + + public ExecutionProfiler getProfiler() { + return profiler; + } + + public ExecutionStatus getExecutionStatus() { + return executionStatus; + } + + public void setExecutionStatus(ExecutionStatus executionStatus) { + this.executionStatus = executionStatus; + } + + public Model getModel() { + return model; + } + + public Element getCurrentElement() { + return currentElement; + } + + public Element setCurrentElement(Element element) { + if (null != element) { + visit(element); + } + return currentElement = element; + } + + public List getRequirements(RequirementStatus status) { + Set requirements = new HashSet<>(); + for (Requirement requirement: model.getRequirements()) { + if (requirementStatus.get(requirement).equals(status)) { + requirements.add(requirement); + } + } + return new ArrayList<>(requirements); + } + + public RequirementStatus getRequirementStatus(Requirement requirement) { + return requirementStatus.get(requirement); + } + + public void setRequirementStatus(Requirement requirement, RequirementStatus status) { + requirementStatus.put(requirement, status); + } + + public boolean isVisited(Element element) { + return 0 < getVisitCount(element); + } + + public Long getVisitCount(Element element) { + return elementVisitCount.get(element); + } + + public Long getVisitCount() { + return totalVisitCount; + } + + public List getVisitedEdges() { + return new ArrayList<>(visitedEdges); + } + + public List getVisitedVertices() { + return new ArrayList<>(visitedVertices); + } + + public void visit(Element element) { + this.totalVisitCount++; + this.elementVisitCount.put(element, getVisitCount(element)+1); + if (element instanceof Edge) { + visit((Edge)element); + } else { + visit((Vertex)element); + } + } + + private void visit(Edge edge) { + if (!visitedEdges.contains(edge)) { + visitedEdges.add(edge); + } + } + + private void visit(Vertex vertex) { + if (!visitedVertices.contains(vertex)) { + visitedVertices.add(vertex); + } + } + + public List getElements(Element element) { + List elements = new ArrayList<>(); + if (null == element) { + elements.addAll(getModel().getStartVertices()); + } else if (element instanceof Vertex) { + Vertex vertex = (Vertex)element; + for (Edge edge: getModel().getEdges(vertex)) { + try { + if (!edge.isBlocked() && edge.getGuard().isFulfilled(getScriptEngine())) { + elements.add(edge); + } + } catch (ScriptException e) { + e.printStackTrace(); + } + } + } else { + Edge edge = (Edge)element; + elements.add(edge.getTargetVertex()); + } + return elements; + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/machine/ExecutionStatus.java b/graphwalker-core/src/main/java/org/graphwalker/core/machine/ExecutionStatus.java new file mode 100644 index 00000000..2c3b2c89 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/machine/ExecutionStatus.java @@ -0,0 +1,33 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.machine; + +/** + * @author Nils Olsson + */ +public enum ExecutionStatus { + NOT_EXECUTED, EXECUTING, COMPLETED, FAILED +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/machine/RequirementStatus.java b/graphwalker-core/src/main/java/org/graphwalker/core/machine/RequirementStatus.java new file mode 100644 index 00000000..8440fe90 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/machine/RequirementStatus.java @@ -0,0 +1,33 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.machine; + +/** + * @author Nils Olsson + */ +public enum RequirementStatus { + NOT_COVERED, PASSED, FAILED +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/model/Action.java b/graphwalker-core/src/main/java/org/graphwalker/core/model/Action.java new file mode 100644 index 00000000..e5a60237 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/model/Action.java @@ -0,0 +1,43 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.model; + +import javax.script.ScriptEngine; +import javax.script.ScriptException; + +/** + * @author Nils Olsson + */ +public final class Action extends ScriptElement { + + public Action(String script) { + super(script); + } + + public void execute(ScriptEngine scriptEngine) throws ScriptException { + scriptEngine.eval(getScript()); + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/model/Edge.java b/graphwalker-core/src/main/java/org/graphwalker/core/model/Edge.java new file mode 100644 index 00000000..212a1ed3 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/model/Edge.java @@ -0,0 +1,153 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.model; + +import org.apache.commons.lang3.Validate; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +/** + * @author Nils Olsson + */ +public final class Edge implements Element { + + private final static Set NO_ACTIONS = Collections.unmodifiableSet(new HashSet()); + private final static Guard NO_GUARD = new Guard("true"); + + private final String name; + private final Vertex source; + private final Vertex target; + private final Boolean blocked; + private final Double weight; + private final Guard guard; + private final Set actions; + private final int cachedHashCode; + + public Edge(String name, Vertex source, Vertex target) { + this(name, source, target, NO_GUARD, NO_ACTIONS); + } + + public Edge(String name, Vertex source, Vertex target, Boolean blocked) { + this(name, source, target, NO_GUARD, NO_ACTIONS, blocked, 1.0); + } + + public Edge(String name, Vertex source, Vertex target, Boolean blocked, Double weight) { + this(name, source, target, NO_GUARD, NO_ACTIONS, blocked, weight); + } + + public Edge(String name, Vertex source, Vertex target, Set actions) { + this(name, source, target, NO_GUARD, actions, false); + } + + public Edge(String name, Vertex source, Vertex target, Guard guard) { + this(name, source, target, guard, NO_ACTIONS, false); + } + + public Edge(String name, Vertex source, Vertex target, Guard guard, Set actions) { + this(name, source, target, guard, actions, false); + } + + public Edge(String name, Vertex source, Vertex target, Guard guard, Set actions, Boolean blocked) { + this(name, source, target, guard, actions, blocked, 1.0); + } + + public Edge(String name, Vertex source, Vertex target, Guard guard, Set actions, Boolean blocked, Double weight) { + this.name = name; + this.source = Validate.notNull(source); + this.target = Validate.notNull(target); + this.guard = Validate.notNull(guard); + this.actions = Collections.unmodifiableSet(Validate.notNull(actions)); + this.blocked = Validate.notNull(blocked); + this.weight = Validate.notNull(weight); + this.cachedHashCode = new HashCodeBuilder(23, 47) + .appendSuper(super.hashCode()) + .append(source.hashCode()) + .append(target.hashCode()) + .append(actions) + .append(blocked) + .append(weight) + .toHashCode(); + } + + public String getName() { + return name; + } + + public Vertex getSourceVertex() { + return source; + } + + public Vertex getTargetVertex() { + return target; + } + + public Guard getGuard() { + return guard; + } + + public Set getActions() { + return actions; + } + + public Double getWeight() { + return weight; + } + + public Boolean isBlocked() { + return blocked; + } + + @Override + public int hashCode() { + return this.cachedHashCode; + } + + @Override + public boolean equals(Object object) { + if (null == object) { + return false; + } + if (this == object) { + return true; + } + if (object instanceof Edge) { + Edge edge = (Edge)object; + return new EqualsBuilder() + .append(name, edge.getName()) + .append(source, edge.getSourceVertex()) + .append(target, edge.getTargetVertex()) + .append(actions, edge.getActions()) + .append(blocked, edge.isBlocked()) + .append(weight, edge.getWeight()) + .isEquals(); + } + return false; + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/model/Element.java b/graphwalker-core/src/main/java/org/graphwalker/core/model/Element.java new file mode 100644 index 00000000..d5e4c7a9 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/model/Element.java @@ -0,0 +1,33 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.model; + +/** + * @author Nils Olsson + */ +public interface Element { + String getName(); +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/model/Guard.java b/graphwalker-core/src/main/java/org/graphwalker/core/model/Guard.java new file mode 100644 index 00000000..3c4fdd77 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/model/Guard.java @@ -0,0 +1,43 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.model; + +import javax.script.ScriptEngine; +import javax.script.ScriptException; + +/** + * @author Nils Olsson + */ +public final class Guard extends ScriptElement { + + public Guard(String script) { + super(script); + } + + public Boolean isFulfilled(ScriptEngine scriptEngine) throws ScriptException { + return (Boolean)scriptEngine.eval(getScript()); + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/model/Path.java b/graphwalker-core/src/main/java/org/graphwalker/core/model/Path.java new file mode 100644 index 00000000..5fa7b7da --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/model/Path.java @@ -0,0 +1,39 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.model; + +import java.util.ArrayDeque; +import java.util.Collection; + +/** + * @author Nils Olsson + */ +public final class Path extends ArrayDeque { + + public Path(Collection collection) { + super(collection); + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/model/Requirement.java b/graphwalker-core/src/main/java/org/graphwalker/core/model/Requirement.java new file mode 100644 index 00000000..e6153b4a --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/model/Requirement.java @@ -0,0 +1,68 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.model; + +import org.apache.commons.lang3.Validate; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +/** + * @author Nils Olsson + */ +public final class Requirement { + + private final String id; + private final int cachedHashCode; + + public Requirement(String id) { + this.id = Validate.notEmpty(Validate.notNull(id)); + this.cachedHashCode = new HashCodeBuilder(13, 29).append(id).hashCode(); + } + + public String getId() { + return id; + } + + @Override + public int hashCode() { + return cachedHashCode; + } + + @Override + public boolean equals(Object object) { + if (null == object) { + return false; + } + if (this == object) { + return true; + } + if (object instanceof Requirement) { + Requirement element = (Requirement)object; + return new EqualsBuilder().append(id, element.getId()).isEquals(); + } + return false; + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/model/ScriptElement.java b/graphwalker-core/src/main/java/org/graphwalker/core/model/ScriptElement.java new file mode 100644 index 00000000..0c63c673 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/model/ScriptElement.java @@ -0,0 +1,68 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.model; + +import org.apache.commons.lang3.Validate; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +/** + * @author Nils Olsson + */ +public abstract class ScriptElement { + + private final String script; + private final int cachedHashCode; + + public ScriptElement(String script) { + this.script = Validate.notEmpty(Validate.notNull(script)); + this.cachedHashCode = new HashCodeBuilder(29, 53).append(script).hashCode(); + } + + public String getScript() { + return script; + } + + @Override + public int hashCode() { + return cachedHashCode; + } + + @Override + public boolean equals(Object object) { + if (null == object) { + return false; + } + if (this == object) { + return true; + } + if (object instanceof ScriptElement) { + ScriptElement element = (ScriptElement)object; + return new EqualsBuilder().append(script, element.getScript()).isEquals(); + } + return false; + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/model/StartVertex.java b/graphwalker-core/src/main/java/org/graphwalker/core/model/StartVertex.java new file mode 100644 index 00000000..340d7613 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/model/StartVertex.java @@ -0,0 +1,48 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.model; + +public final class StartVertex extends Vertex { + + public StartVertex() { + super("Start"); + } + + @Override + public boolean equals(Object object) { + if (null == object) { + return false; + } + if (this == object) { + return true; + } + if (object instanceof StartVertex) { + StartVertex element = (StartVertex)object; + return true; + } + return false; + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/model/Vertex.java b/graphwalker-core/src/main/java/org/graphwalker/core/model/Vertex.java new file mode 100644 index 00000000..8c55d49e --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/model/Vertex.java @@ -0,0 +1,104 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.model; + +import org.apache.commons.lang3.Validate; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +/** + * @author Nils Olsson + */ +public class Vertex implements Element { + + private final String name; + private final Set requirements; + private final Set entryActions; + private final Set exitActions; + private final int cachedHashCode; + + public Vertex(String name) { + this(name, new HashSet()); + } + + public Vertex(String name, Set requirements) { + this(name, requirements, new HashSet()); + } + + public Vertex(String name, Set requirements, Set entryActions) { + this(name, requirements, entryActions, new HashSet()); + } + + public Vertex(String name, Set requirements, Set entryActions, Set exitActions) { + this.name = name; + this.requirements = Collections.unmodifiableSet(Validate.notNull(requirements)); + this.entryActions = Collections.unmodifiableSet(Validate.notNull(entryActions)); + this.exitActions = Collections.unmodifiableSet(Validate.notNull(exitActions)); + this.cachedHashCode = new HashCodeBuilder(17, 43) + .append(name) + .hashCode(); + } + + public String getName() { + return name; + } + + public Set getRequirements() { + return requirements; + } + + public Set getEntryActions() { + return entryActions; + } + + public Set getExitActions() { + return exitActions; + } + + @Override + public int hashCode() { + return cachedHashCode; + } + + @Override + public boolean equals(Object object) { + if (null == object) { + return false; + } + if (this == object) { + return true; + } + if (object instanceof Vertex) { + Vertex element = (Vertex)object; + return new EqualsBuilder().append(name, element.getName()).isEquals(); + } + return false; + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/script/ScriptContext.java b/graphwalker-core/src/main/java/org/graphwalker/core/script/ScriptContext.java new file mode 100644 index 00000000..3942db3b --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/script/ScriptContext.java @@ -0,0 +1,43 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.script; + +import javax.script.SimpleScriptContext; +import java.util.Map; + +/** + * @author Nils Olsson + */ +public final class ScriptContext extends SimpleScriptContext { + + public void setAttribute(String key, Object value) { + setAttribute(key, value, ENGINE_SCOPE); + } + + public Map getAttributes() { + return getBindings(ENGINE_SCOPE); + } +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/statistics/ExecutionProfiler.java b/graphwalker-core/src/main/java/org/graphwalker/core/statistics/ExecutionProfiler.java new file mode 100644 index 00000000..1297ba08 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/statistics/ExecutionProfiler.java @@ -0,0 +1,32 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.statistics; + +/** + * @author Nils Olsson + */ +public final class ExecutionProfiler { +} diff --git a/graphwalker-core/src/main/java/org/graphwalker/core/statistics/ExecutionTime.java b/graphwalker-core/src/main/java/org/graphwalker/core/statistics/ExecutionTime.java new file mode 100644 index 00000000..f580e7d9 --- /dev/null +++ b/graphwalker-core/src/main/java/org/graphwalker/core/statistics/ExecutionTime.java @@ -0,0 +1,32 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.statistics; + +/** + * @author Nils Olsson + */ +public final class ExecutionTime { +} diff --git a/graphwalker-core/src/main/resources/core.properties b/graphwalker-core/src/main/resources/core.properties new file mode 100644 index 00000000..ac9d60dd --- /dev/null +++ b/graphwalker-core/src/main/resources/core.properties @@ -0,0 +1,66 @@ +### +# #%L +# GraphWalker Core +# %% +# Copyright (C) 2011 - 2012 GraphWalker +# %% +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# #L% +### + +start.vertex = Start +default.language = Groovy +script.implementation.name = impl + +label.blocked = BLOCKED +label.switch.model = SWITCH_MODEL +label.requirement = REQ + +exception.model.missing = Can''t find model: {0} +exception.duplicate.start.vertex = Duplicate start vertices found +exception.start.vertex.missing = Start vertex not found +exception.start.vertex.in.edge = Start vertex can''t contain in edges +exception.start.vertex.out.edges = Start vertex can only handle one out edge +exception.condition.unknown = Unknown stop condition type +exception.condition.missing = PathGenerator has no StopCondition +exception.condition.wrong.type = Return type must be of either boolean or double +exception.generator.unknown = Unknown path generator +exception.generator.missing = No path generator defined +exception.generator.path.missing = No path found +exception.file.missing = File not found: {0} +exception.script.error = Script error: {0} +exception.script.engine.missing = Script engine [{0}] couldn''t be created, maybe a dependency is missing +exception.class.missing = Class not found: {0} +exception.class.instantiation = Can''t create object of type: {0} +exception.method.invocation = Invocation exception when executing: {0} +exception.method.missing = Implementation does not contain method: {0} +exception.method.access = Access exception when executing: {0} +exception.not.supported.argument = Not supported arguments +exception.wrong.return.type = Not supported return type +exception.report.failure = Unable to create report +exception.report.creating = Unable to create file: {0} +exception.report.directory = Unable to create folder: {0} + +log.method.call = Execute model(id = {0}).{1}(id = {2}, name = {3}, counter = {4}) +log.requirement = Requirement {0} {1} +log.factory.create.before = {0} will try to create a {1} object instance +log.factory.create.after = {1} object instance were created by the {0} + +assert.message = Expected {1} but got {0} {2} +assert.same.message = Expected not {1} but got {0} {2} diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/AlgorithmTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/AlgorithmTest.java new file mode 100644 index 00000000..730e3820 --- /dev/null +++ b/graphwalker-core/src/test/java/org/graphwalker/core/AlgorithmTest.java @@ -0,0 +1,78 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core; + +import org.graphwalker.core.algorithm.Eulerian; +import org.graphwalker.core.common.Assert; +import org.graphwalker.core.model.Edge; +import org.graphwalker.core.model.Vertex; +import org.junit.Test; + +/** + * @author Nils Olsson + */ +public class AlgorithmTest { + + @Test + public void semiEuler() { + Model model = new SimpleModel() + .addEdge(new Edge("e0", new Vertex("v0"), new Vertex("v1"))) + .addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))) + .addEdge(new Edge("e2", new Vertex("v1"), new Vertex("v3"))) + .addEdge(new Edge("e3", new Vertex("v3"), new Vertex("v4"))) + .addEdge(new Edge("e4", new Vertex("v4"), new Vertex("v1"))); + Eulerian eulerian = new Eulerian(model); + Assert.assertEquals(eulerian.getEulerianType(), Eulerian.EulerianType.SEMI_EULERIAN); + Assert.assertEquals(model, eulerian.eulerize()); + } + + @Test + public void notEuler() { + Model model = new SimpleModel() + .addEdge(new Edge("e0", new Vertex("v0"), new Vertex("v1"))) + .addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))) + .addEdge(new Edge("e2", new Vertex("v1"), new Vertex("v3"))) + .addEdge(new Edge("e3", new Vertex("v3"), new Vertex("v4"))) + .addEdge(new Edge("e4", new Vertex("v4"), new Vertex("v1"))) + .addEdge(new Edge("e5", new Vertex("v1"), new Vertex("v3"))); + Eulerian eulerian = new Eulerian(model); + Assert.assertEquals(eulerian.getEulerianType(), Eulerian.EulerianType.NOT_EULERIAN); + //Assert.assertNotSame(model, eulerian.eulerize()); + } + + @Test + public void euler() { + Model model = new SimpleModel() + .addEdge(new Edge("e0", new Vertex("v2"), new Vertex("v1"))) + .addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))) + .addEdge(new Edge("e2", new Vertex("v1"), new Vertex("v3"))) + .addEdge(new Edge("e3", new Vertex("v3"), new Vertex("v4"))) + .addEdge(new Edge("e4", new Vertex("v4"), new Vertex("v1"))); + Eulerian eulerian = new Eulerian(model); + Assert.assertEquals(eulerian.getEulerianType(), Eulerian.EulerianType.EULERIAN); + //Assert.assertNotSame(model, eulerian.eulerize()); + } +} diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/MachineTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/MachineTest.java new file mode 100644 index 00000000..5e98e695 --- /dev/null +++ b/graphwalker-core/src/test/java/org/graphwalker/core/MachineTest.java @@ -0,0 +1,158 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core; + +import org.graphwalker.core.condition.VertexCoverage; +import org.graphwalker.core.generator.NoPathFoundException; +import org.graphwalker.core.generator.RandomPath; +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.machine.ExecutionStatus; +import org.graphwalker.core.model.*; +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayDeque; +import java.util.Arrays; +import java.util.Deque; +import java.util.HashSet; + +/** + * @author Nils Olsson + */ +public class MachineTest { + + @Test + public void simpleMachine() { + Model model = new SimpleModel().addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))); + PathGenerator pathGenerator = new RandomPath(new VertexCoverage()); + ExecutionContext context = new ExecutionContext(model, pathGenerator); + Machine machine = new SimpleMachine(context); + Deque names = new ArrayDeque<>(Arrays.asList("v1", "e1", "v2", "ERROR")); + while (machine.hasNextStep()) { + machine.getNextStep(); + Assert.assertEquals(names.pop(), machine.getCurrentStep().getName()); + } + } + + @Test + public void restartMachine() { + Model model = new SimpleModel().addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))); + PathGenerator pathGenerator = new RandomPath(new VertexCoverage()); + ExecutionContext context = new ExecutionContext(model, pathGenerator); + Machine machine = new SimpleMachine(context); + Deque names = new ArrayDeque<>(Arrays.asList("v1", "e1", "v1", "e1", "v2", "ERROR")); + Assert.assertEquals(names.pop(), machine.getNextStep().getName()); + Assert.assertEquals(names.pop(), machine.getNextStep().getName()); + // e.g. if an error occurs or we "reach the end of the road", the reset function can restart the machine and keep the current states + machine.restart(); + Assert.assertEquals(names.pop(), machine.getNextStep().getName()); + Assert.assertEquals(2, machine.getCurrentExecutionContext().getVisitCount(machine.getCurrentStep()).longValue()); + while (machine.hasNextStep()) { + Assert.assertEquals(names.pop(), machine.getNextStep().getName()); + } + } + + @Test + public void executeAction() { + Model model = new SimpleModel().addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2") + , new HashSet<>(Arrays.asList(new Action("var i = 3;"))))); + PathGenerator pathGenerator = new RandomPath(new VertexCoverage()); + ExecutionContext context = new ExecutionContext(model, pathGenerator); + Machine machine = new SimpleMachine(context); + Assert.assertEquals("v1", machine.getNextStep().getName()); + Assert.assertEquals("e1", machine.getNextStep().getName()); + Assert.assertEquals(3.0, machine.getScriptContext().getAttribute("i")); + } + + @Test + public void executeVertexActions() { + Model model = new SimpleModel().addEdge(new Edge("e1" + , new Vertex("v1", new HashSet(), new HashSet(), new HashSet<>(Arrays.asList(new Action("var i = 1;")))) + , new Vertex("v2", new HashSet(), new HashSet<>(Arrays.asList(new Action("i = 2;")))))); + PathGenerator pathGenerator = new RandomPath(new VertexCoverage()); + ExecutionContext context = new ExecutionContext(model, pathGenerator); + Machine machine = new SimpleMachine(context); + Assert.assertNull(context.getScriptContext().getAttribute("i")); + Assert.assertEquals("v1", machine.getNextStep().getName()); + Assert.assertNull(context.getScriptContext().getAttribute("i")); + Assert.assertEquals("e1", machine.getNextStep().getName()); + Assert.assertNotNull(context.getScriptContext().getAttribute("i")); + Assert.assertEquals(1.0, context.getScriptContext().getAttribute("i")); + Assert.assertEquals("v2", machine.getNextStep().getName()); + Assert.assertEquals(2.0, context.getScriptContext().getAttribute("i")); + Assert.assertFalse(machine.hasNextStep()); + } + + @Test(expected = NoPathFoundException.class) + public void executeFail() { + Model model = new SimpleModel().addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))) + .addEdge(new Edge("e2", new Vertex("v1"), new Vertex("v3"))); + PathGenerator pathGenerator = new RandomPath(new VertexCoverage()); + ExecutionContext context = new ExecutionContext(model, pathGenerator); + Machine machine = new SimpleMachine(context); + while (machine.hasNextStep()) { + machine.getNextStep(); + } + } + + @Test + public void verifyExecutionStatus() { + Model model = new SimpleModel().addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))); + PathGenerator pathGenerator = new RandomPath(new VertexCoverage()); + ExecutionContext context = new ExecutionContext(model, pathGenerator); + Machine machine = new SimpleMachine(context); + Assert.assertEquals(ExecutionStatus.NOT_EXECUTED, machine.getCurrentExecutionContext().getExecutionStatus()); + while (machine.hasNextStep()) { + machine.getNextStep(); + Assert.assertEquals(ExecutionStatus.EXECUTING, machine.getCurrentExecutionContext().getExecutionStatus()); + } + Assert.assertEquals(ExecutionStatus.COMPLETED, machine.getCurrentExecutionContext().getExecutionStatus()); + } + + @Test + public void verifyFailedExecutionStatus() { + Model model = new SimpleModel().addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))) + .addEdge(new Edge("e2", new Vertex("v1"), new Vertex("v3"))); + PathGenerator pathGenerator = new RandomPath(new VertexCoverage()); + ExecutionContext context = new ExecutionContext(model, pathGenerator); + Machine machine = new SimpleMachine(context); + Assert.assertEquals(ExecutionStatus.NOT_EXECUTED, machine.getCurrentExecutionContext().getExecutionStatus()); + try { + while (machine.hasNextStep()) { + machine.getNextStep(); + Assert.assertEquals(ExecutionStatus.EXECUTING, machine.getCurrentExecutionContext().getExecutionStatus()); + } + } catch (Throwable t) { + machine.failCurrentStep(); + } + Assert.assertEquals(ExecutionStatus.FAILED, machine.getCurrentExecutionContext().getExecutionStatus()); + } + + @Test + public void switchModel() { + + } +} diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/ModelTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/ModelTest.java new file mode 100644 index 00000000..03a6b897 --- /dev/null +++ b/graphwalker-core/src/test/java/org/graphwalker/core/ModelTest.java @@ -0,0 +1,358 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core; + +import org.graphwalker.core.model.*; +import org.graphwalker.core.script.ScriptContext; +import org.junit.Assert; +import org.junit.Test; + +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +import javax.script.ScriptException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * @author Nils Olsson + */ +public class ModelTest { + + private ScriptEngine createScriptEngine(String language) { + ScriptEngineManager scriptEngineManager = new ScriptEngineManager(); + ScriptEngine scriptEngine = scriptEngineManager.getEngineByName(language); + scriptEngine.setContext(new ScriptContext()); + return scriptEngine; + } + + @Test + public void emptyEdgeName() { + new Edge("", new Vertex("vertex1"), new Vertex("vertex2")); + } + + @Test + public void emptyVertexName() { + new Vertex(""); + } + + @Test(expected = IllegalArgumentException.class) + public void emptyGuard() { + new Guard(""); + } + + @Test(expected = IllegalArgumentException.class) + public void emptyAction() { + new Action(""); + } + + @Test + public void equals() { + Vertex vertex1 = new Vertex("vertex1"); + Vertex vertex2 = new Vertex("vertex2"); + Assert.assertEquals(new Action("abc"), new Action("abc")); + Assert.assertEquals(new Guard("abc"), new Guard("abc")); + Assert.assertEquals(new Edge("abc", vertex1, vertex2), new Edge("abc", vertex1, vertex2)); + Assert.assertEquals(new Edge("abc", vertex1, vertex2, new Guard("true"), new HashSet()) + , new Edge("abc", vertex1, vertex2, new Guard("true"), new HashSet())); + Assert.assertEquals(new Edge("abc", vertex1, vertex2, new Guard("true"), new HashSet(), false) + , new Edge("abc", vertex1, vertex2, new Guard("true"), new HashSet(), false)); + Assert.assertEquals(new Edge("abc", vertex1, vertex2, new Guard("true"), new HashSet(), false, 2.0) + , new Edge("abc", vertex1, vertex2, new Guard("true"), new HashSet(), false, 2.0)); + Assert.assertEquals(new Vertex("abc"), new Vertex("abc")); + } + + @Test + public void notSame() { + Vertex vertex1 = new Vertex("vertex1"); + Vertex vertex2 = new Vertex("vertex2"); + Vertex vertex3 = new Vertex("vertex3"); + Assert.assertNotEquals(new Action("abc"), new Action("def")); + Assert.assertNotEquals(new Action("abc"), "def"); + Assert.assertNotEquals(new Action("abc"), null); + Assert.assertNotEquals(new Guard("abc"), new Guard("def")); + Assert.assertNotEquals(new Guard("abc"), "def"); + Assert.assertNotEquals(new Guard("abc"), null); + Assert.assertNotEquals(new Edge("abc", vertex1, vertex2), new Edge("abc", vertex1, vertex3)); + Assert.assertNotEquals(new Edge("abc", vertex1, vertex2), new Edge("def", vertex1, vertex2)); + Assert.assertNotEquals(new Edge("abc", vertex1, vertex2, new Guard("123") + , new HashSet<>(Arrays.asList(new Action("1234"))), true, 2.0) + , new Edge("abc", vertex1, vertex2, new Guard("123") + , new HashSet<>(Arrays.asList(new Action("1234"))), true, 2.1)); + Assert.assertNotEquals(new Edge("abc", vertex1, vertex2, new Guard("123") + , new HashSet<>(Arrays.asList(new Action("1234"))), false, 2.0) + , new Edge("abc", vertex1, vertex2, new Guard("123") + , new HashSet<>(Arrays.asList(new Action("1234"))), true, 2.0)); + Assert.assertNotEquals(new Edge("abc", vertex1, vertex2), "def"); + Assert.assertNotEquals(new Edge("abc", vertex1, vertex2), null); + Assert.assertNotEquals(new Vertex("abc"), new Vertex("def")); + Assert.assertNotEquals(new Vertex("abc"), "def"); + Assert.assertNotEquals(new Vertex("abc"), null); + } + + @Test(expected = UnsupportedOperationException.class) + public void modifyEdgeActions() { + Vertex vertex1 = new Vertex("vertex1"); + Vertex vertex2 = new Vertex("vertex2"); + Set actions = new HashSet<>(); + actions.add(new Action("abc")); + Edge edge = new Edge("edge1", vertex1, vertex2, actions); + Assert.assertNotNull(edge.getActions()); + Assert.assertEquals(1, edge.getActions().size()); + edge.getActions().add(new Action("def")); + Assert.assertEquals(1, edge.getActions().size()); + } + + @Test(expected = UnsupportedOperationException.class) + public void modifyVertexRequirements() { + Vertex vertex = new Vertex("vertex", new HashSet<>(Arrays.asList(new Requirement("1")))); + Assert.assertNotNull(vertex.getRequirements()); + Assert.assertEquals(1, vertex.getRequirements().size()); + vertex.getRequirements().clear(); + } + + @Test(expected = UnsupportedOperationException.class) + public void modifyVertexEntryActions() { + Vertex vertex = new Vertex("vertex" + , new HashSet() + , new HashSet<>(Arrays.asList(new Action("1")))); + Assert.assertNotNull(vertex.getEntryActions()); + Assert.assertEquals(1, vertex.getEntryActions().size()); + vertex.getEntryActions().clear(); + } + + @Test(expected = UnsupportedOperationException.class) + public void modifyVertexExitActions() { + Vertex vertex = new Vertex("vertex" + , new HashSet() + , new HashSet() + , new HashSet<>(Arrays.asList(new Action("1")))); + Assert.assertNotNull(vertex.getExitActions()); + Assert.assertEquals(1, vertex.getExitActions().size()); + vertex.getEntryActions().clear(); + } + + @Test(expected = Throwable.class) + public void nullAction() { + new Action(null); + } + + @Test(expected = Throwable.class) + public void nullGuard() { + new Guard(null); + } + + @Test(expected = Throwable.class) + public void nullEdge() { + new Edge(null, null, null); + } + + @Test(expected = Throwable.class) + public void nullEdgeSourceVertex() { + new Edge("abc", null, new Vertex("vertex2")); + } + + @Test(expected = Throwable.class) + public void nullEdgeTargetVertex() { + new Edge("abc", new Vertex("vertex1"), null); + } + + @Test + public void nullVertex() { + new Vertex(null); + } + + @Test + public void createEdge() throws ScriptException { + // create script engine and initiate variable + ScriptEngine scriptEngine = createScriptEngine("JavaScript"); + scriptEngine.eval("var i = 0;"); + // create edge with a guard and a action, that will change the current context + Edge edge2 = new Edge("edge2" + , new Vertex("vertex1") + , new Vertex("vertex2") + , new Guard("i > 0") + , new HashSet<>(Arrays.asList(new Action("i++")))); + Assert.assertEquals("edge2", edge2.getName()); + Assert.assertFalse(edge2.getGuard().isFulfilled(scriptEngine)); + // execute actions + for (Action action : edge2.getActions()) { + action.execute(scriptEngine); + } + // verify that the guard is satisfied + Assert.assertTrue(edge2.getGuard().isFulfilled(scriptEngine)); + } + + @Test + public void createVertex() throws ScriptException { + // create script engine, and execute entry and exit actions + ScriptEngine scriptEngine = createScriptEngine("JavaScript"); + Vertex vertex2 = new Vertex("vertex2" + , new HashSet<>(Arrays.asList(new Requirement("123"))) + , new HashSet<>(Arrays.asList(new Action("var x = 5;"))) + , new HashSet<>(Arrays.asList(new Action("x = 10;")))); + // execute entry actions + for (Action action : vertex2.getEntryActions()) { + action.execute(scriptEngine); + } + // execute exit actions + for (Action action : vertex2.getExitActions()) { + action.execute(scriptEngine); + } + // verify that we can access the created variable and that it has the correct value + Assert.assertEquals(10d, scriptEngine.getContext().getAttribute("x")); + } + + @Test + public void createModel() { + Model model = new SimpleModel() + .addVertex(new Vertex("vertex1")) + .addVertex(new Vertex("vertex2")) + .addEdge(new Edge("edge1" + , new Vertex("vertex1") + , new Vertex("vertex2"))); + // assert model contains the added edges and vertices + Assert.assertEquals(2, model.getVertices().size()); + Assert.assertEquals(1, model.getEdges().size()); + Assert.assertNotNull(model.getVertex("vertex1")); + Assert.assertNotNull(model.getVertex("vertex2")); + Assert.assertNull(model.getVertex("edge1")); + Assert.assertEquals(model.getEdges().get(0).getSourceVertex(), model.getVertex("vertex1")); + // add a new edge with the same name + model = model.addEdge(new Edge("edge1", model.getVertex("vertex2"), model.getVertex("vertex1"))); + Assert.assertEquals(2, model.getEdges().size()); + Assert.assertEquals(model.getEdges().get(0).getSourceVertex(), model.getEdges().get(1).getTargetVertex()); + Assert.assertEquals(model.getEdges().get(0).getTargetVertex(), model.getEdges().get(1).getSourceVertex()); + } + + @Test + public void mergeModel() { + Model scenario1 = new SimpleModel(); + scenario1 = scenario1.addVertex(new Vertex("vertex1")); + scenario1 = scenario1.addVertex(new Vertex("vertex2" + , new HashSet<>(Arrays.asList(new Requirement("123"))))); + scenario1 = scenario1.addEdge(new Edge("edge1", scenario1.getVertex("vertex1"), scenario1.getVertex("vertex2"))); + Model scenario2 = new SimpleModel(); + scenario2 = scenario2.addVertex(new Vertex("vertex2" + , new HashSet<>(Arrays.asList(new Requirement("123"), new Requirement("456"))))); + scenario2 = scenario2.addVertex(new Vertex("vertex3")); + scenario2 = scenario2.addEdge(new Edge("edge2", scenario2.getVertex("vertex2"), scenario2.getVertex("vertex3"))); + Model merged = scenario1.addModel(scenario2); + // assert that the model contains both scenarios, but only one instance of the "same" element + Assert.assertNotNull(merged.getVertex("vertex1")); + Assert.assertNotNull(merged.getVertex("vertex2")); + Assert.assertNotNull(merged.getVertex("vertex3")); + Assert.assertNotNull(merged.getVertex("vertex2").getRequirements()); + Assert.assertEquals(2, merged.getVertex("vertex2").getRequirements().size()); + } + + @Test + public void connectedComponent() { + Model model = new SimpleModel() + .addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))) + .addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v3"))) + .addEdge(new Edge("e1", new Vertex("v3"), new Vertex("v4"))) + .addEdge(new Edge("e1", new Vertex("v4"), new Vertex("v5"))) + .addEdge(new Edge("e1", new Vertex("v2"), new Vertex("v5"))); + Model anotherModel = new SimpleModel(); + for (Element element: model.getConnectedComponent(model.getVertex("v1"))) { + if (element instanceof Edge) { + anotherModel = anotherModel.addEdge((Edge)element); + } + } + Assert.assertEquals(model.getElements().size(), anotherModel.getElements().size()); + Model smallerModel = new SimpleModel(); + for (Element element: model.getConnectedComponent(model.getVertex("v2"))) { + if (element instanceof Edge) { + smallerModel = smallerModel.addEdge((Edge) element); + } + } + Assert.assertEquals(3, smallerModel.getElements().size()); + } + + @Test + public void shortestPath() { + Model model = new SimpleModel() + .addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))) + .addEdge(new Edge("e2", new Vertex("v1"), new Vertex("v3"))) + .addEdge(new Edge("e2", new Vertex("v3"), new Vertex("v4"))) + .addEdge(new Edge("e2", new Vertex("v4"), new Vertex("v5"))) + .addEdge(new Edge("e2", new Vertex("v2"), new Vertex("v5"))); + Assert.assertEquals(5, model.getShortestPath(model.getVertex("v1"), model.getVertex("v5")).size()); + } + + @Test + public void shortestDistance() { + Model model = new SimpleModel() + .addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))) + .addEdge(new Edge("e2", new Vertex("v1"), new Vertex("v3"))) + .addEdge(new Edge("e2", new Vertex("v3"), new Vertex("v4"))) + .addEdge(new Edge("e2", new Vertex("v4"), new Vertex("v5"))) + .addEdge(new Edge("e2", new Vertex("v2"), new Vertex("v5"))); + Assert.assertEquals(4, model.getShortestDistance(model.getVertex("v1"), model.getVertex("v5"))); + Model model2 = new SimpleModel().addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))); + Assert.assertEquals(model2.getShortestDistance(model2.getVertex("v1"), model2.getVertex("v2"))+1 + , model2.getShortestPath(model2.getVertex("v1"), model2.getVertex("v2")).size()); + } + + @Test + public void maximumDistance() { + Model model = new SimpleModel() + .addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))) + .addEdge(new Edge("e2", new Vertex("v1"), new Vertex("v3"))) + .addEdge(new Edge("e2", new Vertex("v3"), new Vertex("v4"))) + .addEdge(new Edge("e2", new Vertex("v4"), new Vertex("v5"))) + .addEdge(new Edge("e2", new Vertex("v2"), new Vertex("v5"))); + Assert.assertEquals(5, model.getMaximumDistance(model.getVertex("v5"))); + Model model2 = new SimpleModel().addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))); + Assert.assertEquals(model2.getShortestDistance(model2.getVertex("v1"), model2.getVertex("v2")) + , model2.getMaximumDistance(model2.getVertex("v2"))); + } + + @Test + public void startVertices() { + Model model = new SimpleModel() + .addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))) + .addEdge(new Edge("e2", new Vertex("v1"), new Vertex("v3"))) + .addEdge(new Edge("e2", new Vertex("v3"), new Vertex("v4"))) + .addEdge(new Edge("e2", new Vertex("v4"), new Vertex("v5"))) + .addEdge(new Edge("e2", new Vertex("v2"), new Vertex("v5"))); + Assert.assertEquals(1, model.getStartVertices().size()); + model = model.addEdge(new Edge("e0", new Vertex("v0"), new Vertex("v2"))); + Assert.assertEquals(2, model.getStartVertices().size()); + } + + @Test + public void aggregateRequirements() { + Model model = new SimpleModel() + .addVertex(new Vertex("A", new HashSet<>(Arrays.asList(new Requirement("A1"), new Requirement("A2"))))) + .addVertex(new Vertex("B", new HashSet<>(Arrays.asList(new Requirement("B1"))))); + Assert.assertEquals(3, model.getRequirements().size()); + Assert.assertTrue(model.getRequirements().contains(new Requirement("A1"))); + Assert.assertTrue(model.getRequirements().contains(new Requirement("A2"))); + Assert.assertTrue(model.getRequirements().contains(new Requirement("B1"))); + } +} diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/PathGeneratorTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/PathGeneratorTest.java new file mode 100644 index 00000000..c80f2b72 --- /dev/null +++ b/graphwalker-core/src/test/java/org/graphwalker/core/PathGeneratorTest.java @@ -0,0 +1,212 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core; + +import org.graphwalker.core.common.Assert; +import org.graphwalker.core.condition.EdgeCoverage; +import org.graphwalker.core.condition.Never; +import org.graphwalker.core.condition.ReachedVertex; +import org.graphwalker.core.generator.AStarPath; +import org.graphwalker.core.generator.RandomLeastVisitedPath; +import org.graphwalker.core.generator.RandomPath; +import org.graphwalker.core.generator.RandomUnvisitedFirstPath; +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.model.Edge; +import org.graphwalker.core.model.Vertex; +import org.junit.Test; + +import java.util.ArrayDeque; +import java.util.Arrays; +import java.util.Deque; + +/** + * @author Nils Olsson + */ +public class PathGeneratorTest { + + @Test + public void AStarPathTest() { + Model model = new SimpleModel() + .addEdge(new Edge("e0", new Vertex("v0"), new Vertex("v1"))) + .addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))) + .addEdge(new Edge("e2", new Vertex("v1"), new Vertex("v3"))) + .addEdge(new Edge("e3", new Vertex("v2"), new Vertex("v5"))) + .addEdge(new Edge("e4", new Vertex("v3"), new Vertex("v4"))) + .addEdge(new Edge("e5", new Vertex("v1"), new Vertex("v5"))); + PathGenerator pathGenerator = new AStarPath(new ReachedVertex("v5")); + ExecutionContext context = new ExecutionContext(model, pathGenerator); + Machine machine = new SimpleMachine(context); + Deque expectedPath = new ArrayDeque<>(Arrays.asList("e0", "v1", "e5", "v5")); + Deque path = new ArrayDeque<>(); + while (machine.hasNextStep()) { + path.push(machine.getNextStep().getName()); + Assert.assertEquals(expectedPath.pop(), path.peek(), path.toString()); + } + } + + @Test + public void AStarPathTestBlocked() { + Model model = new SimpleModel() + .addEdge(new Edge("e0", new Vertex("v0"), new Vertex("v1"))) + .addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))) + .addEdge(new Edge("e2", new Vertex("v1"), new Vertex("v3"))) + .addEdge(new Edge("e3", new Vertex("v2"), new Vertex("v5"))) + .addEdge(new Edge("e4", new Vertex("v3"), new Vertex("v4"))) + .addEdge(new Edge("e5", new Vertex("v1"), new Vertex("v5"), true)); + PathGenerator pathGenerator = new AStarPath(new ReachedVertex("v5")); + ExecutionContext context = new ExecutionContext(model, pathGenerator); + Machine machine = new SimpleMachine(context); + Deque expectedPath = new ArrayDeque<>(Arrays.asList("e0", "v1", "e1", "v2", "e3", "v5")); + Deque path = new ArrayDeque<>(); + while (machine.hasNextStep()) { + path.push(machine.getNextStep().getName()); + Assert.assertEquals(expectedPath.pop(), path.peek(), path.toString()); + } + } + + @Test + public void RandomLeastVisitedPath() { + Model model = new SimpleModel() + .addEdge(new Edge("e0", new Vertex("v0"), new Vertex("v1"))) + .addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v1"))) + .addEdge(new Edge("e2", new Vertex("v1"), new Vertex("v1"))); + PathGenerator pathGenerator = new RandomLeastVisitedPath(new Never()); + ExecutionContext context = new ExecutionContext(model, pathGenerator); + Machine machine = new SimpleMachine(context); + Deque names = new ArrayDeque<>(Arrays.asList("v0", "e0", "v1", "ANY", "v1", "OTHER", "v1", "ANY", "v1", "OTHER")); + String visited = "NONE"; + Deque path = new ArrayDeque<>(); + while (machine.hasNextStep()) { + path.push(machine.getNextStep().getName()); + String expected = names.pop(); + switch (expected) { + case "ANY": { + visited = path.peek(); + } + break; + case "OTHER": { + switch (visited) { + case "e1": + Assert.assertEquals(path.peek(), "e2", path.toString()); + break; + case "e2": + Assert.assertEquals(path.peek(), "e1", path.toString()); + break; + } + visited = path.peek(); + } + break; + default: + Assert.assertEquals(path.peek(), expected, path.toString()); + } + if (names.isEmpty()) { + break; + } + } + } + + @Test + public void RandomPathReachedVertex() { + Model model = new SimpleModel() + .addEdge(new Edge("e0", new Vertex("v0"), new Vertex("v1"))) + .addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v1"))) + .addEdge(new Edge("e2", new Vertex("v1"), new Vertex("v1"))); + PathGenerator pathGenerator = new RandomPath(new ReachedVertex("v1")); + ExecutionContext context = new ExecutionContext(model, pathGenerator); + Machine machine = new SimpleMachine(context); + boolean e1Visited = false, e2Visited = false; + while (machine.hasNextStep()) { + switch (machine.getNextStep().getName()) { + case "e1": + e1Visited = true; + break; + case "e2": + e2Visited = true; + break; + } + } + Assert.assertFalse(e1Visited || e2Visited); + } + + @Test + public void RandomPath() { + Model model = new SimpleModel() + .addEdge(new Edge("e0", new Vertex("v0"), new Vertex("v1"))) + .addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v1"))) + .addEdge(new Edge("e2", new Vertex("v1"), new Vertex("v1"))); + PathGenerator pathGenerator = new RandomPath(new EdgeCoverage()); + ExecutionContext context = new ExecutionContext(model, pathGenerator); + Machine machine = new SimpleMachine(context); + boolean e1Visited = false, e2Visited = false; + while (machine.hasNextStep()) { + switch (machine.getNextStep().getName()) { + case "e1": + e1Visited = true; + break; + case "e2": + e2Visited = true; + break; + } + } + Assert.assertTrue(e1Visited && e2Visited); + } + + @Test + public void RandomUnvisitedFirstPath() { + Model model = new SimpleModel() + .addEdge(new Edge("e0", new Vertex("v0"), new Vertex("v1"))) + .addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v1"))) + .addEdge(new Edge("e2", new Vertex("v1"), new Vertex("v1"))); + PathGenerator pathGenerator = new RandomUnvisitedFirstPath(new EdgeCoverage()); + ExecutionContext context = new ExecutionContext(model, pathGenerator); + Machine machine = new SimpleMachine(context); + Deque names = new ArrayDeque<>(Arrays.asList("v0", "e0", "v1", "ANY", "v1", "OTHER")); + Deque visited = new ArrayDeque<>(); + while (machine.hasNextStep()) { + String current = machine.getNextStep().getName(); + String expected = names.pop(); + switch (expected) { + case "ANY": { + } + break; + case "OTHER": { + switch (visited.peek()) { + case "e1": + Assert.assertEquals(current, "e2", visited.toString()); + break; + case "e2": + Assert.assertEquals(current, "e1", visited.toString()); + break; + } + } + break; + default: + Assert.assertEquals(current, expected, visited.toString()); + } + visited.push(current); + } + } +} diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/common/AssertTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/common/AssertTest.java new file mode 100644 index 00000000..9f8c14d2 --- /dev/null +++ b/graphwalker-core/src/test/java/org/graphwalker/core/common/AssertTest.java @@ -0,0 +1,486 @@ +/* + * #%L + * + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.common; + +import org.junit.Test; + +import java.util.*; + +/** + * @author Nils Olsson + */ +public class AssertTest { + + private static final Map map1 = new HashMap<>(); + private static final Map map2 = new HashMap<>(); + private static final Set set1 = new HashSet<>(); + private static final Set set2 = new HashSet<>(); + private static final List list1 = Arrays.asList("string1", "string2"); + private static final List list2 = Arrays.asList("string2", "string1"); + private static final byte[] array1 = new byte[]{(byte) 1, (byte) 2}; + private static final byte[] array2 = new byte[]{(byte) 2, (byte) 1}; + private static final Object obj1 = new Object(); + private static final Object obj2 = new Object(); + private static final Object[] objects1 = new Object[]{obj1, obj2}; + private static final Object[] objects2 = new Object[]{obj2, obj1}; + private static final Object[] objects3 = new Object[]{obj1}; + + static { + map1.put("key1", "value1"); + map2.put("key2", "value2"); + set1.add("value1"); + set2.add("value2"); + } + + private Iterable cast(List iterable) { + return iterable; + } + + @Test + public void assertions() { + Assert.assertTrue(true, "message"); + Assert.assertTrue(true); + Assert.assertFalse(false, "message"); + Assert.assertFalse(false); + Object object = new Object(); + Assert.assertEquals(object, object, "message"); + Assert.assertEquals(object, object); + String string = "string"; + Assert.assertEquals(string, string, "message"); + Assert.assertEquals(string, string); + Assert.assertEquals(1d, 1.1d, 0.5d, "message"); + Assert.assertEquals(1d, 1.1d, 0.5d); + Assert.assertEquals(1f, 1.1f, 0.5f, "message"); + Assert.assertEquals(1f, 1.1f, 0.5f); + Assert.assertEquals((long) 1, (long) 1, "message"); + Assert.assertEquals((long) 1, (long) 1); + Assert.assertEquals(true, true, "message"); + Assert.assertEquals(true, true); + Assert.assertEquals((byte) 1, (byte) 1, "message"); + Assert.assertEquals((byte) 1, (byte) 1); + Assert.assertEquals('a', 'a', "message"); + Assert.assertEquals('a', 'a'); + Assert.assertEquals((short) 1, (short) 1, "message"); + Assert.assertEquals((short) 1, (short) 1); + Assert.assertEquals(1, 1, "message"); + Assert.assertEquals(1, 1); + Assert.assertNotNull(object); + Assert.assertNotNull(object, "message"); + Assert.assertNull(null); + Assert.assertNull(null, "message"); + Assert.assertSame(object, object, "message"); + Assert.assertSame(object, object); + Assert.assertNotSame(object, string, "message"); + Assert.assertNotSame(object, string); + Assert.assertTrue(Assert.format("string1", "string2", "message").equals("message expected [string2] but found [string1]")); + Assert.assertEquals(list1, list1); + Assert.assertEquals(list1, list1, "message"); + Assert.assertEquals(objects1, objects1, "message"); + Assert.assertEquals(objects1, objects1); + Assert.assertEquals(list1.iterator(), list1.iterator()); + Assert.assertEquals(list1.iterator(), list1.iterator(), "message"); + Assert.assertEquals(cast(list1), cast(list1)); + Assert.assertEquals(cast(list1), cast(list1), "message"); + Assert.assertEqualsNoOrder(objects1, objects2, "message"); + Assert.assertEqualsNoOrder(objects2, objects1); + Assert.assertEquals(array1, array1); + Assert.assertEquals(array1, array1, "message"); + Assert.assertEquals(set1, set1); + Assert.assertEquals(set1, set1, "message"); + Assert.assertEquals(map1, map1); + Assert.assertNotEquals(new Object(), "", "message"); + Assert.assertNotEquals(new Object(), ""); + Assert.assertNotEquals("actual1", "actual2", "message"); + Assert.assertNotEquals("actual1", "actual2"); + Assert.assertNotEquals(1L, 2L, "message"); + Assert.assertNotEquals(1L, 2L); + Assert.assertNotEquals(true, false, "message"); + Assert.assertNotEquals(true, false); + Assert.assertNotEquals((byte) 1, (byte) 2, "message"); + Assert.assertNotEquals((byte) 1, (byte) 2); + Assert.assertNotEquals('a', 'b', "message"); + Assert.assertNotEquals('a', 'b'); + Assert.assertNotEquals((short) 1, (short) 2, "message"); + Assert.assertNotEquals((short) 1, (short) 2); + Assert.assertNotEquals(6500, 2, "message"); + Assert.assertNotEquals(1, 2); + Assert.assertNotEquals(1f, 2f, 0.5f, "message"); + Assert.assertNotEquals(1f, 2f, 0.5f); + Assert.assertNotEquals(1d, 2d, 0.5d, "message"); + Assert.assertNotEquals(1d, 2d, 0.5d); + } + + @Test(expected = AssertionError.class) + public void failWithMessageAndThrowable() { + Assert.fail("message", new RuntimeException()); + } + + @Test(expected = AssertionError.class) + public void failWithMessage() { + Assert.fail("message"); + } + + @Test(expected = AssertionError.class) + public void fail() { + Assert.fail(); + } + + @Test(expected = AssertionError.class) + public void fail1() { + Assert.assertTrue(false, "message"); + } + + @Test(expected = AssertionError.class) + public void fail2() { + Assert.assertTrue(false); + } + + @Test(expected = AssertionError.class) + public void fail3() { + Assert.assertFalse(true, "message"); + } + + @Test(expected = AssertionError.class) + public void fail4() { + Assert.assertFalse(true); + } + + @Test(expected = AssertionError.class) + public void fail5() { + Assert.assertEquals(new Object(), "object", "message"); + } + + @Test(expected = AssertionError.class) + public void fail6() { + Assert.assertEquals(new Object(), "object"); + } + + @Test(expected = AssertionError.class) + public void fail7() { + Assert.assertEquals("string1", "string2", "message"); + } + + @Test(expected = AssertionError.class) + public void fail8() { + Assert.assertEquals("string1", "string2"); + } + + @Test(expected = AssertionError.class) + public void fail9() { + Assert.assertEquals(1d, 2.1d, 0.5d, "message"); + } + + @Test(expected = AssertionError.class) + public void fail10() { + Assert.assertEquals(2d, 1.1d, 0.5d); + } + + @Test(expected = AssertionError.class) + public void fail11() { + Assert.assertEquals(1f, 2.1f, 0.5f, "message"); + } + + @Test(expected = AssertionError.class) + public void fail12() { + Assert.assertEquals(2f, 1.1f, 0.5f); + } + + @Test(expected = AssertionError.class) + public void fail13() { + Assert.assertEquals((long) 1, (long) 2, "message"); + } + + @Test(expected = AssertionError.class) + public void fail14() { + Assert.assertEquals((long) 1, (long) 2); + } + + @Test(expected = AssertionError.class) + public void fail15() { + Assert.assertEquals(true, false, "message"); + } + + @Test(expected = AssertionError.class) + public void fail16() { + Assert.assertEquals(false, true); + } + + @Test(expected = AssertionError.class) + public void fail17() { + Assert.assertEquals((byte) 1, (byte) 2, "message"); + } + + @Test(expected = AssertionError.class) + public void fail18() { + Assert.assertEquals((byte) 2, (byte) 1); + } + + @Test(expected = AssertionError.class) + public void fail19() { + Assert.assertEquals('a', 'b', "message"); + } + + @Test(expected = AssertionError.class) + public void fail20() { + Assert.assertEquals('b', 'a'); + } + + @Test(expected = AssertionError.class) + public void fail21() { + Assert.assertEquals((short) 1, (short) 2, "message"); + } + + @Test(expected = AssertionError.class) + public void fail22() { + Assert.assertEquals((short) 2, (short) 1); + } + + @Test(expected = AssertionError.class) + public void fail23() { + Assert.assertEquals(1, 2, "message"); + } + + @Test(expected = AssertionError.class) + public void fail24() { + Assert.assertEquals(2, 1); + } + + @Test(expected = AssertionError.class) + public void fail25() { + Assert.assertNotNull(null); + } + + @Test(expected = AssertionError.class) + public void fail26() { + Assert.assertNotNull(null, "message"); + } + + @Test(expected = AssertionError.class) + public void fail27() { + Assert.assertNull(new Object()); + } + + @Test(expected = AssertionError.class) + public void fail28() { + Assert.assertNull(new Object(), "message"); + } + + @Test(expected = AssertionError.class) + public void fail29() { + Assert.assertSame("object1", "object2", "message"); + } + + @Test(expected = AssertionError.class) + public void fail30() { + Assert.assertSame("object2", "object1"); + } + + @Test(expected = AssertionError.class) + public void fail31() { + Assert.assertNotSame("object", "object", "message"); + } + + @Test(expected = AssertionError.class) + public void fail32() { + Assert.assertNotSame("object", "object"); + } + + @Test(expected = AssertionError.class) + public void fail33() { + Assert.assertEquals(set1, set2); + } + + @Test(expected = AssertionError.class) + public void fail34() { + Assert.assertEquals(set2, set1, "message"); + } + + @Test(expected = AssertionError.class) + public void fail35() { + Assert.assertEquals(map1, map2); + } + + @Test(expected = AssertionError.class) + public void fail36() { + Assert.assertNotEquals("object", "object", "message"); + } + + @Test(expected = AssertionError.class) + public void fail37() { + Assert.assertNotEquals("object", "object"); + } + + @Test(expected = AssertionError.class) + public void fail38() { + Assert.assertNotEquals("actual1", "actual1", "message"); + } + + @Test(expected = AssertionError.class) + public void fail39() { + Assert.assertNotEquals("actual2", "actual2"); + } + + @Test(expected = AssertionError.class) + public void fail40() { + Assert.assertNotEquals(1L, 1L, "message"); + } + + @Test(expected = AssertionError.class) + public void fail41() { + Assert.assertNotEquals(1L, 1L); + } + + @Test(expected = AssertionError.class) + public void fail42() { + Assert.assertNotEquals(true, true, "message"); + } + + @Test(expected = AssertionError.class) + public void fail43() { + Assert.assertNotEquals(false, false); + } + + @Test(expected = AssertionError.class) + public void fail44() { + Assert.assertNotEquals((byte) 1, (byte) 1, "message"); + } + + @Test(expected = AssertionError.class) + public void fail45() { + Assert.assertNotEquals((byte) 1, (byte) 1); + } + + @Test(expected = AssertionError.class) + public void fail46() { + Assert.assertNotEquals('a', 'a', "message"); + } + + @Test(expected = AssertionError.class) + public void fail47() { + Assert.assertNotEquals('a', 'a'); + } + + @Test(expected = AssertionError.class) + public void fail48() { + Assert.assertNotEquals((short) 1, (short) 1, "message"); + } + + @Test(expected = AssertionError.class) + public void fail49() { + Assert.assertNotEquals((short) 1, (short) 1); + } + + @Test(expected = AssertionError.class) + public void fail50() { + Assert.assertNotEquals(1, 1, "message"); + } + + @Test(expected = AssertionError.class) + public void fail51() { + Assert.assertNotEquals(1, 1); + } + + @Test(expected = AssertionError.class) + public void fail52() { + Assert.assertNotEquals(1f, 1f, 0.5f, "message"); + } + + @Test(expected = AssertionError.class) + public void fail53() { + Assert.assertNotEquals(1f, 1f, 0.5f); + } + + @Test(expected = AssertionError.class) + public void fail54() { + Assert.assertNotEquals(1d, 1d, 0.5d, "message"); + } + + @Test(expected = AssertionError.class) + public void fail55() { + Assert.assertNotEquals(1d, 1d, 0.5d); + } + + @Test(expected = AssertionError.class) + public void fail56() { + Assert.assertEquals(list1, list2); + } + + @Test(expected = AssertionError.class) + public void fail57() { + Assert.assertEquals(list2, list1, "message"); + } + + @Test(expected = AssertionError.class) + public void fail58() { + Assert.assertEquals(list1.iterator(), list2.iterator()); + } + + @Test(expected = AssertionError.class) + public void fail59() { + Assert.assertEquals(list2.iterator(), list1.iterator(), "message"); + } + + @Test(expected = AssertionError.class) + public void fail60() { + Assert.assertEquals(cast(list1), cast(list2)); + } + + @Test(expected = AssertionError.class) + public void fail61() { + Assert.assertEquals(cast(list2), cast(list1), "message"); + } + + @Test(expected = AssertionError.class) + public void fail62() { + Assert.assertEquals(objects1, objects2); + } + + @Test(expected = AssertionError.class) + public void fail63() { + Assert.assertEquals(objects1, objects3, "message"); + } + + @Test(expected = AssertionError.class) + public void fail64() { + Assert.assertEqualsNoOrder(null, objects2, "message"); + } + + @Test(expected = AssertionError.class) + public void fail65() { + Assert.assertEqualsNoOrder(objects1, objects3); + } + + @Test(expected = AssertionError.class) + public void fail66() { + Assert.assertEquals(array1, array2); + } + + @Test(expected = AssertionError.class) + public void fail67() { + Assert.assertEquals(array2, array1, "message"); + } +} \ No newline at end of file diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/condition/CombinationalConditionTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/condition/CombinationalConditionTest.java new file mode 100644 index 00000000..27a7d552 --- /dev/null +++ b/graphwalker-core/src/test/java/org/graphwalker/core/condition/CombinationalConditionTest.java @@ -0,0 +1,61 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.condition; + +import org.junit.Assert; +import org.junit.Test; + +import static org.hamcrest.core.Is.is; + +public class CombinationalConditionTest { + + @Test + public void testConstructor() { + new CombinationalCondition(); + } + + @Test + public void testFulfillment() { + CombinationalCondition condition = new CombinationalCondition(); + + condition.add(new Never()); + Assert.assertThat("Should be zero", condition.getFulfilment(null), is(0.0)); + } + + @Test + public void testIsFulfilled() { + CombinationalCondition condition = new CombinationalCondition(); + + condition.add(new Never()); + Assert.assertThat("Should be false", condition.isFulfilled(null), is(false)); + + condition.add(new Never()); + Assert.assertThat("Should be false", condition.isFulfilled(null), is(false)); + + condition.add(new Never()); + Assert.assertThat("Should be false", condition.isFulfilled(null), is(false)); + } +} diff --git a/graphwalker-core/src/test/java/org/graphwalker/core/generator/CombinedPathGeneratorTest.java b/graphwalker-core/src/test/java/org/graphwalker/core/generator/CombinedPathGeneratorTest.java new file mode 100644 index 00000000..ce9c9c58 --- /dev/null +++ b/graphwalker-core/src/test/java/org/graphwalker/core/generator/CombinedPathGeneratorTest.java @@ -0,0 +1,89 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.core.generator; + +import org.graphwalker.core.Machine; +import org.graphwalker.core.Model; +import org.graphwalker.core.SimpleMachine; +import org.graphwalker.core.SimpleModel; +import org.graphwalker.core.condition.EdgeCoverage; +import org.graphwalker.core.condition.VertexCoverage; +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.model.Edge; +import org.graphwalker.core.model.Element; +import org.graphwalker.core.model.StartVertex; +import org.graphwalker.core.model.Vertex; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import static org.hamcrest.core.Is.is; + +public class CombinedPathGeneratorTest { + Model model; + + @Before + public void createModel() throws Exception { + model = new SimpleModel() + .addEdge(new Edge("E1" + , new StartVertex() + , new Vertex("V1"))) + .addEdge(new Edge("E2" + , new Vertex("V1") + , new Vertex("V2"))) + .addEdge(new Edge("E3" + , new Vertex("V2") + , new Vertex("V1"))); + } + + @Test + public void twoRandomPathGenerators() throws InterruptedException { + RandomPath randomAllVertices = new RandomPath(new VertexCoverage()); + RandomPath randomAllEdges = new RandomPath(new EdgeCoverage()); + + CombinedPathGenerator pathGenerator = new CombinedPathGenerator(); + pathGenerator.addPathGenerator(randomAllVertices); + pathGenerator.addPathGenerator(randomAllEdges); + + ExecutionContext context = new ExecutionContext(model, pathGenerator); + Machine machine = new SimpleMachine(context); + Assert.assertNull(context.getCurrentElement()); + + Element element = null; + Assert.assertTrue(pathGenerator.hasNextStep(context)); + + Assert.assertThat(pathGenerator.getNextStep(context).getName(), is("Start")); + Assert.assertThat(pathGenerator.getNextStep(context).getName(), is("E1")); + Assert.assertThat(pathGenerator.getNextStep(context).getName(), is("V1")); + Assert.assertThat(pathGenerator.getNextStep(context).getName(), is("E2")); + Assert.assertThat(pathGenerator.getNextStep(context).getName(), is("V2")); + Assert.assertTrue(pathGenerator.hasNextStep(context)); + Assert.assertThat(pathGenerator.getNextStep(context).getName(), is("E3")); + + Assert.assertFalse(pathGenerator.hasNextStep(context)); + Assert.assertNull(pathGenerator.getNextStep(context)); + } +} diff --git a/graphwalker-core/src/test/resources/models/DefaultTest.graphml b/graphwalker-core/src/test/resources/models/DefaultTest.graphml new file mode 100644 index 00000000..0b67a5a4 --- /dev/null +++ b/graphwalker-core/src/test/resources/models/DefaultTest.graphml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + diff --git a/graphwalker-core/src/test/resources/models/algorithms/blocked.graphml b/graphwalker-core/src/test/resources/models/algorithms/blocked.graphml new file mode 100644 index 00000000..e4adfc8e --- /dev/null +++ b/graphwalker-core/src/test/resources/models/algorithms/blocked.graphml @@ -0,0 +1,297 @@ + + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + + 1 + + + + + + + + + + + + 2 + + + + + + + + + + + + Goal + + + + + + + + + + + + 3 + + + + + + + + + + + + 6 + + + + + + + + + + + + 7 + + + + + + + + + + + + 8 + + + + + + + + + + + + 9 + + + + + + + + + + + + 4 + + + + + + + + + + + + 5 + + + + + + + + + + + + a + + + + + + + + + + + + b + + + + + + + + + + + + c + + + + + + + + + + + + d + + + + + + + + + + + + h + + + + + + + + + + + + i + + + + + + + + + + + + j + + + + + + + + + + + + k + + + + + + + + + + + + l + + + + + + + + + + + + e + + + + + + + + + + + + f + + + + + + + + + + + + g + + + + + + + + + diff --git a/graphwalker-core/src/test/resources/models/algorithms/simple.graphml b/graphwalker-core/src/test/resources/models/algorithms/simple.graphml new file mode 100644 index 00000000..e4adfc8e --- /dev/null +++ b/graphwalker-core/src/test/resources/models/algorithms/simple.graphml @@ -0,0 +1,297 @@ + + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + + 1 + + + + + + + + + + + + 2 + + + + + + + + + + + + Goal + + + + + + + + + + + + 3 + + + + + + + + + + + + 6 + + + + + + + + + + + + 7 + + + + + + + + + + + + 8 + + + + + + + + + + + + 9 + + + + + + + + + + + + 4 + + + + + + + + + + + + 5 + + + + + + + + + + + + a + + + + + + + + + + + + b + + + + + + + + + + + + c + + + + + + + + + + + + d + + + + + + + + + + + + h + + + + + + + + + + + + i + + + + + + + + + + + + j + + + + + + + + + + + + k + + + + + + + + + + + + l + + + + + + + + + + + + e + + + + + + + + + + + + f + + + + + + + + + + + + g + + + + + + + + + diff --git a/graphwalker-core/src/test/resources/models/annotationModel.graphml b/graphwalker-core/src/test/resources/models/annotationModel.graphml new file mode 100644 index 00000000..b75edccc --- /dev/null +++ b/graphwalker-core/src/test/resources/models/annotationModel.graphml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + + + v_vertex + + + + + + + + + + + + + + + + e_edge + + + + + + + + + + diff --git a/graphwalker-core/src/test/resources/models/brokenModel.graphml b/graphwalker-core/src/test/resources/models/brokenModel.graphml new file mode 100644 index 00000000..08982a9f --- /dev/null +++ b/graphwalker-core/src/test/resources/models/brokenModel.graphml @@ -0,0 +1 @@ +This file contains no model, it's used for testing ModelFactory exceptions \ No newline at end of file diff --git a/graphwalker-core/src/test/resources/models/edgeFilterModelA.graphml b/graphwalker-core/src/test/resources/models/edgeFilterModelA.graphml new file mode 100644 index 00000000..8edc9f23 --- /dev/null +++ b/graphwalker-core/src/test/resources/models/edgeFilterModelA.graphml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + v_0 +SWITCH_MODEL(m2) + + + + + + + + + + + / isDone = false + + + + + + + + + diff --git a/graphwalker-core/src/test/resources/models/edgeFilterModelB.graphml b/graphwalker-core/src/test/resources/models/edgeFilterModelB.graphml new file mode 100644 index 00000000..b90849f2 --- /dev/null +++ b/graphwalker-core/src/test/resources/models/edgeFilterModelB.graphml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + v_0 + + + + + + + + + + + v_1 +SWITCH_MODEL(m3) + + + + + + + + + + + Done + + + + + + + + + + + + + + + + + + + + + [false == isDone] + + + + + + + + + + + [isDone == true] + + + + + + + + + + + + + + BLOCKED + + + + + + + + + diff --git a/graphwalker-core/src/test/resources/models/edgeFilterModelC.graphml b/graphwalker-core/src/test/resources/models/edgeFilterModelC.graphml new file mode 100644 index 00000000..4c0aed01 --- /dev/null +++ b/graphwalker-core/src/test/resources/models/edgeFilterModelC.graphml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + v_0 +SWITCH_MODEL(m2) + + + + + + + + + + + / isDone = true + + + + + + + + + diff --git a/graphwalker-core/src/test/resources/models/graphwalker.graphml b/graphwalker-core/src/test/resources/models/graphwalker.graphml new file mode 100644 index 00000000..72d52ca1 --- /dev/null +++ b/graphwalker-core/src/test/resources/models/graphwalker.graphml @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + validate + + + + + + + + + + + + + + + + + + + + + + + create + + + + + + + + + + + + + + + addModel + + + + + + + + + + + + + + + + addVertex + + + + + + + + + + + + + + + updateModel + + + + + + + + + + + + + + + + execution + + + + + + + + + + + + + + + + addEdge + + + + + + + + + + + + + + + + changeStopCondition + + + + + + + + + + + + + + + + changePathGenerator + + + + + + + + + diff --git a/graphwalker-core/src/test/resources/models/keywords.graphml b/graphwalker-core/src/test/resources/models/keywords.graphml new file mode 100644 index 00000000..7541f622 --- /dev/null +++ b/graphwalker-core/src/test/resources/models/keywords.graphml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + v_verify +/*a vertex comment*/ +REQ(123) + + + + + + + + + + + /* comment */ + + + + + + + + + + + + + + + e_execute0 /test1 =1; test2= 2; [test3 == 3] + + + + + + + + + + + + + + e_execute1/test =1 + + + + + + + + + + + + + + + e_execute3 / test3 = 1 BLOCKED [test1 != 0] + + + + + + + + + + + + + + + e_execute4 /* another comment */ BLOCKED + + + + + + + + + diff --git a/graphwalker-core/src/test/resources/models/multiModelA.graphml b/graphwalker-core/src/test/resources/models/multiModelA.graphml new file mode 100644 index 00000000..0124106c --- /dev/null +++ b/graphwalker-core/src/test/resources/models/multiModelA.graphml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + v_0 + + + + + + + + + + + + v_1 +SWITCH_MODEL(m2) + + + + + + + + + + + e_0 + + + + + + + + + + + e_1 + + + + + + + + + diff --git a/graphwalker-core/src/test/resources/models/multiModelB.graphml b/graphwalker-core/src/test/resources/models/multiModelB.graphml new file mode 100644 index 00000000..972a6299 --- /dev/null +++ b/graphwalker-core/src/test/resources/models/multiModelB.graphml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + v_0 + + + + + + + + + + + + v_1 +SWITCH_MODEL(m3) + + + + + + + + + + + e_0 + + + + + + + + + + + e_1 + + + + + + + + + diff --git a/graphwalker-core/src/test/resources/models/multiModelC.graphml b/graphwalker-core/src/test/resources/models/multiModelC.graphml new file mode 100644 index 00000000..d4ec3386 --- /dev/null +++ b/graphwalker-core/src/test/resources/models/multiModelC.graphml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + v_0 + + + + + + + + + + + + v_1 +SWITCH_MODEL(m1) + + + + + + + + + + + e_0 + + + + + + + + + + + e_1 + + + + + + + + + diff --git a/graphwalker-core/src/test/resources/models/requirementBacktrackingModel.graphml b/graphwalker-core/src/test/resources/models/requirementBacktrackingModel.graphml new file mode 100644 index 00000000..3a9ae154 --- /dev/null +++ b/graphwalker-core/src/test/resources/models/requirementBacktrackingModel.graphml @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + REQ(R1) + + + + + + + + + + + REQ(R5) + + + + + + + + + + + REQ(R2) + + + + + + + + + + + REQ(R6) + + + + + + + + + + + REQ(R7) + + + + + + + + + + + v_fail +REQ(R3) + + + + + + + + + + + REQ(R4) + + + + + + + + + + + Not_reached + + + + + + + + + + + + + + + + + + + + + [binding.variables.containsKey("testedBadBranch")] + + + + + + + + + + + / testedBadBranch = 1; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/graphwalker-core/src/test/resources/models/requirementModel.graphml b/graphwalker-core/src/test/resources/models/requirementModel.graphml new file mode 100644 index 00000000..0925d5ed --- /dev/null +++ b/graphwalker-core/src/test/resources/models/requirementModel.graphml @@ -0,0 +1,346 @@ + + + + + + + + + + + + + + + + + + + + + + + REQ(Q2) + + + + + + + + + + + v_1 +REQ(Q1) + + + + + + + + + + + REQ(Q3) + + + + + + + + + + + REQ(Q4) + + + + + + + + + + + v_2 +REQ(Q5) + + + + + + + + + + + REQ(Q6) + + + + + + + + + + + REQ(Q7) + + + + + + + + + + + REQ(Q8) + + + + + + + + + + + v_3 +REQ(Q9) + + + + + + + + + + + Start + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/graphwalker-core/src/test/resources/models/singleModel.graphml b/graphwalker-core/src/test/resources/models/singleModel.graphml new file mode 100644 index 00000000..1cae1215 --- /dev/null +++ b/graphwalker-core/src/test/resources/models/singleModel.graphml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + v_0 + + + + + + + + + + + v_1 + + + + + + + + + + + v_2 + + + + + + + + + + + v_3 + + + + + + + + + + + e_0 + + + + + + + + + + + e_1 + + + + + + + + + + + e_2 + + + + + + + + + + + e_3 + + + + + + + + + + + + + + + + + + + diff --git a/graphwalker-example/pom.xml b/graphwalker-example/pom.xml new file mode 100644 index 00000000..29d1ad28 --- /dev/null +++ b/graphwalker-example/pom.xml @@ -0,0 +1,70 @@ + + + 4.0.0 + + org.graphwalker + graphwalker-example + 3.0-BETA-SNAPSHOT + GraphWalker Example + + + UTF-8 + UTF-8 + + + + + + org.graphwalker + graphwalker-maven-plugin + ${project.version} + + + generate-test-sources + generate-test-sources + + generate-test-sources + + + + + + *Amazon + shortest + + + + + + + + org.graphwalker + graphwalker-core + ${project.version} + + + org.seleniumhq.selenium + selenium-java + 2.41.0 + + + junit + junit + 4.10 + + + org.codehaus.groovy + groovy-jsr223 + 2.3.0-beta-2 + + + + \ No newline at end of file diff --git a/graphwalker-example/src/test/java/org/graphwalker/example/AbstractTest.java b/graphwalker-example/src/test/java/org/graphwalker/example/AbstractTest.java new file mode 100644 index 00000000..a6995710 --- /dev/null +++ b/graphwalker-example/src/test/java/org/graphwalker/example/AbstractTest.java @@ -0,0 +1,58 @@ +package org.graphwalker.example; + +import org.graphwalker.core.annotation.AfterExecution; +import org.graphwalker.core.annotation.ExceptionHandler; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.safari.SafariDriver; +import org.openqa.selenium.support.ui.ExpectedCondition; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; + +import java.util.concurrent.TimeUnit; + +public abstract class AbstractTest { + + private final static int TIMEOUT = 5; + + private WebDriver driver = null; + + protected WebDriver getDriver() { + if (null == driver) { + if (System.getProperty("os.name").toUpperCase().contains("MAC")) { + driver = new SafariDriver(); + } else { + driver = new FirefoxDriver(); + } + driver.manage().timeouts().implicitlyWait(TIMEOUT, TimeUnit.SECONDS); + } + return driver; + } + + protected boolean verifyTextPresent(final By locator, final String text) { + return new WebDriverWait(driver, TIMEOUT).until(ExpectedConditions.textToBePresentInElement(locator, text)); + } + + protected boolean verifyTitle(final String regexp) { + return new WebDriverWait(driver, TIMEOUT).until(new ExpectedCondition() { + public Boolean apply(WebDriver driver) { + return driver.getTitle().matches(regexp); + } + }); + } + + + @AfterExecution + public void tearDown() { + if (null != driver) { + driver.quit(); + } + } + + @ExceptionHandler + public void handleException() { + tearDown(); + } + +} diff --git a/graphwalker-example/src/test/java/org/graphwalker/example/Amazon.java b/graphwalker-example/src/test/java/org/graphwalker/example/Amazon.java new file mode 100644 index 00000000..cd90bdf0 --- /dev/null +++ b/graphwalker-example/src/test/java/org/graphwalker/example/Amazon.java @@ -0,0 +1,120 @@ +package org.graphwalker.example; + +import org.graphwalker.core.annotation.Execute; +import org.graphwalker.core.annotation.GraphWalker; +import org.graphwalker.core.common.Assert; +import org.graphwalker.core.condition.EdgeCoverage; +import org.graphwalker.core.condition.ReachedVertex; +import org.graphwalker.core.generator.AStarPath; +import org.graphwalker.core.generator.RandomPath; +import org.graphwalker.core.script.ScriptContext; +import org.graphwalker.example.models.ShoppingCart; +import org.openqa.selenium.By; + +@GraphWalker({ + @Execute(pathGenerator = AStarPath.class + , stopCondition = ReachedVertex.class + , stopConditionValue = "v_ShoppingCart"), + + @Execute(group = "shortest" + , pathGenerator = AStarPath.class + , stopCondition = ReachedVertex.class + , stopConditionValue = "v_ShoppingCart" + , language = "groovy"), + + @Execute(group = "random" + , pathGenerator = RandomPath.class + , stopCondition = EdgeCoverage.class + , stopConditionValue = "100") +}) +public class Amazon extends AbstractTest implements ShoppingCart { + + @Override + public void e_ShoppingCart(ScriptContext context) { + getDriver().findElement(By.id("nav-cart")).click(); + } + + @Override + public void v_BrowserStarted(ScriptContext context) { + Assert.assertNotNull(getDriver()); + } + + @Override + public void v_OtherBoughtBooks(ScriptContext context) { + Assert.assertTrue(verifyTextPresent(By.id("hlb-upsell"), "Customers Also Bought these Highly Rated Items")); + } + + @Override + public void e_EnterBaseURL(ScriptContext context) { + getDriver().get("http://www.amazon.com"); + } + + @Override + public void e_AddBookToCart(ScriptContext context) { + getDriver().findElement(By.id("bb_atc_button")).click(); + } + + @Override + public void e_SearchBook(ScriptContext context) { + getDriver().findElement(By.id("twotabsearchtextbox")).clear(); + getDriver().findElement(By.id("twotabsearchtextbox")).sendKeys("Model-based testing"); + getDriver().findElement(By.id("twotabsearchtextbox")).submit(); + } + + @Override + public void e_StartBrowser(ScriptContext context) { + getDriver(); + } + + @Override + public void v_BookInformation(ScriptContext context) { + } + + @Override + public void v_ShoppingCart(ScriptContext context) { + Assert.assertTrue(verifyTitle("^Amazon\\.com Shopping Cart.*")); + Integer expected_num_of_books = (Integer) context.getAttribute("num_of_books"); + if (expected_num_of_books.equals(0)) { + Assert.assertTrue(verifyTextPresent(By.id("sc-active-cart"), "Your Shopping Cart is empty")); + } else { + Integer actual_num_of_books = Integer.parseInt(getDriver().findElement(By.id("nav-cart-count")).getText()); + Assert.assertEquals(expected_num_of_books, actual_num_of_books); + } + } + + @Override + public void v_SearchResult(ScriptContext context) { + Assert.assertNotNull(getDriver().findElement(By.linkText("Practical Model-Based Testing: A Tools Approach"))); + } + + @Override + public void v_BaseURL(ScriptContext context) { + Assert.assertTrue(verifyTitle("^Amazon\\.com:.*$")); + Integer num_of_books = Integer.parseInt(getDriver().findElement(By.id("nav-cart-count")).getText()); + if (!num_of_books.equals(context.getAttribute("num_of_books"))) { + context.setAttribute("num_of_books", num_of_books); + } + } + + @Override + public void e_ClickBook(ScriptContext context) { + getDriver().findElement(By.linkText("Practical Model-Based Testing: A Tools Approach")).click(); + } + + @Override + public void v_ClearShoppingCart(ScriptContext context) { + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + e.printStackTrace(); // To change body of catch statement use File | Settings | File Templates. + } + Assert.assertEquals(Integer.parseInt(getDriver().findElement(By.id("nav-cart-count")).getText()), 0); + } + + @Override + public void e_ClearShoppingCart(ScriptContext context) { + getDriver().findElement(By.id("nav-cart")).click(); + getDriver().findElement(By.linkText("Delete")).click(); + } + +} \ No newline at end of file diff --git a/graphwalker-example/src/test/java/org/graphwalker/example/Google.java b/graphwalker-example/src/test/java/org/graphwalker/example/Google.java new file mode 100644 index 00000000..1e405e2b --- /dev/null +++ b/graphwalker-example/src/test/java/org/graphwalker/example/Google.java @@ -0,0 +1,48 @@ +package org.graphwalker.example; + +import org.graphwalker.core.annotation.GraphWalker; +import org.graphwalker.core.common.Assert; +import org.graphwalker.core.script.ScriptContext; +import org.graphwalker.example.models.google.GoogleStart; +import org.graphwalker.example.models.google.SearchImage; +import org.graphwalker.example.models.google.SearchText; +import org.graphwalker.example.models.google.SearchYoutube; +import org.openqa.selenium.By; + +@GraphWalker +public class Google extends AbstractTest implements GoogleStart, SearchText, SearchImage, SearchYoutube { + + @Override + public void e_SearchImage(ScriptContext context) { + getDriver().findElement(By.id("gb_2")).click(); + getDriver().findElement(By.id("lst-ib")).sendKeys("model based test framework"); + getDriver().findElement(By.id("tsf")).submit(); + } + + @Override + public void v_Google(ScriptContext context) { + } + + @Override + public void v_Search(ScriptContext context) { + Assert.assertFalse(true); + } + + @Override + public void e_VisitGoogle(ScriptContext context) { + getDriver().get("http://www.google.se"); + } + + @Override + public void e_SearchYoutube(ScriptContext context) { + getDriver().findElement(By.id("gb_36")).click(); + getDriver().findElement(By.id("masthead-search-term")).sendKeys("model based test framework"); + getDriver().findElement(By.id("masthead-search")).submit(); + } + + @Override + public void e_SearchText(ScriptContext context) { + getDriver().findElement(By.id("gbqfq")).sendKeys("model based test framework"); + getDriver().findElement(By.id("gbqf")).submit(); + } +} diff --git a/graphwalker-example/src/test/resources/org/graphwalker/example/models/ShoppingCart.graphml b/graphwalker-example/src/test/resources/org/graphwalker/example/models/ShoppingCart.graphml new file mode 100644 index 00000000..62849c91 --- /dev/null +++ b/graphwalker-example/src/test/resources/org/graphwalker/example/models/ShoppingCart.graphml @@ -0,0 +1,339 @@ + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + + + v_BrowserStarted + + + + + + + + + + + + + v_BaseURL +REQ(UC01 2.2.0) +REQ(UC01 2.2.1) + + + + + + + + + + + + + v_SearchResult +REQ(UC01 2.2.2) + + + + + + + + + + + + + v_BookInformation +REQ(UC01 2.2.3) + + + + + + + + + + + + + v_OtherBoughtBooks + + + + + + + + + + + + + v_ShoppingCart +REQ(UC01 2.3) + + + + + + + + + + + + + v_ClearShoppingCart + + + + + + + + + + + + + + e_StartBrowser / num_of_books = 0i; + + + + + + + + + + + + + e_EnterBaseURL + + + + + + + + + + + + + e_SearchBook [num_of_books == 0] + + + + + + + + + + + + + e_ClickBook + + + + + + + + + + + + + + + + e_AddBookToCart [num_of_books<=3] / num_of_books++; + + + + + + + + + + + + + + + + e_ShoppingCart + + + + + + + + + + + + + + + + + + e_ShoppingCart + + + + + + + + + + + + + e_ShoppingCart + + + + + + + + + + + + + + + + + + e_SearchBook + + + + + + + + + + + + + + + + + + e_SearchBook + + + + + + + + + + + + + + + + + + e_SearchBook + + + + + + + + + + + + + e_EnterBaseURL + + + + + + + + + + + + + + + + + + + + + e_ClearShoppingCart [num_of_books > 0] + + + + + + + + + + + + + + + + diff --git a/graphwalker-example/src/test/resources/org/graphwalker/example/models/google/GoogleStart.graphml b/graphwalker-example/src/test/resources/org/graphwalker/example/models/google/GoogleStart.graphml new file mode 100644 index 00000000..dbd2faf2 --- /dev/null +++ b/graphwalker-example/src/test/resources/org/graphwalker/example/models/google/GoogleStart.graphml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + + + + + + + v_Google + + + + + + + + + + + + + + + + + e_VisitGoogle + + + + + + + + + + + + + + + + diff --git a/graphwalker-example/src/test/resources/org/graphwalker/example/models/google/SearchImage.graphml b/graphwalker-example/src/test/resources/org/graphwalker/example/models/google/SearchImage.graphml new file mode 100644 index 00000000..a846f961 --- /dev/null +++ b/graphwalker-example/src/test/resources/org/graphwalker/example/models/google/SearchImage.graphml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + v_Google + + + + + + + + + + + + + + + + + v_Search + + + + + + + + + + + + + + + + + e_SearchImage + + + + + + + + + + + + + + + + + + e_VisitGoogle + + + + + + + + + + + + + + + + diff --git a/graphwalker-example/src/test/resources/org/graphwalker/example/models/google/SearchText.graphml b/graphwalker-example/src/test/resources/org/graphwalker/example/models/google/SearchText.graphml new file mode 100644 index 00000000..ff01c870 --- /dev/null +++ b/graphwalker-example/src/test/resources/org/graphwalker/example/models/google/SearchText.graphml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + v_Google + + + + + + + + + + + + + + + + + v_Search + + + + + + + + + + + + + + + + + e_SearchText + + + + + + + + + + + + + + + + + + e_VisitGoogle + + + + + + + + + + + + + + + + diff --git a/graphwalker-example/src/test/resources/org/graphwalker/example/models/google/SearchYoutube.graphml b/graphwalker-example/src/test/resources/org/graphwalker/example/models/google/SearchYoutube.graphml new file mode 100644 index 00000000..6e6ff1ef --- /dev/null +++ b/graphwalker-example/src/test/resources/org/graphwalker/example/models/google/SearchYoutube.graphml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + v_Google + + + + + + + + + + + + + + + + + v_Search + + + + + + + + + + + + + + + + + e_SearchYoutube + + + + + + + + + + + + + + + + + + e_VisitGoogle + + + + + + + + + + + + + + + + diff --git a/graphwalker-io/pom.xml b/graphwalker-io/pom.xml new file mode 100644 index 00000000..1a21ed39 --- /dev/null +++ b/graphwalker-io/pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + + + org.graphwalker + graphwalker + 3.0-BETA-SNAPSHOT + + + graphwalker-io + GraphWalker Input/Output + + + + org.graphwalker + graphwalker-core + ${project.version} + + + org.jdom + jdom + 1.1 + + + org.apache.commons + commons-io + 1.3.2 + + + junit + junit + 4.11 + test + + + + \ No newline at end of file diff --git a/graphwalker-io/src/main/java/org/graphwalker/io/common/ResourceException.java b/graphwalker-io/src/main/java/org/graphwalker/io/common/ResourceException.java new file mode 100644 index 00000000..7424f5af --- /dev/null +++ b/graphwalker-io/src/main/java/org/graphwalker/io/common/ResourceException.java @@ -0,0 +1,49 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2012 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.io.common; + +/** + * @author Nils Olsson + */ +public class ResourceException extends RuntimeException { + + + /** + *

Constructor for ResourceException.

+ */ + public ResourceException() { + super(); + } + + /** + *

Constructor for ResourceException.

+ * + * @param cause a {@link java.lang.String} object. + */ + public ResourceException(String cause) { + super(cause); + } +} diff --git a/graphwalker-io/src/main/java/org/graphwalker/io/common/ResourceUtils.java b/graphwalker-io/src/main/java/org/graphwalker/io/common/ResourceUtils.java new file mode 100644 index 00000000..db037664 --- /dev/null +++ b/graphwalker-io/src/main/java/org/graphwalker/io/common/ResourceUtils.java @@ -0,0 +1,168 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2012 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.io.common; + +import org.graphwalker.core.Bundle; + +import javax.imageio.ImageIO; +import javax.swing.*; +import java.io.*; +import java.net.URL; +import java.text.MessageFormat; +import java.util.Locale; +import java.util.ResourceBundle; + +/** + * @author Nils Olsson + */ +public final class ResourceUtils { + + private ResourceUtils() { + } + + /** + *

getText.

+ * + * @param bundle a {@link java.lang.String} object. + * @param key a {@link java.lang.String} object. + * @param params a {@link java.lang.String} object. + * @return a {@link java.lang.String} object. + */ + public static String getText(final String bundle, final String key, final Object... params) { + return getText(bundle, Locale.getDefault(), key, params); + } + + /** + *

getText.

+ * + * @param bundle a {@link java.lang.String} object. + * @param key a {@link java.lang.String} object. + * @param locale a {@link java.util.Locale} object. + * @param params a {@link java.lang.String} object. + * @return a {@link java.lang.String} object. + */ + public static String getText(final String bundle, final Locale locale, final String key, final Object... params) { + String message = ResourceBundle.getBundle(bundle, locale).getString(key); + if (null != message) { + MessageFormat messageFormat = new MessageFormat(""); + messageFormat.setLocale(locale); + messageFormat.applyPattern(message); + return messageFormat.format(params); + } + throw new ResourceException(); + } + + /** + *

getResourceAsIcon.

+ * + * @param bundle a {@link java.lang.String} object. + * @param key a {@link java.lang.String} object. + * @return a {@link javax.swing.Icon} object. + */ + public static Icon getResourceAsIcon(final String bundle, final String key) { + return getResourceAsIcon(getText(bundle, key)); + } + + /** + *

getResourceAsIcon.

+ * + * @param filename a {@link java.lang.String} object. + * @return a {@link javax.swing.Icon} object. + */ + public static Icon getResourceAsIcon(final String filename) { + File file = createFile(filename); + if (file.exists()) { + return new ImageIcon(file.getPath()); + } else { + try { + return new ImageIcon(ImageIO.read(getResourceAsStream(file.getPath()))); + } catch (IOException e) { + throw new ResourceException(getText(Bundle.NAME, "exception.file.missing", filename)); + } + } + } + + /** + *

getResourceAsFile.

+ * + * @param filename a {@link java.lang.String} object. + * @return a {@link java.io.File} object. + */ + public static File getResourceAsFile(final String filename) { + File file = createFile(filename); + if (file.exists()) { + return file; + } else { + URL resource = ResourceUtils.class.getResource(filename); + if (null == resource) { + resource = Thread.currentThread().getContextClassLoader().getResource(filename); + } + if (null != resource) { + return new File(resource.getFile()); + } + throw new ResourceException(getText(Bundle.NAME, "exception.file.missing", filename)); + } + } + + /** + *

getResourceAsStream.

+ * + * @param filename a {@link java.lang.String} object. + * @return a {@link java.io.InputStream} object. + */ + public static InputStream getResourceAsStream(final String filename) { + File file = createFile(filename); + if (file.exists()) { + try { + return new FileInputStream(file); + } catch (FileNotFoundException e) { + throw new ResourceException(getText(Bundle.NAME, "exception.file.missing", filename)); + } + } else { + InputStream resource = ResourceUtils.class.getResourceAsStream(filename); + if (null == resource) { + resource = Thread.currentThread().getContextClassLoader().getResourceAsStream(filename); + } + if (null != resource) { + return resource; + } + throw new ResourceException(getText(Bundle.NAME, "exception.file.missing", filename)); + } + } + + private static String[] splitPath(String filename) { + return filename.split("[\\\\/]"); + } + + private static File createFile(String filename) { + File createdFile = null; + for (String part : splitPath(filename)) { + createdFile = new File(createdFile, part); + } + return createdFile; + } + +} diff --git a/graphwalker-io/src/main/java/org/graphwalker/io/factory/AbstractModelFactory.java b/graphwalker-io/src/main/java/org/graphwalker/io/factory/AbstractModelFactory.java new file mode 100644 index 00000000..e6085243 --- /dev/null +++ b/graphwalker-io/src/main/java/org/graphwalker/io/factory/AbstractModelFactory.java @@ -0,0 +1,57 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.io.factory; + + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +/** + * @author Nils Olsson + */ +public abstract class AbstractModelFactory implements ModelFactory { + + private final Set supportedTypes = new HashSet(); + + /** + *

Constructor for AbstractModelFactory.

+ * + * @param types a {@link java.lang.String} object. + */ + public AbstractModelFactory(String... types) { + Collections.addAll(supportedTypes, types); + } + + /** + *

getSupportedFileTypes.

+ * + * @return a {@link java.util.Set} object. + */ + public Set getSupportedFileTypes() { + return supportedTypes; + } +} diff --git a/graphwalker-io/src/main/java/org/graphwalker/io/factory/GraphMLModelFactory.java b/graphwalker-io/src/main/java/org/graphwalker/io/factory/GraphMLModelFactory.java new file mode 100644 index 00000000..ef360d9f --- /dev/null +++ b/graphwalker-io/src/main/java/org/graphwalker/io/factory/GraphMLModelFactory.java @@ -0,0 +1,270 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2012 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.io.factory; + +import org.apache.commons.io.FileUtils; +import org.graphwalker.core.Bundle; +import org.graphwalker.core.Model; +import org.graphwalker.core.SimpleModel; +import org.graphwalker.io.common.ResourceException; +import org.graphwalker.io.common.ResourceUtils; +import org.graphwalker.core.model.*; +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.filter.ElementFilter; +import org.jdom.input.SAXBuilder; + +import java.io.InputStream; +import java.nio.file.Path; +import java.io.*; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author Nils Olsson + */ +public final class GraphMLModelFactory extends AbstractModelFactory { + + // TODO: Update support for keywords + + private static final String FILE_TYPE = "graphml"; + private Map vertexNames = new HashMap(); + /** + *

Constructor for GraphmlModelFactory.

+ */ + public GraphMLModelFactory() { + super("**/*.graphml"); + } + + /** {@inheritDoc} */ + public boolean accept(Path path) { + return path.toFile().toString().endsWith(FILE_TYPE); + } + + /** {@inheritDoc} */ + public boolean validate(Path path) { + return true; // TODO: implement + } + + /** + * {@inheritDoc} + *

+ *

create.

+ */ + public Model create(String filename) { + try { + File file = ResourceUtils.getResourceAsFile(filename); + if (file.isDirectory()) { + Model model = new SimpleModel(false); + for (Object fileObject : FileUtils.listFiles(file, new String[]{FILE_TYPE}, true)) { + model = model.addModel(parse(new FileInputStream((File) fileObject)), false); + } + model.refresh(); + return model; + } else { + return parse(new FileInputStream(file)); + } + } catch (Exception e) { + try { + return parse(ResourceUtils.getResourceAsStream(filename)); + } catch (ResourceException x) { + throw new ModelFactoryException(x); + } + } + } + + private Model parse(InputStream inputStream) { + SAXBuilder saxBuilder = new SAXBuilder(); + Document document; + + try { + document = saxBuilder.build(inputStream); + } catch (Exception e) { + throw new ModelFactoryException(e); + } + + Model model = new SimpleModel(); + + if (null != document) { + for (Iterator nodeElements = document.getDescendants(new ElementFilter("node")); nodeElements.hasNext(); ) { + Element nodeElement = (Element) nodeElements.next(); + String text = null; + for (Iterator nodeLabels = nodeElement.getDescendants(new ElementFilter("NodeLabel")); nodeLabels.hasNext(); ) { + Element nodeLabel = (Element) nodeLabels.next(); + text = nodeLabel.getTextTrim(); + } + String vertexId = nodeElement.getAttribute("id").getValue(); + model = parseVertex(model, vertexId, text); + } + for (Iterator edgeElements = document.getDescendants(new ElementFilter("edge")); edgeElements.hasNext(); ) { + Element edgeElement = (Element) edgeElements.next(); + Vertex source = model.getVertex(vertexNames.get(edgeElement.getAttributeValue("source"))); + Vertex target = model.getVertex(vertexNames.get(edgeElement.getAttributeValue("target"))); + String text = null; + for (Iterator edgeLabels = edgeElement.getDescendants(new ElementFilter("EdgeLabel")); edgeLabels.hasNext(); ) { + Element edgeLabel = (Element) edgeLabels.next(); + text = edgeLabel.getTextTrim(); + } + String edgeId = edgeElement.getAttribute("id").getValue(); + model = parseEdge(model, edgeId, source, target, text); + } + } + return model; + } + + private Model parseVertex(Model model, String id, String text) { + String name = null, switchModelId = null, comment = null; + Boolean blocked = false; + Set requirements = new HashSet<>(); + if (null != text && !"".equals(text)) { + Tupel commentTupel = parseComment(text); + comment = commentTupel.getValue(); + Tupel blockedTupel = parseBlocked(commentTupel.getReminder()); + blocked = blockedTupel.getValue(); + Tupel switchModelIdTupel = parseSwitchModelId(commentTupel.getReminder()); + switchModelId = switchModelIdTupel.getValue(); + Tupel, String> requirementsTupel = parseRequirements(switchModelIdTupel.getReminder()); + requirements = requirementsTupel.getValue(); + name = getLabel(requirementsTupel.getReminder()); + } + vertexNames.put(id, name); + return model.addVertex(new Vertex(name, requirements)); //, blocked, comment, switchModelId, )); + } + + private Tupel parseComment(String text) { + Pattern pattern = Pattern.compile("/\\*.*\\*/", Pattern.MULTILINE); + Matcher matcher = pattern.matcher(text); + String comment = ""; + if (matcher.find()) { + comment = matcher.group(0); + } + return new Tupel(comment, matcher.replaceAll("").trim()); + } + + private Tupel parseSwitchModelId(String text) { + Pattern pattern = Pattern.compile(ResourceUtils.getText(Bundle.NAME, "label.switch.model") + "\\s*\\((.*)\\)", Pattern.MULTILINE); + Matcher matcher = pattern.matcher(text); + String switchModelId = ""; + if (matcher.find()) { + switchModelId = matcher.group(1); + } + return new Tupel(switchModelId, matcher.replaceAll("").trim()); + } + + private Tupel, String> parseRequirements(String text) { + Pattern pattern = Pattern.compile(ResourceUtils.getText(Bundle.NAME, "label.requirement") + "\\s*\\((.*)\\)", Pattern.MULTILINE); + Matcher matcher = pattern.matcher(text); + Set requirements = new HashSet(); + while (matcher.find()) { + String id = matcher.group(1); + requirements.add(new Requirement(id)); + } + return new Tupel, String>(requirements, matcher.replaceAll("").trim()); + } + + private String getLabel(String text) { + Pattern pattern = Pattern.compile("(\\w+)"); + Matcher matcher = pattern.matcher(text); + if (matcher.find()) { + return matcher.group(1); + } + return null; + } + + private Model parseEdge(Model model, String id, Vertex source, Vertex target, String text) { + String name = null, comment = null; + Boolean blocked = false; + Guard guard = new Guard("true"); + Set actions = new HashSet(); + if (null != text && !"".equals(text)) { + Tupel commentTupel = parseComment(text); + comment = commentTupel.getValue(); + Tupel blockedTupel = parseBlocked(commentTupel.getReminder()); + blocked = blockedTupel.getValue(); + Tupel guardTupel = parseEdgeGuard(blockedTupel.getReminder()); + guard = guardTupel.getValue(); + Tupel, String> actionsTupel = parseEdgeActions(guardTupel.getReminder()); + actions = actionsTupel.getValue(); + name = getLabel(actionsTupel.getReminder()); + } + return model.addEdge(new Edge(name, source, target, guard, actions, blocked, 1.0d)); + } + + private Tupel parseBlocked(String text) { + Pattern pattern = Pattern.compile(ResourceUtils.getText(Bundle.NAME, "label.blocked"), Pattern.MULTILINE); + Matcher matcher = pattern.matcher(text); + Boolean blocked = false; + if (matcher.find()) { + blocked = true; + } + return new Tupel(blocked, matcher.replaceAll("").trim()); + } + + private Tupel parseEdgeGuard(String text) { + Pattern pattern = Pattern.compile("\\[(.+)\\]", Pattern.DOTALL); + Matcher matcher = pattern.matcher(text); + Guard guard = new Guard("true"); + if (matcher.find()) { + String script = matcher.group(1).trim(); + guard = new Guard(script); + } + return new Tupel(guard, matcher.replaceAll("").trim()); + } + + private Tupel, String> parseEdgeActions(String text) { + Pattern pattern = Pattern.compile("/([^\\[]+)"); + Matcher matcher = pattern.matcher(text); + Set actions = new HashSet(); + if (matcher.find()) { + for (String action : matcher.group(1).split(";")) { + String script = action.trim(); + actions.add(new Action(script)); + } + } + return new Tupel, String>(actions, matcher.replaceAll("").trim()); + } + + private class Tupel { + + private final V value; + private final R reminder; + + private Tupel(V value, R reminder) { + this.value = value; + this.reminder = reminder; + } + + private V getValue() { + return value; + } + + public R getReminder() { + return reminder; + } + } + +} diff --git a/graphwalker-io/src/main/java/org/graphwalker/io/factory/ModelFactory.java b/graphwalker-io/src/main/java/org/graphwalker/io/factory/ModelFactory.java new file mode 100644 index 00000000..f95cc6dc --- /dev/null +++ b/graphwalker-io/src/main/java/org/graphwalker/io/factory/ModelFactory.java @@ -0,0 +1,68 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.io.factory; + +import org.graphwalker.core.Model; + +import java.nio.file.Path; +import java.util.Set; + +/** + * @author Nils Olsson + */ +public interface ModelFactory { + + /** + *

accept.

+ * + * @param path a {@link java.nio.file.Path} object. + * @return a boolean. + */ + boolean accept(Path path); + + /** + *

validate.

+ * + * @param path a {@link java.nio.file.Path} object. + * @return a boolean. + */ + boolean validate(Path path); + + /** + *

create.

+ * + * @param path a {@link java.nio.file.Path} object. + * @return a {@link org.graphwalker.core.Model} object. + */ + Model create(String file); + + /** + *

getSupportedFileTypes.

+ * + * @return a {@link java.util.Set} object. + */ + Set getSupportedFileTypes(); +} diff --git a/graphwalker-io/src/main/java/org/graphwalker/io/factory/ModelFactoryException.java b/graphwalker-io/src/main/java/org/graphwalker/io/factory/ModelFactoryException.java new file mode 100644 index 00000000..de801f82 --- /dev/null +++ b/graphwalker-io/src/main/java/org/graphwalker/io/factory/ModelFactoryException.java @@ -0,0 +1,50 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2012 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.io.factory; + +/** + * @author Nils Olsson + */ +public class ModelFactoryException extends RuntimeException { + + /** + *

Constructor for ConfigurationException.

+ * + * @param e a {@link java.lang.Exception} object. + */ + public ModelFactoryException(Exception e) { + super(e); + } + + /** + *

Constructor for ConfigurationException.

+ * + * @param cause a {@link java.lang.String} object. + */ + public ModelFactoryException(String cause) { + super(cause); + } +} diff --git a/graphwalker-io/src/test/java/org/graphwalker/io/factory/GraphMLModelFactoryTest.java b/graphwalker-io/src/test/java/org/graphwalker/io/factory/GraphMLModelFactoryTest.java new file mode 100644 index 00000000..26eff804 --- /dev/null +++ b/graphwalker-io/src/test/java/org/graphwalker/io/factory/GraphMLModelFactoryTest.java @@ -0,0 +1,80 @@ +/* + * #%L + * GraphWalker Input/Output + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.io.factory; + +import org.graphwalker.core.Model; +import org.graphwalker.core.model.Edge; +import org.graphwalker.core.model.Guard; +import org.graphwalker.core.model.Vertex; +import org.junit.Assert; +import org.junit.Test; + +import static org.hamcrest.core.Is.is; + +public class GraphMLModelFactoryTest { + + @Test(expected = ModelFactoryException.class) + public void fileDoesNotExistsOnFileSystem() { + GraphMLModelFactory factory = new GraphMLModelFactory(); + Model model = factory.create("graphml/LKHDIODSOSUBD.graphml"); + } + + @Test + public void fileExistsOnFileSystem() { + GraphMLModelFactory factory = new GraphMLModelFactory(); + Model model = factory.create("src/test/resources/graphml/UC01.graphml"); + Assert.assertThat("Number of vertices", model.getVertices().size(), is(8)); + Assert.assertThat("Number of edges", model.getEdges().size(), is(12)); + } + + @Test + public void uc01() { + GraphMLModelFactory factory = new GraphMLModelFactory(); + Model model = factory.create("graphml/UC01.graphml"); + Assert.assertThat("Number of vertices", model.getVertices().size(), is(8)); + Assert.assertThat("Number of edges", model.getEdges().size(), is(12)); + } + + @Test + public void efsmWithReqtags() { + GraphMLModelFactory factory = new GraphMLModelFactory(); + Model model = factory.create("graphml/EFSM_with_REQTAGS.graphml"); + Assert.assertThat("Number of vertices", model.getVertices().size(), is(7)); + Assert.assertThat("Number of edges", model.getEdges().size(), is(19)); + } + + @Test + public void guards() { + GraphMLModelFactory factory = new GraphMLModelFactory(); + Model model = factory.create("graphml/Guards.graphml"); + Assert.assertThat("Number of vertices", model.getVertices().size(), is(3)); + Assert.assertThat("Number of edges", model.getEdges().size(), is(2)); + Vertex startVertex = model.getStartVertices().get(0); + Edge edgeWithGuard = model.getEdges(startVertex).get(0); + Assert.assertEquals(null, edgeWithGuard.getName()); + Assert.assertNotEquals(edgeWithGuard.getGuard(), new Guard("true")); + } +} diff --git a/src/test/resources/graphml/reqtags/ExtendedMain.graphml b/graphwalker-io/src/test/resources/graphml/EFSM_with_REQTAGS.graphml similarity index 100% rename from src/test/resources/graphml/reqtags/ExtendedMain.graphml rename to graphwalker-io/src/test/resources/graphml/EFSM_with_REQTAGS.graphml diff --git a/graphwalker-io/src/test/resources/graphml/Guards.graphml b/graphwalker-io/src/test/resources/graphml/Guards.graphml new file mode 100644 index 00000000..82ef01e1 --- /dev/null +++ b/graphwalker-io/src/test/resources/graphml/Guards.graphml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + End + + + + + + + + + + + + + + + + + + [isEthernetConnected() +&& !hasInternetConnection()] + + + + + + + + + + + + + + + + + + + [isEthernetConnected() +&& !hasInternetConnection()] + + + + + + + + + + + + + + + + diff --git a/graphwalker-io/src/test/resources/graphml/UC01.graphml b/graphwalker-io/src/test/resources/graphml/UC01.graphml new file mode 100644 index 00000000..e5e1f1ef --- /dev/null +++ b/graphwalker-io/src/test/resources/graphml/UC01.graphml @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + + + + Start + + + + + + + + + + + + v_BrowserStarted + + + + + + + + + + + + v_BaseURL + + + + + + + + + + + + v_SearchResult + + + + + + + + + + + + v_BrowserStopped + + + + + + + + + + + + v_BookInformation + + + + + + + + + + + + v_OtherBoughtBooks + + + + + + + + + + + + v_ShoppingCart + + + + + + + + + + + + e_init / num_of_books = 0; MAX_BOOKS = 5; + + + + + + + + + + + + e_EnterBaseURL + + + + + + + + + + + + e_SearchBook + + + + + + + + + + + + e_StartBrowser + + + + + + + + + + + + e_ClickBook + + + + + + + + + + + + + + + e_AddBookToCart [num_of_books<=MAX_BOOKS] / num_of_books++; + + + + + + + + + + + + + + + e_ShoppingCart + + + + + + + + + + + + + + + + + e_ShoppingCart + + + + + + + + + + + + e_ShoppingCart + + + + + + + + + + + + + + + + + e_SearchBook + + + + + + + + + + + + + + + + + e_SearchBook + + + + + + + + + + + + + + + + + e_SearchBook + + + + + + + + + + diff --git a/graphwalker-jenkins-plugin/pom.xml b/graphwalker-jenkins-plugin/pom.xml new file mode 100755 index 00000000..98341007 --- /dev/null +++ b/graphwalker-jenkins-plugin/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + + + org.jenkins-ci.plugins + plugin + 1.519 + + + + org.graphwalker + graphwalker-jenkins-plugin + 3.0-BETA-SNAPSHOT + GraphWalker Jenkins Plugin + hpi + + + UTF-8 + UTF-8 + + + + + repo.jenkins-ci.org + http://repo.jenkins-ci.org/public/ + + + + + + repo.jenkins-ci.org + http://repo.jenkins-ci.org/public/ + + + + + + org.graphwalker + graphwalker-core + ${project.version} + + + + org.jfree + jfreechart + 1.0.14 + + + + diff --git a/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/BuildAction.java b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/BuildAction.java new file mode 100755 index 00000000..4c4c24b2 --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/BuildAction.java @@ -0,0 +1,45 @@ +package org.graphwalker.jenkins.plugin; + +import hudson.model.AbstractBuild; +import hudson.model.Action; + +import java.text.DecimalFormat; + +public class BuildAction implements Action { + + private final AbstractBuild build; + + public BuildAction(AbstractBuild build) { + this.build = build; + } + + public AbstractBuild getBuild() { + return build; + } + + public String getIconFileName() { + return Messages.build_action_icon_file_name(); + } + + public String getDisplayName() { + return Messages.build_action_display_name(); + } + + public String getUrlName() { + return Messages.build_action_url_name(); + } + + public TestResult getResult() { + return build.getAction(ResultAction.class).getResult(); + } + + public String format(DecimalFormat decimalFormat, double value) { + if (value < 1d && value > .99d) { + return "<100%"; + } + if (value > 0d && value < .01d) { + return ">0%"; + } + return decimalFormat.format(value); + } +} diff --git a/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/Descriptor.java b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/Descriptor.java new file mode 100755 index 00000000..35e1451f --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/Descriptor.java @@ -0,0 +1,47 @@ +package org.graphwalker.jenkins.plugin; + +import hudson.model.AbstractProject; +import hudson.tasks.BuildStepDescriptor; +import net.sf.json.JSONObject; +import org.kohsuke.stapler.StaplerRequest; + +public class Descriptor extends BuildStepDescriptor { + + private static Descriptor descriptor = null; + + private Descriptor() { + super(Publisher.class); + } + + public static Descriptor getInstance() { + if (null == descriptor) { + descriptor = new Descriptor(); + } + return descriptor; + } + + @Override + public boolean isApplicable(Class jobType) { + return true; + } + + @Override + public String getDisplayName() { + return Messages.plugin_display_name(); + } + + @Override + public boolean configure(StaplerRequest request, JSONObject data) throws FormException { + request.bindParameters(this, Messages.plugin_id()); + save(); + return super.configure(request, data); + } + + @Override + public Publisher newInstance(StaplerRequest request, JSONObject data) throws FormException { + Publisher publisher = request.bindParameters(Publisher.class, Messages.plugin_id()); + + return publisher; + } + +} diff --git a/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/GraphWalkerPlugin.java b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/GraphWalkerPlugin.java new file mode 100755 index 00000000..7efef0dd --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/GraphWalkerPlugin.java @@ -0,0 +1,14 @@ +package org.graphwalker.jenkins.plugin; + +import hudson.Plugin; +import hudson.model.Hudson; +import hudson.model.TransientViewActionFactory; + +public class GraphWalkerPlugin extends Plugin { + + @Override + public void start() throws Exception { + Hudson.getInstance().getExtensionList(TransientViewActionFactory.class).add(0, new ViewActionFactory()); + super.start(); + } +} diff --git a/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/ProjectAction.java b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/ProjectAction.java new file mode 100755 index 00000000..c676e6f4 --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/ProjectAction.java @@ -0,0 +1,63 @@ +package org.graphwalker.jenkins.plugin; + +import hudson.model.AbstractBuild; +import hudson.model.AbstractProject; +import hudson.model.Actionable; +import hudson.model.ProminentProjectAction; +import hudson.util.DataSetBuilder; +import org.jfree.data.category.CategoryDataset; +import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerResponse; + +import java.io.IOException; + +public class ProjectAction extends Actionable implements ProminentProjectAction { + + private final AbstractProject project; + + public ProjectAction(AbstractProject project) { + this.project = project; + } + + public AbstractProject getProject() { + return project; + } + + public String getIconFileName() { + return Messages.project_action_icon_file_name(); + } + + public String getUrlName() { + return Messages.project_action_url_name(); + } + + public String getDisplayName() { + return Messages.project_action_display_name(); + } + + public String getSearchUrl() { + return Messages.project_action_url_name(); + } + + public void doGraph(final StaplerRequest request, StaplerResponse response) throws IOException { + TrendChart trendChart = new TrendChart(createDataSet()); + trendChart.doPng(request, response); + } + + private CategoryDataset createDataSet() { + DataSetBuilder dataSetBuilder = new DataSetBuilder(); + for (AbstractBuild build: getProject().getBuilds()) { + ResultAction action = build.getAction(ResultAction.class); + if (null != action) { + TestResult result = action.getResult(); + if (null != result) { + //dataSetBuilder.add(result.getPassedRequirementCount(), Messages.project_trend_passed(), result.getTimestamp()); + //dataSetBuilder.add(result.getFailedRequirementCount(), Messages.project_trend_failed(), result.getTimestamp()); + //dataSetBuilder.add(result.getNotCoveredRequirementCount(), Messages.project_trend_not_covered(), result.getTimestamp()); + } + } + } + return dataSetBuilder.build(); + } + +} diff --git a/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/Publisher.java b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/Publisher.java new file mode 100755 index 00000000..763837e8 --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/Publisher.java @@ -0,0 +1,79 @@ +package org.graphwalker.jenkins.plugin; + +import hudson.Extension; +import hudson.FilePath; +import hudson.Launcher; +import hudson.Util; +import hudson.model.AbstractBuild; +import hudson.model.AbstractProject; +import hudson.model.Action; +import hudson.model.BuildListener; +import hudson.tasks.BuildStepDescriptor; +import hudson.tasks.BuildStepMonitor; +import hudson.tasks.Recorder; +import org.kohsuke.stapler.DataBoundConstructor; + +import java.io.IOException; + +//import org.graphwalker.core.report.GraphWalkerReportType; +//import org.graphwalker.core.report.XMLReport; + +public class Publisher extends Recorder { + + @Extension + public static final Descriptor DESCRIPTOR = Descriptor.getInstance(); + + @DataBoundConstructor + public Publisher() { + + } + + public BuildStepMonitor getRequiredMonitorService() { + return BuildStepMonitor.BUILD; + } + + @Override + public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) throws InterruptedException { + final FilePath workspace = build.getWorkspace(); + try { + if (workspace.exists() && workspace.isDirectory()) { + final FilePath targetDirectory = workspace.child("target"); + if (targetDirectory.exists() && targetDirectory.isDirectory()) { + final FilePath reportDirectory = targetDirectory.child(Messages.plugin_report_directory()); + if (reportDirectory.exists() && reportDirectory.isDirectory()) { + TestResult result = new TestResult(); + //XMLReport parser = new XMLReport(); + for (FilePath file: reportDirectory.list()) { + // processReport(parser, file, result); + } + build.addAction(new ResultAction(build, result, listener)); + } + } + } + } catch (IOException e) { + Util.displayIOException(e, listener); + build.setResult(hudson.model.Result.FAILURE); + } + build.addAction(new BuildAction(build)); + return true; + } + /* + private void processReport(XMLReport parser, FilePath file, TestResult result) throws IOException, InterruptedException { + if (file.exists() && !file.isDirectory()) { + File reportFile = new File(file.getRemote()); + GraphWalkerReportType report = parser.readReport(reportFile); + result.addReport(report); + } + } + */ + @Override + public Action getProjectAction(AbstractProject project) { + return new ProjectAction(project); + } + + @Override + public BuildStepDescriptor getDescriptor() { + return DESCRIPTOR; + } + +} diff --git a/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/ResultAction.java b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/ResultAction.java new file mode 100755 index 00000000..b2370149 --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/ResultAction.java @@ -0,0 +1,71 @@ +package org.graphwalker.jenkins.plugin; + +import com.thoughtworks.xstream.XStream; +import hudson.XmlFile; +import hudson.model.AbstractBuild; +import hudson.model.BuildListener; +import hudson.tasks.test.AbstractTestResultAction; +import hudson.util.XStream2; + +import java.io.File; +import java.io.IOException; +import java.lang.ref.WeakReference; + +public class ResultAction extends AbstractTestResultAction { + + private static final XStream XSTREAM = new XStream2(); + private transient WeakReference result = null; + + protected ResultAction(AbstractBuild owner, TestResult result, BuildListener listener) { + super(owner); + setResult(result, listener); + } + + public synchronized void setResult(TestResult result, BuildListener listener) { + saveResult(result, listener); + this.result = new WeakReference(result); + } + + public synchronized TestResult getResult() { + TestResult result = null; + if (null != this.result && null != this.result.get()) { + result = this.result.get(); + } else { + result = loadResult(); + } + return result; + } + + private void saveResult(TestResult result, BuildListener listener) { + try { + getPersistentFile().write(result); + } catch (IOException e) { + e.printStackTrace(listener.fatalError(Messages.result_save_error())); + } + } + + public TestResult loadResult() { + try { + result = new WeakReference((TestResult)getPersistentFile().read()); + } catch (IOException e) { + result = new WeakReference(new TestResult()); + } + return result.get(); + } + + private XmlFile getPersistentFile() { + return new XmlFile(XSTREAM, new File(owner.getRootDir(), Messages.plugin_persistent_file_name())); + } + + @Override + public int getFailCount() { + return 0;//getResult().getFailedRequirementCount(); + } + + @Override + public int getTotalCount() { + return 0;//getResult().getTotalRequirementCount(); + } + + +} diff --git a/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/TestResult.java b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/TestResult.java new file mode 100755 index 00000000..f5a7aadb --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/TestResult.java @@ -0,0 +1,90 @@ +package org.graphwalker.jenkins.plugin; + +import hudson.model.ModelObject; + +import java.io.Serializable; + +//import org.graphwalker.core.report.GraphWalkerReportType; +//import org.graphwalker.core.report.RequirementsType; + +public class TestResult implements ModelObject, Serializable { +/* + private static final long serialVersionUID = 1341889337197236412L; + + private String clazz; + private int passedRequirementCount = 0; + private int failedRequirementCount = 0; + private int notCoveredRequirementCount = 0; + private int totalRequirementCount = 0; + private long timestamp = 0; + + List reportResults = new ArrayList(); + + public TestResult() {} + + public TestResult(String clazz, RequirementsType requirements, long timestamp) { + this.clazz = clazz; + failedRequirementCount = requirements.getFailed().intValue(); + notCoveredRequirementCount = requirements.getNotCovered().intValue(); + passedRequirementCount = requirements.getPassed().intValue(); + totalRequirementCount = requirements.getCount().intValue(); + this.timestamp = timestamp; + } + + public void addReport(GraphWalkerReportType report) { + TestResult reportResult = new TestResult(report.getClazz(), report.getRequirements(), report.getTimestamp()); + reportResults.add(reportResult); + failedRequirementCount += reportResult.getFailedRequirementCount(); + notCoveredRequirementCount += reportResult.getNotCoveredRequirementCount(); + passedRequirementCount += reportResult.getPassedRequirementCount(); + totalRequirementCount += reportResult.getTotalRequirementCount(); + if (0 == timestamp || timestamp > report.getTimestamp()) { + timestamp = report.getTimestamp(); + } + } + + public List getReportResults() { + return reportResults; + } + + public String getClazz() { + return clazz; + } + + public long getTimestamp() { + return timestamp; + } + + public int getFailedRequirementCount() { + return failedRequirementCount; + } + + public double getFailedRequirementPercentage() { + return (0!=getTotalRequirementCount()?((double)getFailedRequirementCount()/getTotalRequirementCount()):0d); + } + + public int getPassedRequirementCount() { + return passedRequirementCount; + } + + public double getPassedRequirementPercentage() { + return (0!=getTotalRequirementCount()?((double)getPassedRequirementCount()/getTotalRequirementCount()):0d); + } + + public int getNotCoveredRequirementCount() { + return notCoveredRequirementCount; + } + + public double getNotCoveredRequirementPercentage() { + return (0!=getTotalRequirementCount()?((double)getNotCoveredRequirementCount()/getTotalRequirementCount()):0d); + } + + public int getTotalRequirementCount() { + return totalRequirementCount; + } + */ + public String getDisplayName() { + return Messages.result_display_name(); + } +} + diff --git a/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/TrendChart.java b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/TrendChart.java new file mode 100755 index 00000000..8bf7edef --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/TrendChart.java @@ -0,0 +1,67 @@ +package org.graphwalker.jenkins.plugin; + +import hudson.util.ColorPalette; +import hudson.util.Graph; +import hudson.util.ShiftedCategoryAxis; +import hudson.util.StackedAreaRenderer2; +import org.jfree.chart.ChartFactory; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.axis.CategoryAxis; +import org.jfree.chart.axis.CategoryLabelPositions; +import org.jfree.chart.axis.NumberAxis; +import org.jfree.chart.plot.CategoryPlot; +import org.jfree.chart.plot.PlotOrientation; +import org.jfree.chart.renderer.category.StackedAreaRenderer; +import org.jfree.data.category.CategoryDataset; +import org.jfree.ui.RectangleInsets; + +import java.awt.*; + +public class TrendChart extends Graph { + + private static final int DEFAULT_HEIGHT = 220; + private static final int DEFAULT_WIDTH = 300; + private final CategoryDataset dataset; + + protected TrendChart(CategoryDataset dataset) { + super(-1, DEFAULT_WIDTH, DEFAULT_HEIGHT); + this.dataset = dataset; + } + + @Override + protected JFreeChart createGraph() { + final JFreeChart chart = ChartFactory.createStackedAreaChart( + null, + Messages.project_trend_date(), + Messages.project_trend_count(), + dataset, + PlotOrientation.VERTICAL, + false, + false, + false + ); + chart.setBackgroundPaint(Color.white); + final CategoryPlot plot = chart.getCategoryPlot(); + plot.setBackgroundPaint(Color.WHITE); + plot.setOutlinePaint(null); + plot.setForegroundAlpha(0.8f); + plot.setRangeGridlinesVisible(true); + plot.setRangeGridlinePaint(Color.black); + CategoryAxis domainAxis = new ShiftedCategoryAxis(null); + plot.setDomainAxis(domainAxis); + domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); + domainAxis.setLowerMargin(0.0); + domainAxis.setUpperMargin(0.0); + domainAxis.setCategoryMargin(0.0); + domainAxis.setTickLabelsVisible(false); + final NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis(); + rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); + StackedAreaRenderer stackedAreaRenderer = new StackedAreaRenderer2(); + plot.setRenderer(stackedAreaRenderer); + stackedAreaRenderer.setSeriesPaint(0, ColorPalette.RED); + stackedAreaRenderer.setSeriesPaint(1, ColorPalette.YELLOW); + stackedAreaRenderer.setSeriesPaint(2, ColorPalette.BLUE); + plot.setInsets(new RectangleInsets(0, 0, 0, 5.0)); + return chart; + } +} diff --git a/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/ViewAction.java b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/ViewAction.java new file mode 100755 index 00000000..8ba06d51 --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/ViewAction.java @@ -0,0 +1,73 @@ +package org.graphwalker.jenkins.plugin; + +import hudson.model.*; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.kohsuke.stapler.bind.JavaScriptMethod; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class ViewAction implements RootAction, ModelObject { + + private final View view; + private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + public ViewAction(View view) { + this.view = view; + } + + public View getView() { + return view; + } + + public String getIconFileName() { + return Messages.view_action_icon_file_name(); + } + + public String getDisplayName() { + return Messages.view_action_display_name(); + } + + public String getUrlName() { + return Messages.view_action_url_name(); + } + + @JavaScriptMethod + public List getJobNames() { + List names = new ArrayList(); + for (TopLevelItem item: getView().getItems()) { + names.add(item.getName()); + } + Collections.sort(names); + return names; + } + + @JavaScriptMethod + public JSONObject getJobAttributes(JSONArray names) { + JSONObject attributes = new JSONObject(); + for (Object name: names) { + JSONObject object = new JSONObject(); + Job job = (Job)getView().getItem((String)name); + if (((AbstractProject)job).isDisabled() || null == job.getLastBuild()) { + object.put("isDisabled", "true"); + } else { + object.put("isBuilding", job.isBuilding() ? "true" : "false"); + if (job.isBuilding()) { + Executor executor = job.getLastBuild().getExecutor(); + object.put("isLikelyStuck", executor.isLikelyStuck() ? "true" : "false"); + object.put("progress", "" + executor.getProgress()); + } else { + object.put("success", job.getLastBuild().getResult().isWorseThan(Result.SUCCESS) ? "false" : "true"); + object.put("failure", job.getLastBuild().getResult().isBetterThan(Result.FAILURE) ? "false" : "true"); + object.put("time", dateFormat.format(job.getLastBuild().getTime())); + } + } + attributes.put((String)name, object); + } + return attributes; + } + +} diff --git a/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/ViewActionFactory.java b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/ViewActionFactory.java new file mode 100755 index 00000000..b8b5e77a --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/java/org/graphwalker/jenkins/plugin/ViewActionFactory.java @@ -0,0 +1,18 @@ +package org.graphwalker.jenkins.plugin; + +import hudson.model.Action; +import hudson.model.TransientViewActionFactory; +import hudson.model.View; + +import java.util.ArrayList; +import java.util.List; + +public class ViewActionFactory extends TransientViewActionFactory { + + @Override + public List createFor(View view) { + List actions = new ArrayList(); + actions.add(new ViewAction(view)); + return actions; + } +} diff --git a/graphwalker-jenkins-plugin/src/main/resources/index.jelly b/graphwalker-jenkins-plugin/src/main/resources/index.jelly new file mode 100755 index 00000000..cf6ef3a1 --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/resources/index.jelly @@ -0,0 +1,3 @@ +
+ Display GraphWalker results +
diff --git a/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/BuildAction/index.jelly b/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/BuildAction/index.jelly new file mode 100755 index 00000000..f6f11ca5 --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/BuildAction/index.jelly @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/Messages.properties b/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/Messages.properties new file mode 100755 index 00000000..74de0f2a --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/Messages.properties @@ -0,0 +1,26 @@ +plugin.id = graphwalker +plugin.name = graphwalker +plugin.display.name = GraphWalker Plugin +plugin.report.directory = graphwalker-reports +plugin.persistent.file.name = graphwalker-result.xml + +build.action.icon.file.name = +build.action.display.name = GraphWalker +build.action.url.name = graphwalker + +project.action.icon.file.name = /plugin/graphwalker-jenkins-plugin/flags.png +project.action.display.name = GraphWalker +project.action.url.name = graphwalker +project.trend.date=date +project.trend.count=count +project.trend.passed=passed +project.trend.failed=failed +project.trend.not.covered=not covered + + +view.action.icon.file.name = flags.png +view.action.display.name = GraphWalker +view.action.url.name = graphwalker + +result.display.name = GraphWalker Result +result.save.error = Failed to save test results \ No newline at end of file diff --git a/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/ProjectAction/index.jelly b/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/ProjectAction/index.jelly new file mode 100755 index 00000000..4048f156 --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/ProjectAction/index.jelly @@ -0,0 +1,3 @@ + + + diff --git a/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/Publisher/config.jelly b/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/Publisher/config.jelly new file mode 100755 index 00000000..551ca28a --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/Publisher/config.jelly @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/Publisher/help.html b/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/Publisher/help.html new file mode 100755 index 00000000..7b25c012 --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/Publisher/help.html @@ -0,0 +1,3 @@ +
+ GraphWalker Plugin Help +
\ No newline at end of file diff --git a/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/ViewAction/index.jelly b/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/ViewAction/index.jelly new file mode 100755 index 00000000..4048f156 --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/ViewAction/index.jelly @@ -0,0 +1,3 @@ + + + diff --git a/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/dashboard.jelly b/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/dashboard.jelly new file mode 100644 index 00000000..66eb46e3 --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/resources/org/graphwalker/jenkins/plugin/dashboard.jelly @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + ${h.checkPermission(it,permission)} + ${h.appendIfNotNull(title, ' [Jenkins]', 'Jenkins')} + + + + + + + + + + + + \ No newline at end of file diff --git a/graphwalker-jenkins-plugin/src/main/webapp/css/styles.css b/graphwalker-jenkins-plugin/src/main/webapp/css/styles.css new file mode 100644 index 00000000..3526bff3 --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/webapp/css/styles.css @@ -0,0 +1,12 @@ + +* { + margin: 0; + padding: 0; +} + +html, body { + width: 100%; + height: 100%; + overflow: hidden; +} + diff --git a/graphwalker-jenkins-plugin/src/main/webapp/scripts/TreeMap.js b/graphwalker-jenkins-plugin/src/main/webapp/scripts/TreeMap.js new file mode 100644 index 00000000..f3d48386 --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/webapp/scripts/TreeMap.js @@ -0,0 +1,370 @@ +// Make a Treemap, using the squarified Treemap algorithm. +(function(Treemap, $, undefined) { + "use strict"; + + Treemap.Color = (function() { + function Color() { + + this.rgbToHsl = function(r, g, b) { + r /= 255, g /= 255, b /= 255; + var max = Math.max(r, g, b), min = Math.min(r, g, b); + var h, s, l = (max + min) / 2; + + if(max == min) { + h = s = 0; + } else { + var d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + switch (max) { + case r: h = (g - b) / d + (g < b ? 6 : 0); break; + case g: h = (b - r) / d + 2; break; + case b: h = (r - g) / d + 4; break; + } + h /= 6; + } + + return [h, s, l]; + } + + function hue2rgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1/6) return p + (q - p) * 6 * t; + if (t < 1/2) return q; + if (t < 2/3) return p + (q - p) * (2/3 - t) * 6; + return p; + } + + this.hslToRgb = function(h, s, l) { + var r, g, b; + + if (s == 0) { + r = g = b = l; + } else { + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + r = hue2rgb(p, q, h + 1/3); + g = hue2rgb(p, q, h); + b = hue2rgb(p, q, h - 1/3); + } + + return [r * 255, g * 255, b * 255]; + } + + this.rgbToHsv = function(r, g, b) { + r = r/255, g = g/255, b = b/255; + var max = Math.max(r, g, b), min = Math.min(r, g, b); + var h, s, v = max; + + var d = max - min; + s = max == 0 ? 0 : d / max; + + if (max == min) { + h = 0; + } else { + switch(max) { + case r: h = (g - b) / d + (g < b ? 6 : 0); break; + case g: h = (b - r) / d + 2; break; + case b: h = (r - g) / d + 4; break; + } + h /= 6; + } + + return [h, s, v]; + } + + this.hsvToRgb = function(h, s, v) { + var r, g, b; + + var i = Math.floor(h * 6); + var f = h * 6 - i; + var p = v * (1 - s); + var q = v * (1 - f * s); + var t = v * (1 - (1 - f) * s); + + switch (i % 6) { + case 0: r = v, g = t, b = p; break; + case 1: r = q, g = v, b = p; break; + case 2: r = p, g = v, b = t; break; + case 3: r = p, g = q, b = v; break; + case 4: r = t, g = p, b = v; break; + case 5: r = v, g = p, b = q; break; + } + + return [r * 255, g * 255, b * 255]; + } + + this.transition = function(value, max, start, end) { + return [ + start[0] + (end[0] - start[0]) * value / max, + start[1] + (end[1] - start[1]) * value / max, + start[2] + (end[2] - start[2]) * value / max + ] + } + + } + return Color; + }()); + + Treemap.Bounds = (function() { + function Bounds(x, y, width, height) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + } + }()); + + Treemap.Rectangle = (function() { + function Rectangle(x, y, width, height) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + + this.getShortestEdge = function() { + return Math.min(this.height, this.width); + } + + this.getArea = function() { + return this.height * this.width; + } + } + return Rectangle; + }()); + + Treemap.Element = (function() { + function Element(weight, data) { + this.weight = weight; + this.data = data; + this.rectangle = undefined; + this.normalizedWeight = undefined; + } + return Element; + }()); + + Treemap.Group = (function() { + function Group(elements, data) { + this.elements = elements.slice(); + this.data = data; + this.weight = 0; + for (var n in elements) { + this.weight += elements[n].weight; + } + this.rectangle = undefined; + this.normalizedWeight = undefined; + } + return Group; + }()); + + Treemap.Renderer = (function() { + function Renderer(elements) { + + this.weights = toArray(elements, "weight"); + this.min = Math.min.apply(Math, this.weights); + this.max = Math.max.apply(Math, this.weights); + + this.render = function(context, element) { + if (element instanceof Treemap.Group) { + // todo: render group label + + for (var n in element.elements) { + this.render(context, element.elements[n]); + } + + var rectangle = element.rectangle; + + var lineWidth = 4; + var halfLineWidth = lineWidth/2; + + var topLineWidth = rectangle.y === 0 ? lineWidth : halfLineWidth; + var halfTopLineWidth = topLineWidth/2; + var rightLineWidth = rectangle.x+rectangle.width == context.canvas.width ? lineWidth : halfLineWidth; + var halfRightLineWidth = rightLineWidth/2; + var bottomLineWidth = rectangle.y+rectangle.height == context.canvas.height ? lineWidth : halfLineWidth; + var halfBottomLineWidth = bottomLineWidth/2; + var leftLineWidth = rectangle.x === 0 ? lineWidth : halfLineWidth; + var halfLeftLineWidth = leftLineWidth/2; + +//console.log("w = "+context.canvas.width+" h ="+context.canvas.height); + + context.beginPath(); + context.lineJoin = 'miter'; + context.lineCap = 'square'; + context.strokeStyle = 'black'; + context.lineWidth = topLineWidth; + context.moveTo(rectangle.x, rectangle.y+halfTopLineWidth); + context.lineTo(rectangle.x+rectangle.width-halfRightLineWidth, rectangle.y+halfTopLineWidth); + context.stroke(); + context.lineWidth = rightLineWidth; + context.lineTo(rectangle.x+rectangle.width-halfRightLineWidth, rectangle.y+rectangle.height-halfBottomLineWidth); + context.stroke(); + context.lineWidth = bottomLineWidth; + context.lineTo(rectangle.x+halfLeftLineWidth, rectangle.y+rectangle.height-halfBottomLineWidth); + context.stroke(); + context.lineWidth = leftLineWidth; + context.lineTo(rectangle.x+halfLeftLineWidth, rectangle.y); + context.stroke(); + + } else { + /* + var rectangle = element.rectangle; + context.beginPath(); + context.rect(rectangle.x, rectangle.y, rectangle.width, rectangle.height); + + //var ratio = (element.weight - this.min)/(this.max - this.min); + //var gradient = context.createLinearGradient(rectangle.x, rectangle.y, rectangle.width, rectangle.height); + var color = new Treemap.Color(); + var start = color.rgbToHsl(0, 255, 0); + var end = color.rgbToHsl(255, 0, 0); + var hsl = color.transition(element.weight, 25, start, end); + var rgb = color.hslToRgb(hsl[0], hsl[1], hsl[2]); + + //var hsv2 = transition(element.weight - this.min, this.max - this.min, start_point, end_point); + //var rgb2 = hsv_to_rgb(hsv2); + + //gradient.addColorStop(0, "rgb(" + Math.round(rgb1[0]) + "," + Math.round(rgb1[1]) + "," + Math.round(rgb1[2]) + ")"); + //gradient.addColorStop(1-(1-ratio), "rgb(" + Math.round(rgb2[0]) + "," + Math.round(rgb2[1]) + "," + Math.round(rgb2[2]) + ")"); + //context.fillStyle = gradient; + context.fillStyle = "rgb(" + Math.round(rgb[0]) + "," + Math.round(rgb[1]) + "," + Math.round(rgb[2]) + ")"; + context.fill(); + + context.textBaseline = "top"; + context.fillStyle = "black"; + context.font = "bold 12px sans-serif"; + context.fillText(element.weight+":"+rectangle.width+":"+rectangle.height, rectangle.x+10, rectangle.y+10); + //context.fillText(ratio, rectangle.x+10, rectangle.y+20); + //context.fillText(red+" "+green, rectangle.x+10, rectangle.y+30); + + //context.lineWidth = 1; + //context.strokeStyle = 'white'; + //context.stroke(); + */ + } + } + } + return Renderer; + }()); + + Treemap.draw = function (elements, context, renderer) { + renderer = renderer || new Treemap.Renderer(elements); + var rectangle = new Treemap.Rectangle(0, 0, context.canvas.width, context.canvas.height); + squarify(normalize(sort(elements, "weight"), rectangle).slice(), [], rectangle); + for (var i = 0; i= worst(rectangle, row, child)) { + if (isEmpty(children)) { + row.push(child); + layoutrow(row, rectangle); + } else { + row.push(child); + squarify(children, row, rectangle); + } + } else { + var subrectangle = layoutrow(row, rectangle); + var area = sumArray(toArray(row, "normalizedWeight")); + children.unshift(child); + squarify(children, [], subrectangle); + } + } + } + + function layoutrow(row, rectangle) { + var weights = toArray(row, "normalizedWeight"); + var sum = sumArray(weights); + var x = rectangle.x; + var y = rectangle.y; + var maxX = rectangle.x + rectangle.width; + var maxY = rectangle.y + rectangle.height; + if (rectangle.width >= rectangle.height) { + var width = sum / rectangle.height; + for (var i = 0; i < row.length; i++) { + var height = row[i].normalizedWeight / width; + if (y+height > maxY || i+1 == row.length) { + height = maxY - y; + } + place(row[i], x, y, width, height); + y = y + height; + } + return new Treemap.Rectangle(rectangle.x+width, rectangle.y, rectangle.width-width, rectangle.height); + } else { + var height = sum / rectangle.width; + for (var i = 0; i < row.length; i++) { + var width = row[i].normalizedWeight / height; + if (x+width > maxX || i+1 == row.length) { + width = maxX - x; + } + place(row[i], x, y, width, height); + x = x + width; + } + return new Treemap.Rectangle(rectangle.x, rectangle.y+height, rectangle.width, rectangle.height-height); + } + } + + function worst(rectangle, row, child) { + var weights = toArray(row, "normalizedWeight"); + if (typeof child !== "undefined") { + weights.push(child.normalizedWeight); + } + return ratio(weights, rectangle.getShortestEdge()); + } + + function ratio(weights, length) { + var min = Math.min.apply(Math, weights); + var max = Math.max.apply(Math, weights); + var sum = sumArray(weights); + return Math.max(Math.pow(length, 2) * max / Math.pow(sum, 2), Math.pow(sum, 2) / (Math.pow(length, 2) * min)); + } + + function place(element, x, y, width, height) { +//console.log(element.weight+"@["+x+","+y+"] w = "+width+" h = "+height); + element.rectangle = new Treemap.Rectangle(x, y, width, height); + if (element instanceof Treemap.Group) { + squarify(normalize(sort(element.elements, "weight"), element.rectangle).slice(), [], element.rectangle); + } + } + + function normalize(elements, rectangle) { + var weights = toArray(elements, "weight"); + var scale = rectangle.getArea() / sumArray(weights); + for (var i = 0; i < elements.length; i++) { + elements[i].normalizedWeight = scale * elements[i].weight; + } + return elements; + } + + function sort(elements, property) { + elements.sort(function (a, b) { + return b[property] - a[property]; + }); + return elements; + } + + function isEmpty(array) { + return 0 === array.length; + } + + function sumArray(array) { + var total = 0; + for (var i = 0; i < array.length; i++) { + total += array[i]; + } + return total; + } + + function toArray(elements, property) { + return elements.map(function (element) { + return element[property]; + }); + } + +}(window.Treemap = window.Treemap || {}, jQuery)); + + + diff --git a/graphwalker-jenkins-plugin/src/main/webapp/scripts/graphwalker.js b/graphwalker-jenkins-plugin/src/main/webapp/scripts/graphwalker.js new file mode 100644 index 00000000..f127bb0c --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/webapp/scripts/graphwalker.js @@ -0,0 +1,114 @@ +(function(graphwalker, undefined) { + "use strict"; + + graphwalker.Stage = (function() { + function Stage(canvasId) { + + this.canvas = document.getElementById(canvasId); + this.context = this.canvas.getContext("2d"); + this.displayObject = new graphwalker.DisplayObject(this.canvas); + + this.addChild = function(child) { + this.displayObject.addChild(child); + } + + this.setSize = function(width, height) { + this.displayObject.setSize(width, height); + } + + this.update = function() { + this.displayObject.draw(context); + + //this.context.beginPath(); + //this.context.rect(0, 0, this.canvas.width, this.canvas.height); + //this.context.fillStyle = "black"; + //this.context.fill(); + } + } + return Stage; + }()); + + graphwalker.DisplayObject = (function(){ + function DisplayObject(object) { + this.object = object; + this.parent = null; + this.childrenSet = {}; + + this.addChildren = function(children) { + + } + + this.addChild = function(child) { + if (child instanceof graphwalker.DisplayObject) { + if (child.parent === null) { + this.childrenSet[child] = true; + child.parent = this; + } else if (child.parent !== this) { + child.parent.removeChild(child); + this.childrenSet[child] = true; + child.parent = this; + } + } + } + + this.removeChildren = function(children) { + + } + + this.removeChild = function(child) { + delete this.childrenSet[child]; + } + + this.contains = function(child) { + while (child) { + if (child === this) { + return true; + } + child = child.parent; + } + return false; + } + + this.setSize = function(width, height) { + this.object.width = width; + this.object.height = height; + } + + this.getX = function() { + return this.object.x; + } + + this.getY = function() { + return this.object.y; + } + + this.getWidth = function() { + return this.object.width; + } + + this.getHeight = function() { + return this.object.height; + } + + this.draw = function(context) { + var list = this.children.slice(0); + for (var index = 0, length = list.length; index < length; index++) { + var child = list[i]; + + } + } + } + return DisplayObject; + }()); + + graphwalker.Shape = (function() { + function Shape(x, y, width, height) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + } + return Shape; + }()); + +}(window.graphwalker = window.graphwalker || {})); \ No newline at end of file diff --git a/graphwalker-jenkins-plugin/src/main/webapp/scripts/script.js b/graphwalker-jenkins-plugin/src/main/webapp/scripts/script.js new file mode 100644 index 00000000..0fe49f16 --- /dev/null +++ b/graphwalker-jenkins-plugin/src/main/webapp/scripts/script.js @@ -0,0 +1,44 @@ + + +var elements = [ + new Treemap.Group([new Treemap.Element(21, 20) + , new Treemap.Element(20, 20) + , new Treemap.Element(19, 20) + , new Treemap.Element(18, 20) + , new Treemap.Element(1, 20) + ], 1), + new Treemap.Group([new Treemap.Element(16, 20) + , new Treemap.Element(15, 20) + , new Treemap.Element(14, 20) + , new Treemap.Element(13, 20) + , new Treemap.Element(12, 20) + , new Treemap.Element(1, 20) + ], 2), + new Treemap.Group([new Treemap.Element(10, 20) + , new Treemap.Element(9, 20) + , new Treemap.Element(2, 20) + , new Treemap.Element(3, 20) + , new Treemap.Element(1, 20) + , new Treemap.Element(1, 20) + , new Treemap.Element(1, 20) + , new Treemap.Element(1, 20) + , new Treemap.Element(1, 20) + , new Treemap.Element(1, 20) + ], 3) +]; + +function draw() { + var context = document.getElementById('canvas').getContext('2d'); + context.canvas.width = window.innerWidth; + context.canvas.height = window.innerHeight; + Treemap.draw(elements, context); +} + +$(window).on("load", function(event) { + draw(); +}); + +$(window).on("resize", function(event) { + draw(); +}); + diff --git a/graphwalker-maven-plugin/pom.xml b/graphwalker-maven-plugin/pom.xml new file mode 100755 index 00000000..aee7edb0 --- /dev/null +++ b/graphwalker-maven-plugin/pom.xml @@ -0,0 +1,156 @@ + + + 4.0.0 + + + org.graphwalker + graphwalker + 3.0-BETA-SNAPSHOT + + + graphwalker-maven-plugin + GraphWalker Maven Plugin + maven-plugin + + + 3.0.3 + 3.2 + + + + ${maven.version} + + + + + org.graphwalker + graphwalker-core + ${project.version} + + + org.graphwalker + graphwalker-io + ${project.version} + + + org.apache.maven + maven-core + ${maven.version} + + + org.apache.maven + maven-plugin-api + ${maven.version} + + + org.apache.maven.plugin-tools + maven-plugin-annotations + 3.2 + provided + + + org.apache.maven.reporting + maven-reporting-api + 3.0 + + + org.apache.maven.reporting + maven-reporting-impl + 2.1 + + + org.apache.maven.doxia + doxia-sink-api + 1.2 + + + org.apache.maven.doxia + doxia-core + 1.2 + + + org.apache.httpcomponents + httpclient + + + + + org.apache.maven.doxia + doxia-decoration-model + 1.2 + + + org.apache.maven.doxia + doxia-site-renderer + 1.2 + + + org.apache.httpcomponents + httpclient + 4.1.2 + + + com.google.code.javaparser + javaparser + 1.0.9 + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + ${maven.plugin.version} + + + + + + + + org.codehaus.mojo + jaxb2-maven-plugin + + + generate-sources + + xjc + + + ${basedir}/src/main/resources + junit-4.xsd + org.graphwalker.maven.plugin.report + + + + + + org.apache.maven.plugins + maven-plugin-plugin + ${maven.plugin.version} + + true + + + + mojo-descriptor + process-classes + + descriptor + + + + help-goal + + helpmojo + + + + + + + + diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/AbstractDefaultMojo.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/AbstractDefaultMojo.java new file mode 100644 index 00000000..c94a365c --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/AbstractDefaultMojo.java @@ -0,0 +1,110 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin; + +import org.apache.maven.execution.MavenSession; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.StringUtils; + +import java.io.File; +import java.util.HashSet; +import java.util.Set; + +/** + * @author Nils Olsson + */ +public abstract class AbstractDefaultMojo extends AbstractMojo { + + @Component + private MavenSession session; + + @Component + private MavenProject mavenProject; + + /** + *

Getter for the field session.

+ * + * @return a {@link org.apache.maven.execution.MavenSession} object. + */ + protected MavenSession getSession() { + return session; + } + + /** + *

Getter for the field mavenProject.

+ * + * @return a {@link org.apache.maven.project.MavenProject} object. + */ + protected MavenProject getMavenProject() { + return mavenProject; + } + + private String toString(Set set) { + if (null == set) { + return ""; + } + return StringUtils.join(set.toArray(new String[set.size()]), ","); + } + + /** + *

findFiles.

+ * + * @param includes a {@link java.util.Set} object. + * @param excludes a {@link java.util.Set} object. + * @param directories a {@link java.io.File} object. + * @return a {@link java.util.Set} object. + */ + protected Set findFiles(Set includes, Set excludes, File... directories) { + return findFiles(toString(includes), toString(excludes), directories); + } + + /** + *

findFiles.

+ * + * @param includes a {@link java.lang.String} object. + * @param excludes a {@link java.lang.String} object. + * @param directories a {@link java.io.File} object. + * @return a {@link java.util.Set} object. + */ + protected Set findFiles(String includes, String excludes, File... directories) { + Set files = new HashSet<>(); + for (File directory : directories) { + if (directory.exists()) { + try { + for (Object filename: FileUtils.getFileNames(directory, includes, excludes, true, true)) { + files.add(new File((String)filename)); + } + } catch (Throwable t) { + getLog().debug(t); + } + } + } + return files; + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/AbstractGenerateMojo.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/AbstractGenerateMojo.java new file mode 100644 index 00000000..b3026935 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/AbstractGenerateMojo.java @@ -0,0 +1,129 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin; + +import org.apache.maven.model.Resource; +import org.apache.maven.plugins.annotations.Parameter; +import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.StringUtils; +import org.graphwalker.core.Model; +import org.graphwalker.io.factory.GraphMLModelFactory; +import org.graphwalker.io.factory.ModelFactory; +import org.graphwalker.maven.plugin.source.CodeGenerator; +import org.graphwalker.maven.plugin.source.SourceFile; + +import java.io.File; +import java.nio.file.Files; +import java.util.List; + +/** + * @author Nils Olsson + */ +public abstract class AbstractGenerateMojo extends AbstractDefaultMojo { + + @Parameter(defaultValue = "${project.build.sourceEncoding}", required = true, readonly = true) + private String sourceEncoding; + + private final ModelFactory modelFactory = new GraphMLModelFactory(); + + /** + *

Getter for the field sourceEncoding.

+ * + * @return a {@link java.lang.String} object. + */ + protected String getSourceEncoding() { + return sourceEncoding; + } + + /** + *

getGeneratedSourcesDirectory.

+ * + * @return a {@link java.io.File} object. + */ + protected abstract File getGeneratedSourcesDirectory(); + + /** + *

generate.

+ * + * @param resources a {@link java.util.List} object. + */ + protected void generate(List resources) { + for (Resource resource: resources) { + generate(resource); + } + } + + /** + *

generate.

+ * + * @param resource a {@link org.apache.maven.model.Resource} object. + */ + protected void generate(Resource resource) { + File baseDirectory = new File(resource.getDirectory()); + ModelFactory factory = new GraphMLModelFactory(); + for (File file: findFiles(factory.getSupportedFileTypes(), null, baseDirectory)) { + generate(file, baseDirectory, getGeneratedSourcesDirectory()); + } + } + + /** + *

generate.

+ * + * @param file a {@link java.io.File} object. + * @param baseDirectory a {@link java.io.File} object. + * @param outputDirectory a {@link java.io.File} object. + */ + protected void generate(File file, File baseDirectory, File outputDirectory) { + generate(new SourceFile(file, baseDirectory, outputDirectory)); + } + + private void generate(SourceFile sourceFile) { + File outputFile = sourceFile.getOutputPath().toFile(); + try { + Model model = modelFactory.create(sourceFile.getInputPath().toFile().getAbsolutePath()); + String source = new CodeGenerator(sourceFile, model).generate(); + if (Files.exists(sourceFile.getOutputPath())) { + String existingSource = StringUtils.removeDuplicateWhitespace(FileUtils.fileRead(outputFile, sourceEncoding)); + if (existingSource.equals(StringUtils.removeDuplicateWhitespace(new String(source.getBytes(), sourceEncoding)))) { + return; + } + } + if (getLog().isInfoEnabled()) { + getLog().info("Generate " + sourceFile.getInputPath()); + } + FileUtils.mkdir(sourceFile.getOutputPath().getParent().toFile().getAbsolutePath()); + FileUtils.fileDelete(outputFile.getAbsolutePath()); + FileUtils.fileWrite(outputFile.getAbsolutePath(), sourceEncoding, source); + } catch (Throwable t) { + if (getLog().isInfoEnabled()) { + getLog().info("Error: Generate " + sourceFile.getInputPath()); + } + if (getLog().isDebugEnabled()) { + getLog().debug("Error: Generate " + sourceFile.getInputPath(), t); + } + } + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/AbstractTestMojo.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/AbstractTestMojo.java new file mode 100644 index 00000000..2814575f --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/AbstractTestMojo.java @@ -0,0 +1,258 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Parameter; +import org.graphwalker.io.common.ResourceUtils; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.Set; + +/** + * @author Nils Olsson + */ +public abstract class AbstractTestMojo extends AbstractDefaultMojo { + + /** + * @since 3.0 + */ + @Parameter(property = "project.testClasspathElements") + private List classpathElements; + + /** + * @since 3.0 + */ + @Parameter(defaultValue="${project.build.testOutputDirectory}") + private File testClassesDirectory; + + /** + * @since 3.0 + */ + @Parameter(defaultValue="${project.build.outputDirectory}") + private File classesDirectory; + + /** + * @since 3.0 + */ + @Parameter(defaultValue = "${project.build.directory}/graphwalker-reports") + private File reportsDirectory; + + /** + * @since 3.0 + */ + @Parameter(property = "maven.test.skip", defaultValue="false") + private boolean mavenTestSkip; + + /** + * @since 3.0 + */ + @Parameter(property = "skipTests", defaultValue = "false") + private boolean skipTests; + + /** + * @since 3.0 + */ + @Parameter(property = "graphwalker.test.skip", defaultValue = "false") + private boolean graphwalkerTestSkip; + + /** + * @since 3.0 + */ + @Parameter(property = "includes") + private Set includes; + + /** + * @since 3.0 + */ + @Parameter(property = "excludes") + private Set excludes; + + /** + * @since 3.0 + */ + @Parameter(property = "test", defaultValue = "*") + private String test; + + /** + * @since 3.0 + */ + @Parameter(property = "groups", defaultValue = "*") + private String groups; + + /** + *

Getter for the field classpathElements.

+ * + * @return a {@link java.util.List} object. + */ + protected List getClasspathElements() { + return classpathElements; + } + + /** + *

Getter for the field testClassesDirectory.

+ * + * @return a {@link java.io.File} object. + */ + protected File getTestClassesDirectory() { + return testClassesDirectory; + } + + /** + *

Getter for the field classesDirectory.

+ * + * @return a {@link java.io.File} object. + */ + protected File getClassesDirectory() { + return classesDirectory; + } + + /** + *

Getter for the field reportsDirectory.

+ * + * @return a {@link java.io.File} object. + */ + protected File getReportsDirectory() { + return reportsDirectory; + } + + /** + *

Getter for the field skipTests.

+ * + * @return a boolean. + */ + protected boolean getSkipTests() { + return mavenTestSkip || graphwalkerTestSkip || skipTests; + } + + /** + *

Getter for the field includes.

+ * + * @return a {@link java.util.Set} object. + */ + protected Set getIncludes() { + return includes; + } + + /** + *

Getter for the field excludes.

+ * + * @return a {@link java.util.Set} object. + */ + protected Set getExcludes() { + return excludes; + } + + /** + *

Getter for the field test.

+ * + * @return a {@link java.lang.String} object. + */ + protected String getTest() { + if (System.getProperties().containsKey("test")) { + return System.getProperty("test"); + } + return test; + } + + /** + *

Getter for the field groups.

+ * + * @return a {@link java.lang.String} object. + */ + protected String getGroups() { + if (System.getProperties().containsKey("groups")) { + return System.getProperty("groups"); + } + return groups; + } + + /** + *

createClassLoader.

+ * + * @return a {@link java.lang.ClassLoader} object. + * @throws org.apache.maven.plugin.MojoExecutionException if any. + */ + protected ClassLoader createClassLoader() throws MojoExecutionException { + try { + return new URLClassLoader(convertToURL(getClasspathElements()), getClass().getClassLoader()); + } catch (MalformedURLException e) { + throw new MojoExecutionException(ResourceUtils.getText(Bundle.NAME, "exception.create.classloader")); + } + } + + private URL[] convertToURL(List elements) throws MalformedURLException { + List urlList = new ArrayList<>(); + for (String element : elements) { + urlList.add(new File(element).toURI().toURL()); + } + return urlList.toArray(new URL[urlList.size()]); + } + + /** + *

switchClassLoader.

+ * + * @param newClassLoader a {@link java.lang.ClassLoader} object. + * @return a {@link java.lang.ClassLoader} object. + */ + protected ClassLoader switchClassLoader(ClassLoader newClassLoader) { + ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(newClassLoader); + return oldClassLoader; + } + + /** + *

createProperties.

+ * + * @return a {@link java.util.Properties} object. + */ + protected Properties createProperties() { + Properties properties = (Properties) System.getProperties().clone(); + properties.putAll((Properties) getMavenProject().getProperties().clone()); + properties.put("groups", groups); + properties.put("test", test); + properties.putAll((Properties) getSession().getUserProperties().clone()); + return properties; + } + + /** + *

switchProperties.

+ * + * @param properties a {@link java.util.Properties} object. + * @return a {@link java.util.Properties} object. + */ + protected Properties switchProperties(Properties properties) { + Properties oldProperties = (Properties) System.getProperties().clone(); + System.setProperties(properties); + return oldProperties; + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/AbstractValidateMojo.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/AbstractValidateMojo.java new file mode 100644 index 00000000..1336d048 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/AbstractValidateMojo.java @@ -0,0 +1,74 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin; + +import org.apache.maven.model.Resource; +import org.graphwalker.io.factory.GraphMLModelFactory; +import org.graphwalker.io.factory.ModelFactory; + +import java.io.File; +import java.util.List; + +/** + * @author Nils Olsson + */ +public abstract class AbstractValidateMojo extends AbstractDefaultMojo { + + /** + *

validate.

+ * + * @param resources a {@link java.util.List} object. + */ + protected void validate(List resources) { + for (Resource resource: resources) { + validate(resource); + } + // TODO: if any execution of the sub method returns false this method should throw a new exception + } + + /** + *

validate.

+ * + * @param resource a {@link org.apache.maven.model.Resource} object. + */ + protected void validate(Resource resource) { + ModelFactory factory = new GraphMLModelFactory(); + for (File file: findFiles(factory.getSupportedFileTypes(), null, new File(resource.getDirectory()))) { + validate(file); + } + // TODO: if any execution of the sub method returns false this method should return false + } + + private void validate(File file) { + if (getLog().isInfoEnabled()) { + getLog().info("Validate: " + file.getAbsolutePath()); + } + ModelFactory factory = new GraphMLModelFactory(); + factory.validate(file.toPath()); + //TODO: this should log the validation errors and then return false + } + +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/Bundle.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/Bundle.java new file mode 100755 index 00000000..76f87d19 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/Bundle.java @@ -0,0 +1,34 @@ +/* + * #%L + * Maven GraphWalker Plugin + * %% + * Copyright (C) 2012 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin; + +/** + * @author Nils Olsson + */ +public interface Bundle { + /** Constant NAME="plugin" */ + String NAME = "plugin"; +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/GenerateSourcesMojo.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/GenerateSourcesMojo.java new file mode 100644 index 00000000..ece0777a --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/GenerateSourcesMojo.java @@ -0,0 +1,64 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; + +import java.io.File; + +/** + * @author Nils Olsson + */ +@Mojo(name = "generate-sources", defaultPhase = LifecyclePhase.GENERATE_SOURCES, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true) +public final class GenerateSourcesMojo extends AbstractGenerateMojo { + + @Parameter(defaultValue = "${project.build.directory}/generated-sources/graphwalker") + private File generatedSourcesDirectory; + + /** {@inheritDoc} */ + @Override + protected File getGeneratedSourcesDirectory() { + return generatedSourcesDirectory; + } + + /** + *

execute.

+ * + * @throws org.apache.maven.plugin.MojoExecutionException if any. + * @throws org.apache.maven.plugin.MojoFailureException if any. + */ + public void execute() throws MojoExecutionException, MojoFailureException { + generate(getMavenProject().getResources()); + if (getGeneratedSourcesDirectory().exists()) { + getMavenProject().addCompileSourceRoot(getGeneratedSourcesDirectory().getPath()); + } + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/GenerateTestSourcesMojo.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/GenerateTestSourcesMojo.java new file mode 100644 index 00000000..41b00b81 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/GenerateTestSourcesMojo.java @@ -0,0 +1,64 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; + +import java.io.File; + +/** + * @author Nils Olsson + */ +@Mojo(name = "generate-test-sources", defaultPhase = LifecyclePhase.GENERATE_TEST_SOURCES, requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true) +public final class GenerateTestSourcesMojo extends AbstractGenerateMojo { + + @Parameter(defaultValue = "${project.build.directory}/generated-test-sources/graphwalker") + private File generatedSourcesDirectory; + + /** {@inheritDoc} */ + @Override + protected File getGeneratedSourcesDirectory() { + return generatedSourcesDirectory; + } + + /** + *

execute.

+ * + * @throws org.apache.maven.plugin.MojoExecutionException if any. + * @throws org.apache.maven.plugin.MojoFailureException if any. + */ + public void execute() throws MojoExecutionException, MojoFailureException { + generate(getMavenProject().getTestResources()); + if (getGeneratedSourcesDirectory().exists()) { + getMavenProject().addTestCompileSourceRoot(getGeneratedSourcesDirectory().getPath()); + } + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/TestMojo.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/TestMojo.java new file mode 100755 index 00000000..d965a4a7 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/TestMojo.java @@ -0,0 +1,263 @@ +/* + * #%L + * Maven GraphWalker Plugin + * %% + * Copyright (C) 2012 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Execute; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.ResolutionScope; +import org.codehaus.plexus.util.StringUtils; +import org.graphwalker.core.Machine; +import org.graphwalker.core.PathGenerator; +import org.graphwalker.core.SimpleMachine; +import org.graphwalker.core.StopCondition; +import org.graphwalker.core.annotation.AfterExecution; +import org.graphwalker.core.annotation.BeforeExecution; +import org.graphwalker.io.common.ResourceUtils; +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.machine.ExecutionStatus; +import org.graphwalker.core.model.Element; +import org.graphwalker.maven.plugin.common.AnnotationUtils; +import org.graphwalker.maven.plugin.common.ReflectionUtils; +import org.graphwalker.maven.plugin.test.*; +import org.graphwalker.maven.plugin.test.Scanner; + +import java.util.*; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +/** + * @author Nils Olsson + */ +@Mojo(name = "test", defaultPhase = LifecyclePhase.TEST, requiresDependencyResolution = ResolutionScope.TEST) +@Execute(phase = LifecyclePhase.TEST_COMPILE, lifecycle = "graphwalker") +public final class TestMojo extends AbstractTestMojo { + + private final Map implementations = new HashMap<>(); + private final List machines = new ArrayList<>(); + + /** + *

execute.

+ * + * @throws org.apache.maven.plugin.MojoExecutionException if any. + * @throws org.apache.maven.plugin.MojoFailureException if any. + */ + public void execute() throws MojoExecutionException, MojoFailureException { + if (!getSkipTests()) { + ClassLoader classLoader = switchClassLoader(createClassLoader()); + Properties properties = switchProperties(createProperties()); + displayHeader(); + Configuration configuration = createConfiguration(); + Scanner scanner = new Scanner(); + TestManager manager = new TestManager(configuration, scanner.scan(getTestClassesDirectory(), getClassesDirectory())); + displayConfiguration(manager); + executeTests(manager); + displayResult(manager); + switchProperties(properties); + switchClassLoader(classLoader); + reportResults(manager); + } + } + + private void displayHeader() { + if (getLog().isInfoEnabled()) { + getLog().info("------------------------------------------------------------------------"); + getLog().info(" G r a p h W a l k e r "); + getLog().info("------------------------------------------------------------------------"); + } + } + + private Configuration createConfiguration() { + Configuration configuration = new Configuration(); + if (StringUtils.isBlank(getTest())) { + configuration.setIncludes(getIncludes()); + configuration.setExcludes(getExcludes()); + } else { + Set include = new HashSet<>(); + Set exclude = new HashSet<>(); + for (String test: getTest().split(",")) { + test = test.trim(); + if (StringUtils.isNotBlank(test)) { + if (test.startsWith("!")) { + test = test.substring(1); + if (StringUtils.isNotBlank(test)) { + exclude.add(test); + } + } else { + include.add(test); + } + } + } + configuration.setIncludes(include); + configuration.setExcludes(exclude); + } + configuration.setClassesDirectory(getClassesDirectory()); + configuration.setTestClassesDirectory(getTestClassesDirectory()); + configuration.setReportsDirectory(getReportsDirectory()); + Set groups = new HashSet<>(); + for (String group: getGroups().split(",")) { + groups.add(group.trim()); + } + configuration.setGroups(groups); + return configuration; + } + + private void displayConfiguration(TestManager manager) { + if (getLog().isInfoEnabled()) { + getLog().info("Configuration:"); + getLog().info(" Include = "+manager.getConfiguration().getIncludes()); + getLog().info(" Exclude = "+manager.getConfiguration().getExcludes()); + getLog().info(" Groups = "+manager.getConfiguration().getGroups()); + getLog().info(" Parallel = false"); // TODO: gör så att man kan låta flera trådar köra samma test (kunna utföra lasttest) + getLog().info(""); + getLog().info("Tests:"); + if (manager.getExecutionGroups().isEmpty()) { + getLog().info(" No tests found"); + } else { + for (TestGroup group: manager.getExecutionGroups()) { + getLog().info(" [" + group.getName()+"]"); + for (Execution execution: group.getExecutions()) { + getLog().info(" "+execution.getName()+"("+execution.getPathGenerator().getSimpleName()+", "+execution.getStopCondition().getSimpleName()+", \""+execution.getStopConditionValue()+"\")"); + } + getLog().info(""); + } + } + getLog().info("------------------------------------------------------------------------"); + } + } + + private void executeTests(TestManager manager) { + if (!manager.getExecutionGroups().isEmpty()) { + for (TestGroup group: manager.getExecutionGroups()) { + List executionContexts = new ArrayList<>(); + for (Execution execution: group.getExecutions()) { + try { + String value = execution.getStopConditionValue(); + StopCondition stopCondition = execution.getStopCondition().getConstructor(String.class).newInstance(value); + PathGenerator pathGenerator = execution.getPathGenerator().getConstructor(StopCondition.class).newInstance(stopCondition); + String language = execution.getLanguage(); + Object implementation = execution.getTestClass().newInstance(); + ExecutionContext executionContext = new ExecutionContext(execution.getModel(), pathGenerator, language); + executionContext.getScriptContext().setAttribute("impl", implementation); + implementations.put(executionContext, implementation); + executionContexts.add(executionContext); + } catch (Throwable t) { + t.printStackTrace(); + } + } + + machines.add(new SimpleMachine(executionContexts)); + } + try { + ExecutorService executorService = Executors.newFixedThreadPool(machines.size()); + for (final Machine machine : machines) { + executorService.execute(new Runnable() { + public void run() { + AnnotationUtils.execute(BeforeExecution.class, machine.getCurrentExecutionContext(), implementations.get(machine.getCurrentExecutionContext())); + while (machine.hasNextStep()) { + Element element = machine.getNextStep(); + if (null != element.getName() && !"Start".equals(element.getName())) { + try { + ReflectionUtils.execute(implementations.get(machine.getCurrentExecutionContext()) + , element.getName(), machine.getCurrentExecutionContext().getScriptContext()); + } catch (Throwable throwable) { + machine.failCurrentStep(); + AnnotationUtils.execute(machine.getCurrentExecutionContext(), implementations.get(machine.getCurrentExecutionContext()), throwable); + } + } + } + AnnotationUtils.execute(AfterExecution.class, machine.getCurrentExecutionContext(), implementations.get(machine.getCurrentExecutionContext())); + } + }); + } + executorService.shutdown(); + executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS); + } catch (InterruptedException e) { + throw new RuntimeException(ResourceUtils.getText(Bundle.NAME, "exception.execution.interrupted")); // TODO: byt exception + } + } + } + + private void reportResults(TestManager manager) throws MojoExecutionException { + + boolean hasExceptions = false; + for (Machine machine: machines) { + //reportWriter.writeReport(graphWalker, reportsDirectory, session.getStartTime()); + for (ExecutionContext context: machine.getExecutionContexts()) { + hasExceptions |= ExecutionStatus.FAILED.equals(context.getExecutionStatus()); + } + } + if (hasExceptions) { + throw new MojoExecutionException(ResourceUtils.getText(Bundle.NAME, "exception.execution.failed", getReportsDirectory().getAbsolutePath())); + } + } + + private void displayResult(TestManager manager) { + if (getLog().isInfoEnabled()) { + getLog().info("------------------------------------------------------------------------"); + getLog().info(""); + getLog().info(ResourceUtils.getText(Bundle.NAME, "result.label")); + getLog().info(""); + long groups = manager.getGroupCount(), tests = manager.getTestCount(), completed = 0, failed = 0, notExecuted = 0; + List failedExecutions = new ArrayList<>(); + for (Machine machine: machines) { + for (ExecutionContext context: machine.getExecutionContexts()) { + switch (context.getExecutionStatus()) { + case COMPLETED: { + completed++; + } + break; + case FAILED: { + failed++; + failedExecutions.add(context); + } + break; + case NOT_EXECUTED: { + notExecuted++; + } + break; + } + } + } + if (!failedExecutions.isEmpty()) { + getLog().info("Failed executions: "); + for (ExecutionContext context: failedExecutions) { + double fulfilment = context.getPathGenerator().getStopCondition().getFulfilment(context); + String pathGenerator = context.getPathGenerator().getClass().getSimpleName(); + String stopCondition = context.getPathGenerator().getStopCondition().getClass().getSimpleName(); + String value = context.getPathGenerator().getStopCondition().getValue(); + getLog().info(" " + implementations.get(context).getClass().getName()+"("+pathGenerator+", "+stopCondition+", "+value+"): "+Math.round(100*fulfilment)+"%"); + } + getLog().info(""); + } + getLog().info(ResourceUtils.getText(Bundle.NAME, "result.summary", groups, tests, completed, failed, notExecuted)); + getLog().info(""); + } + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/ValidateModelsMojo.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/ValidateModelsMojo.java new file mode 100644 index 00000000..a8624bcb --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/ValidateModelsMojo.java @@ -0,0 +1,49 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.ResolutionScope; + +/** + * @author Nils Olsson + */ +@Mojo(name = "validate-models", defaultPhase = LifecyclePhase.PROCESS_CLASSES, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true) +public final class ValidateModelsMojo extends AbstractValidateMojo { + + /** + *

execute.

+ * + * @throws org.apache.maven.plugin.MojoExecutionException if any. + * @throws org.apache.maven.plugin.MojoFailureException if any. + */ + public void execute() throws MojoExecutionException, MojoFailureException { + validate(getMavenProject().getResources()); + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/ValidateTestModelsMojo.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/ValidateTestModelsMojo.java new file mode 100644 index 00000000..b604a3f9 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/ValidateTestModelsMojo.java @@ -0,0 +1,49 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.ResolutionScope; + +/** + * @author Nils Olsson + */ +@Mojo(name = "validate-test-models", defaultPhase = LifecyclePhase.PROCESS_TEST_CLASSES, requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true) +public final class ValidateTestModelsMojo extends AbstractValidateMojo { + + /** + *

execute.

+ * + * @throws org.apache.maven.plugin.MojoExecutionException if any. + * @throws org.apache.maven.plugin.MojoFailureException if any. + */ + public void execute() throws MojoExecutionException, MojoFailureException { + validate(getMavenProject().getTestResources()); + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/WatchMojo.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/WatchMojo.java new file mode 100644 index 00000000..c1e67e7d --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/WatchMojo.java @@ -0,0 +1,233 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin; + +import org.apache.maven.model.Resource; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.StringUtils; +import org.graphwalker.core.Model; +import org.graphwalker.io.factory.GraphMLModelFactory; +import org.graphwalker.io.factory.ModelFactory; +import org.graphwalker.maven.plugin.source.CodeGenerator; +import org.graphwalker.maven.plugin.source.SourceFile; + +import java.io.File; +import java.io.IOException; +import java.nio.file.*; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +import static com.sun.nio.file.SensitivityWatchEventModifier.HIGH; +import static java.nio.file.StandardWatchEventKinds.*; + +/** + * @author Nils Olsson + */ +@Mojo(name = "watch") +public class WatchMojo extends AbstractMojo { + + private static final WatchEvent.Kind[] EVENT_TYPES = new WatchEvent.Kind[]{ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY}; + + @Component + private MavenProject mavenProject; + + @Parameter(defaultValue = "${project.build.sourceEncoding}", required = true, readonly = true) + private String sourceEncoding; + + @Parameter(defaultValue = "${project.build.directory}/generated-sources/graphwalker") + private File sourcesDirectory; + + @Parameter(defaultValue = "${project.build.directory}/generated-test-sources/graphwalker") + private File testSourcesDirectory; + + private WatchService watchService; + private final Map resourceMap = new HashMap<>(); + private final Map watchKeyMap = new HashMap<>(); + private final ModelFactory modelFactory = new GraphMLModelFactory(); + + @SuppressWarnings("unchecked") + private static WatchEvent cast(WatchEvent event) { + return (WatchEvent)event; + } + + /** {@inheritDoc} */ + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + try { + addResources(mavenProject.getResources(), sourcesDirectory); + addResources(mavenProject.getTestResources(), testSourcesDirectory); + watch(resourceMap.keySet()); + //noinspection InfiniteLoopStatement + for (;;) { + WatchKey watchKey = getWatchService().take(); + Path path = watchKeyMap.get(watchKey); + if (null == path) { + continue; + } + for (WatchEvent event: watchKey.pollEvents()) { + WatchEvent.Kind kind = event.kind(); + if (kind == OVERFLOW) { + continue; + } + WatchEvent file = cast(event); + Path resolvedPath = path.resolve(file.context()); + if (ENTRY_CREATE == event.kind() || ENTRY_MODIFY == event.kind()) { + update(getRootPath(resolvedPath), resolvedPath); + } else if (ENTRY_DELETE == event.kind()) { + delete(getRootPath(resolvedPath), resolvedPath); + } + } + watchKey.reset(); + } + } catch (Exception e) { + e.printStackTrace(); + throw new MojoExecutionException("", e); + } + } + + private void addResources(List resources, File outputDirectory) { + for (Resource resource: resources) { + resourceMap.put(FileSystems.getDefault().getPath(resource.getDirectory()), outputDirectory); + } + } + + /** + *

Getter for the field watchService.

+ * + * @return a {@link java.nio.file.WatchService} object. + * @throws java.io.IOException if any. + */ + public WatchService getWatchService() throws IOException { + if (null == watchService) { + watchService = FileSystems.getDefault().newWatchService(); + } + return watchService; + } + + private void watch(Set paths) throws IOException { + for (Path path: paths) { + watch(path); + } + } + + private void watch(Path path) throws IOException { + if (Files.exists(path) && !watchKeyMap.values().contains(path)) { + if (Files.isDirectory(path)) { + WatchKey watchKey = path.register(getWatchService(), EVENT_TYPES, HIGH); + watchKeyMap.put(watchKey, path); + getLog().info("Watching: " + path.toString()); + Files.walkFileTree(path, new SimpleFileVisitor() { + @Override + public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes attributes) throws IOException { + watch(path); + return FileVisitResult.CONTINUE; + } + }); + } + } + } + + private Path getRootPath(Path path) throws MojoExecutionException { + for (Path rootPath: resourceMap.keySet()) { + if (path.startsWith(rootPath)) { + return rootPath; + } + } + throw new MojoExecutionException("Path not found"); + } + + private boolean isModified(Path outputPath, Path path) throws IOException { + return Files.getLastModifiedTime(outputPath).to(TimeUnit.MILLISECONDS) + < Files.getLastModifiedTime(path).to(TimeUnit.MILLISECONDS); + } + + private boolean isSupportedFileType(Path path) throws IOException { + return modelFactory.accept(path); + } + + private void generate(SourceFile sourceFile) { + File outputFile = sourceFile.getOutputPath().toFile(); + try { + Model model = modelFactory.create(sourceFile.getInputPath().toFile().getAbsolutePath()); + String source = new CodeGenerator(sourceFile, model).generate(); + if (Files.exists(sourceFile.getOutputPath())) { + String existingSource = StringUtils.removeDuplicateWhitespace(FileUtils.fileRead(outputFile, sourceEncoding)); + if (existingSource.equals(StringUtils.removeDuplicateWhitespace(new String(source.getBytes(), sourceEncoding)))) { + return; + } + } + if (getLog().isInfoEnabled()) { + getLog().info("Generate: " + sourceFile.getOutputPath()); + } + FileUtils.mkdir(sourceFile.getOutputPath().getParent().toFile().getAbsolutePath()); + FileUtils.fileDelete(outputFile.getAbsolutePath()); + FileUtils.fileWrite(outputFile.getAbsolutePath(), sourceEncoding, source); + } catch (Throwable t) { + if (getLog().isInfoEnabled()) { + getLog().info("Error: Generate: " + sourceFile.getOutputPath()); + } + if (getLog().isDebugEnabled()) { + getLog().debug("Error: Generate: " + sourceFile.getOutputPath(), t); + } + } + } + + private void update(Path root, Path path) throws IOException { + if (Files.exists(path) && !Files.isHidden(path)) { + if (Files.isDirectory(path)) { + watch(path); + } else if (isSupportedFileType(path)) { + SourceFile sourceFile = new SourceFile(path, root, resourceMap.get(root).toPath()); + if (!Files.exists(sourceFile.getOutputPath()) || isModified(sourceFile.getOutputPath(), path)) { + generate(sourceFile); + } + } + } + } + + private void delete(Path root, Path path) throws IOException { + if (isSupportedFileType(path)) { + SourceFile sourceFile = new SourceFile(path, root, resourceMap.get(root).toPath()); + if (Files.exists(sourceFile.getOutputPath())) { + Files.delete(sourceFile.getOutputPath()); + if (!Files.exists(sourceFile.getOutputPath())) { + getLog().info("Delete: " + sourceFile.getOutputPath()); + } + } + } + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/common/AnnotationUtils.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/common/AnnotationUtils.java new file mode 100644 index 00000000..09d863c6 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/common/AnnotationUtils.java @@ -0,0 +1,96 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin.common; + +import org.graphwalker.core.annotation.ExceptionHandler; +import org.graphwalker.core.machine.ExecutionContext; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; +import java.util.HashSet; +import java.util.Set; + +/** + * @author Nils Olsson + */ +public final class AnnotationUtils { + + private AnnotationUtils() {} + + /** + *

getAnnotations.

+ * + * @param clazz a {@link java.lang.Class} object. + * @param annotation a {@link java.lang.Class} object. + * @return a {@link java.util.Set} object. + */ + public static Set getAnnotations(final Class clazz, final Class annotation) { + Set annotations = new HashSet<>(); + for (Class interfaceClass: clazz.getInterfaces()) { + if (interfaceClass.isAnnotationPresent(annotation)) { + annotations.add(interfaceClass.getAnnotation(annotation)); + } + } + return annotations; + } + + /** + *

execute.

+ * + * @param annotation a {@link java.lang.Class} object. + * @param executionContext a {@link org.graphwalker.core.machine.ExecutionContext} object. + * @param implementation a {@link java.lang.Object} object. + */ + public static void execute(Class annotation, ExecutionContext executionContext, Object implementation) { + for (Method method: implementation.getClass().getMethods()) { + if (method.isAnnotationPresent(annotation)) { + ReflectionUtils.execute(implementation, method, executionContext.getScriptContext()); + } + } + } + + /** + *

execute.

+ * + * @param executionContext a {@link org.graphwalker.core.machine.ExecutionContext} object. + * @param implementation a {@link java.lang.Object} object. + * @param throwable a {@link java.lang.Throwable} object. + */ + public static void execute(ExecutionContext executionContext, Object implementation, Throwable throwable) { + for (Method method: implementation.getClass().getMethods()) { + if (method.isAnnotationPresent(ExceptionHandler.class)) { + Class types[] = method.getParameterTypes(); + if (0 == types.length) { + ReflectionUtils.execute(implementation, method); + } else if (1 == types.length) { + if (types[0].isInstance(throwable)) { + ReflectionUtils.execute(implementation, method, throwable); + } + } + } + } + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/common/ReflectionException.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/common/ReflectionException.java new file mode 100644 index 00000000..c699bbc6 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/common/ReflectionException.java @@ -0,0 +1,52 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin.common; + +/** + * @author Nils Olsson + */ +public class ReflectionException extends RuntimeException { + + /** + *

Constructor for ReflectionException.

+ * + * @param cause a {@link java.lang.String} object. + */ + public ReflectionException(String cause) { + super(cause); + } + + /** + *

Constructor for ReflectionException.

+ * + * @param cause a {@link java.lang.String} object. + * @param throwable a {@link java.lang.Throwable} object. + */ + public ReflectionException(String cause, Throwable throwable) { + super(cause, throwable); + } +} + diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/common/ReflectionUtils.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/common/ReflectionUtils.java new file mode 100644 index 00000000..0c33addd --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/common/ReflectionUtils.java @@ -0,0 +1,218 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2012 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin.common; + +import org.graphwalker.core.Bundle; +import org.graphwalker.core.StopCondition; +import org.graphwalker.io.common.ResourceUtils; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; + +/** + * @author Nils Olsson + */ +public final class ReflectionUtils { + + private ReflectionUtils() { + } + + /** + *

newInstance.

+ * + * @param clazz a {@link java.lang.Class} object. + * @param a T object. + * @return a T object. + */ + public static T newInstance(Class clazz) { + try { + return clazz.newInstance(); + } catch (InstantiationException | IllegalAccessException e) { + throw new ReflectionException(ResourceUtils.getText(Bundle.NAME, "exception.class.instantiation", clazz.getName()), e); + } + } + + /** + *

newInstance.

+ * + * @param clazz a {@link java.lang.Class} object. + * @param arguments a {@link java.lang.Object} object. + * @param a T object. + * @return a T object. + */ + public static T newInstance(Class clazz, Object... arguments) { + try { + return getConstructor(clazz, arguments).newInstance(arguments); + } catch (InvocationTargetException | InstantiationException | IllegalAccessException e) { + throw new ReflectionException(ResourceUtils.getText(Bundle.NAME, "exception.class.instantiation", clazz.getName()), e); + } + } + + /** + *

getConstructor.

+ * + * @param clazz a {@link java.lang.Class} object. + * @param arguments a {@link java.lang.Object} object. + * @param a T object. + * @return a {@link java.lang.reflect.Constructor} object. + */ + public static Constructor getConstructor(Class clazz, Object... arguments) { + for (Constructor constructor: clazz.getConstructors()) { + Class[] types = constructor.getParameterTypes(); + if (types.length == arguments.length) { + boolean foundMatchingConstructor = true; + for (int i = 0; i Constructor cast(Constructor constructor) { + return (Constructor)constructor; + } + + /** + *

execute.

+ * + * @param object a {@link java.lang.Object} object. + * @param methodName a {@link java.lang.String} object. + * @param arguments a {@link java.lang.Object} object. + */ + public static void execute(Object object, String methodName, Object... arguments) { + execute(object, methodName, Void.class, arguments); + } + + /** + *

execute.

+ * + * @param object a {@link java.lang.Object} object. + * @param method a {@link java.lang.reflect.Method} object. + * @param arguments a {@link java.lang.Object} object. + */ + public static void execute(Object object, Method method, Object... arguments) { + execute(object, method, Void.class, arguments); + } + + /** + *

execute.

+ * + * @param object a {@link java.lang.Object} object. + * @param methodName a {@link java.lang.String} object. + * @param type a {@link java.lang.Class} object. + * @param arguments a {@link java.lang.Object} object. + * @param a T object. + * @return a T object. + */ + public static T execute(Object object, String methodName, Class type, Object... arguments) { + try { + Method method; + try { + method = object.getClass().getMethod(methodName, getTypes(arguments)); + } catch (NoSuchMethodException e) { + method = object.getClass().getMethod(methodName); + } + return execute(object, method, type, arguments); + } catch (NoSuchMethodException e) { + throw new ReflectionException(ResourceUtils.getText(Bundle.NAME, "exception.method.missing", methodName), e); + } + } + + /** + *

execute.

+ * + * @param object a {@link java.lang.Object} object. + * @param method a {@link java.lang.reflect.Method} object. + * @param type a {@link java.lang.Class} object. + * @param arguments a {@link java.lang.Object} object. + * @param a T object. + * @return a T object. + */ + public static T execute(Object object, Method method, Class type, Object... arguments) { + try { + if (0[] getTypes(Object... arguments) { + List> types = new ArrayList<>(); + for (Object argument : arguments) { + if (argument instanceof StopCondition) { + types.add(StopCondition.class); + } else { + types.add(argument.getClass()); + } + } + return types.toArray(new Class[types.size()]); + } + + /** + *

isReturnType.

+ * + * @param object a {@link java.lang.Object} object. + * @param methodName a {@link java.lang.String} object. + * @param type a {@link java.lang.Class} object. + * @return a boolean. + */ + public static boolean isReturnType(Object object, String methodName, Class type) { + if (null != object) { + try { + return isReturnType(object.getClass().getMethod(methodName), type); + } catch (NoSuchMethodException e) { + throw new ReflectionException(ResourceUtils.getText(Bundle.NAME, "exception.method.missing", methodName), e); + } + } + return false; + } + + /** + *

isReturnType.

+ * + * @param method a {@link java.lang.reflect.Method} object. + * @param type a {@link java.lang.Class} object. + * @return a boolean. + */ + public static boolean isReturnType(Method method, Class type) { + return null != method && method.getReturnType().equals(type); + } + +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/report/XMLReport.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/report/XMLReport.java new file mode 100644 index 00000000..eb20b858 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/report/XMLReport.java @@ -0,0 +1,102 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin.report; + +import org.codehaus.plexus.util.FileUtils; +import org.graphwalker.core.machine.ExecutionContext; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.OutputStream; + +/** + * @author Nils Olsson + */ +public final class XMLReport { + + private final File directory; + private ObjectFactory factory = new ObjectFactory(); + + /** + *

Constructor for XMLReport.

+ * + * @param directory a {@link java.io.File} object. + */ + public XMLReport(File directory) { + this.directory = directory; + } + + /** + *

writeReport.

+ */ + public void writeReport() { + + } + + /** + *

writeReport.

+ * + * @param context a {@link org.graphwalker.core.machine.ExecutionContext} object. + * @param implementation a {@link java.lang.Object} object. + */ + public void writeReport(ExecutionContext context, Object implementation) { + String name = implementation.getClass().getName(); + Testsuite testsuite = factory.createTestsuite(); + testsuite.setName(name); + // add properties that were used in this context + /* add requirement status as testcases + for (Requirement requirement: context.getRequirements()) { + Testcase testcase = factory.createTestcase(); + testcase.setName(requirement.getName()); + testcase.setStatus(); + testsuite.getTestcase().add(testcase); + } + */ + writeReport(testsuite, getOutputStream(name + ".xml")); + } + + private void writeReport(Testsuite testsuite, OutputStream outputStream) { + try { + Marshaller marshaller = JAXBContext.newInstance(ObjectFactory.class).createMarshaller(); + marshaller.marshal(testsuite, outputStream); + } catch (JAXBException e) { + throw new XMLReportException(e); + } + } + + private OutputStream getOutputStream(String reportName) { + FileUtils.mkdir(directory.getAbsolutePath()); + try { + return new FileOutputStream(new File(directory, reportName)); + } catch (FileNotFoundException e) { + throw new XMLReportException(e); + } + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/report/XMLReportException.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/report/XMLReportException.java new file mode 100644 index 00000000..4f0af3c9 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/report/XMLReportException.java @@ -0,0 +1,41 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin.report; + +/** + * @author Nils Olsson + */ +public final class XMLReportException extends RuntimeException { + + /** + *

Constructor for XMLReportException.

+ * + * @param throwable a {@link java.lang.Throwable} object. + */ + public XMLReportException(Throwable throwable) { + super(throwable); + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/source/ChangeContext.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/source/ChangeContext.java new file mode 100644 index 00000000..84f745e4 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/source/ChangeContext.java @@ -0,0 +1,88 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin.source; + +import japa.parser.ast.body.MethodDeclaration; +import org.graphwalker.core.Model; +import org.graphwalker.core.model.Element; + +import java.util.HashSet; +import java.util.Set; + +/** + * @author Nils Olsson + */ +public final class ChangeContext { + + private final Set methodNames; + private final Set methodDeclarations = new HashSet<>(); + + /** + *

Constructor for ChangeContext.

+ * + * @param model a {@link org.graphwalker.core.Model} object. + */ + public ChangeContext(Model model) { + methodNames = extractMethodNames(model); + } + + /** + *

getMethodNames.

+ * + * @return a {@link java.util.Set} object. + */ + public Set getMethodNames() { + return methodNames; + } + + /** + *

addMethodDeclaration.

+ * + * @param methodDeclaration a {@link japa.parser.ast.body.MethodDeclaration} object. + */ + public void addMethodDeclaration(MethodDeclaration methodDeclaration) { + methodDeclarations.add(methodDeclaration); + } + + /** + *

Getter for the field methodDeclarations.

+ * + * @return a {@link java.util.Set} object. + */ + public Set getMethodDeclarations() { + return methodDeclarations; + } + + private Set extractMethodNames(Model model) { + Set methodNames = new HashSet<>(); + for (Element element: model.getElements()) { + if (null != element.getName() && !"Start".equalsIgnoreCase(element.getName())) { + methodNames.add(element.getName()); + } + } + return methodNames; + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/source/CodeGenerator.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/source/CodeGenerator.java new file mode 100644 index 00000000..6086dd9d --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/source/CodeGenerator.java @@ -0,0 +1,180 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin.source; + +import japa.parser.ASTHelper; +import japa.parser.JavaParser; +import japa.parser.ast.CompilationUnit; +import japa.parser.ast.ImportDeclaration; +import japa.parser.ast.LineComment; +import japa.parser.ast.PackageDeclaration; +import japa.parser.ast.body.ClassOrInterfaceDeclaration; +import japa.parser.ast.body.MethodDeclaration; +import japa.parser.ast.body.ModifierSet; +import japa.parser.ast.body.Parameter; +import japa.parser.ast.expr.*; +import japa.parser.ast.visitor.VoidVisitorAdapter; +import org.graphwalker.core.Model; + +import java.io.File; +import java.lang.reflect.Modifier; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * @author Nils Olsson + */ +public final class CodeGenerator extends VoidVisitorAdapter { + + private final SourceFile sourceFile; + private final Model model; + + /** + *

Constructor for CodeGenerator.

+ * + * @param sourceFile a {@link org.graphwalker.maven.plugin.source.SourceFile} object. + * @param model a {@link org.graphwalker.core.Model} object. + */ + public CodeGenerator(SourceFile sourceFile, Model model) { + this.sourceFile = sourceFile; + this.model = model; + } + + /** + *

generate.

+ * + * @return a {@link java.lang.String} object. + */ + public String generate() { + CompilationUnit compilationUnit = getCompilationUnit(); + ChangeContext changeContext = new ChangeContext(model); + visit(compilationUnit, changeContext); + removeMethods(compilationUnit, changeContext); + generateMethods(compilationUnit, changeContext); + return compilationUnit.toString(); + } + + private CompilationUnit getCompilationUnit() { + CompilationUnit compilationUnit; + if (Files.exists(sourceFile.getOutputPath())) { + try { + compilationUnit = JavaParser.parse(sourceFile.getOutputPath().toFile()); + } catch (Throwable t) { + throw new RuntimeException(t); + } + } else { + compilationUnit = new CompilationUnit(); + compilationUnit.setComment(new LineComment(" Generated by GraphWalker (http://www.graphwalker.org)")); + if (!"".equals(sourceFile.getPackageName())) { + compilationUnit.setPackage(createPackageDeclaration(sourceFile)); + } + compilationUnit.setImports(Arrays.asList( + new ImportDeclaration(new NameExpr("org.graphwalker.core.annotation.Model"), false, false), + new ImportDeclaration(new NameExpr("org.graphwalker.core.annotation.Vertex"), false, false), + new ImportDeclaration(new NameExpr("org.graphwalker.core.annotation.Edge"), false, false), + new ImportDeclaration(new NameExpr("org.graphwalker.core.script.ScriptContext"), false, false) + )); + ASTHelper.addTypeDeclaration(compilationUnit, getInterfaceName(sourceFile)); + } + return compilationUnit; + } + + private void removeMethods(CompilationUnit compilationUnit, ChangeContext changeContext) { + if (0 annotations = new ArrayList<>(); + if (methodName.startsWith("v_")) { + List memberValuePairs = new ArrayList<>(); + annotations.add(new NormalAnnotationExpr(ASTHelper.createNameExpr("Vertex"), memberValuePairs)); + } else { + List memberValuePairs = new ArrayList<>(); + annotations.add(new NormalAnnotationExpr(ASTHelper.createNameExpr("Edge"), memberValuePairs)); + } + method.setAnnotations(annotations); + Parameter parameter = ASTHelper.createParameter(ASTHelper.createReferenceType("ScriptContext", 0), "context"); + ASTHelper.addParameter(method, parameter); + ASTHelper.addMember(body, method); + } else { + // TODO: Warn + } + } + } + + private boolean isValidName(String name) { + if (null == name || name.isEmpty()) { + return false; + } + boolean valid = true; + for (int i = 0; i < name.length(); i++) { + if (0 == i) { + valid &= Character.isJavaIdentifierStart(name.charAt(i)); + } else { + valid &= Character.isJavaIdentifierPart(name.charAt(i)); + } + } + return valid; + } + + /** + *

visit.

+ * + * @param methodDeclaration a {@link japa.parser.ast.body.MethodDeclaration} object. + * @param changeContext a {@link org.graphwalker.maven.plugin.source.ChangeContext} object. + */ + public void visit(MethodDeclaration methodDeclaration, ChangeContext changeContext) { + if (changeContext.getMethodNames().contains(methodDeclaration.getName())) { + changeContext.getMethodNames().remove(methodDeclaration.getName()); + } else { + changeContext.addMethodDeclaration(methodDeclaration); + } + } + + private PackageDeclaration createPackageDeclaration(SourceFile sourceFile) { + return new PackageDeclaration(ASTHelper.createNameExpr(sourceFile.getPackageName())); + } + + private ClassOrInterfaceDeclaration getInterfaceName(SourceFile sourceFile) { + ClassOrInterfaceDeclaration classOrInterfaceDeclaration = new ClassOrInterfaceDeclaration(ModifierSet.PUBLIC, false, sourceFile.getFileName()); + List memberValuePairs = new ArrayList<>(); + memberValuePairs.add(new MemberValuePair("file", new StringLiteralExpr(sourceFile.getRelativePath().toString().replace(File.separator, "/")))); + List annotations = new ArrayList<>(); + annotations.add(new NormalAnnotationExpr(ASTHelper.createNameExpr("Model"), memberValuePairs)); + classOrInterfaceDeclaration.setAnnotations(annotations); + classOrInterfaceDeclaration.setInterface(true); + return classOrInterfaceDeclaration; + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/source/SourceFile.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/source/SourceFile.java new file mode 100644 index 00000000..5cd0b2cf --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/source/SourceFile.java @@ -0,0 +1,112 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin.source; + +import org.codehaus.plexus.util.FileUtils; + +import java.io.File; +import java.nio.file.Path; + +/** + * @author Nils Olsson + */ +public final class SourceFile { + + private final Path inputPath; + private final Path relativePath; + private final Path outputPath; + private final String packageName; + + /** + *

Constructor for SourceFile.

+ * + * @param file a {@link java.io.File} object. + * @param baseDirectory a {@link java.io.File} object. + * @param outputDirectory a {@link java.io.File} object. + */ + public SourceFile(File file, File baseDirectory, File outputDirectory) { + this(file.toPath(), baseDirectory.toPath(), outputDirectory.toPath()); + } + + /** + *

Constructor for SourceFile.

+ * + * @param inputPath a {@link java.nio.file.Path} object. + * @param basePath a {@link java.nio.file.Path} object. + * @param outputPath a {@link java.nio.file.Path} object. + */ + public SourceFile(Path inputPath, Path basePath, Path outputPath) { + this.inputPath = inputPath; + this.relativePath = basePath.relativize(inputPath); + this.packageName = this.relativePath.getParent().toString().replace(File.separator, "."); + this.outputPath = outputPath.resolve(this.relativePath).resolveSibling(getFileName() + ".java"); + } + + /** + *

Getter for the field inputPath.

+ * + * @return a {@link java.nio.file.Path} object. + */ + public Path getInputPath() { + return inputPath; + } + + /** + *

Getter for the field relativePath.

+ * + * @return a {@link java.nio.file.Path} object. + */ + public Path getRelativePath() { + return relativePath; + } + + /** + *

Getter for the field outputPath.

+ * + * @return a {@link java.nio.file.Path} object. + */ + public Path getOutputPath() { + return outputPath; + } + + /** + *

Getter for the field packageName.

+ * + * @return a {@link java.lang.String} object. + */ + public String getPackageName() { + return this.packageName; + } + + /** + *

getFileName.

+ * + * @return a {@link java.lang.String} object. + */ + public String getFileName() { + return FileUtils.removeExtension(inputPath.getFileName().toString()); + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/test/Configuration.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/test/Configuration.java new file mode 100644 index 00000000..f3f71dc4 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/test/Configuration.java @@ -0,0 +1,156 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin.test; + +import java.io.File; +import java.util.Set; + +/** + * @author Nils Olsson + */ +public final class Configuration { + + private Set includes; + private Set excludes; + private File testClassesDirectory; + private File classesDirectory; + private File reportsDirectory; + private Set groups; + + /** + *

Constructor for Configuration.

+ */ + public Configuration() { + } + + /** + *

Getter for the field includes.

+ * + * @return a {@link java.util.Set} object. + */ + public Set getIncludes() { + return includes; + } + + /** + *

Setter for the field includes.

+ * + * @param includes a {@link java.util.Set} object. + */ + public void setIncludes(Set includes) { + this.includes = includes; + } + + /** + *

Getter for the field excludes.

+ * + * @return a {@link java.util.Set} object. + */ + public Set getExcludes() { + return excludes; + } + + /** + *

Setter for the field excludes.

+ * + * @param excludes a {@link java.util.Set} object. + */ + public void setExcludes(Set excludes) { + this.excludes = excludes; + } + + /** + *

Getter for the field testClassesDirectory.

+ * + * @return a {@link java.io.File} object. + */ + public File getTestClassesDirectory() { + return testClassesDirectory; + } + + /** + *

Setter for the field testClassesDirectory.

+ * + * @param testClassesDirectory a {@link java.io.File} object. + */ + public void setTestClassesDirectory(File testClassesDirectory) { + this.testClassesDirectory = testClassesDirectory; + } + + /** + *

Getter for the field classesDirectory.

+ * + * @return a {@link java.io.File} object. + */ + public File getClassesDirectory() { + return classesDirectory; + } + + /** + *

Setter for the field classesDirectory.

+ * + * @param classesDirectory a {@link java.io.File} object. + */ + public void setClassesDirectory(File classesDirectory) { + this.classesDirectory = classesDirectory; + } + + /** + *

Getter for the field reportsDirectory.

+ * + * @return a {@link java.io.File} object. + */ + public File getReportsDirectory() { + return reportsDirectory; + } + + /** + *

Setter for the field reportsDirectory.

+ * + * @param reportsDirectory a {@link java.io.File} object. + */ + public void setReportsDirectory(File reportsDirectory) { + this.reportsDirectory = reportsDirectory; + } + + /** + *

Getter for the field groups.

+ * + * @return a {@link java.util.Set} object. + */ + public Set getGroups() { + return groups; + } + + /** + *

Setter for the field groups.

+ * + * @param groups a {@link java.util.Set} object. + */ + public void setGroups(Set groups) { + this.groups = groups; + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/test/Execution.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/test/Execution.java new file mode 100644 index 00000000..c4f5df09 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/test/Execution.java @@ -0,0 +1,143 @@ +/* + * #%L + * GraphWalker Core + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin.test; + +import org.graphwalker.core.Model; +import org.graphwalker.core.PathGenerator; +import org.graphwalker.core.SimpleModel; +import org.graphwalker.core.StopCondition; +import org.graphwalker.maven.plugin.common.AnnotationUtils; +import org.graphwalker.io.factory.GraphMLModelFactory; +import org.graphwalker.io.factory.ModelFactory; + +import java.lang.annotation.Annotation; +import java.nio.file.Path; +import java.nio.file.Paths; + +/** + * @author Nils Olsson + */ +public final class Execution { + + private final Class testClass; + private final Class pathGenerator; + private final Class stopCondition; + private final String stopConditionValue; + private final String language; + private final Model model; + + /** + *

Constructor for Execution.

+ * + * @param testClass a {@link java.lang.Class} object. + * @param pathGenerator a {@link java.lang.Class} object. + * @param stopCondition a {@link java.lang.Class} object. + * @param stopConditionValue a {@link java.lang.String} object. + */ + public Execution(final Class testClass, final Class pathGenerator, final Class stopCondition, String stopConditionValue, String language) { + this.testClass = testClass; + this.stopCondition = stopCondition; + this.pathGenerator = pathGenerator; + this.stopConditionValue = stopConditionValue; + this.language = language; + this.model = createModel(testClass); + } + + private Model createModel(final Class testClass) { + Model model = new SimpleModel(); + ModelFactory factory = new GraphMLModelFactory(); + for (Annotation annotation: AnnotationUtils.getAnnotations(testClass, org.graphwalker.core.annotation.Model.class)) { + Path file = Paths.get(((org.graphwalker.core.annotation.Model) annotation).file()); + if (factory.accept(file)) { + model = model.addModel(factory.create(file.toString())); + } + } + return model; + } + + /** + *

getName.

+ * + * @return a {@link java.lang.String} object. + */ + public String getName() { + return testClass.getName(); + } + + /** + *

Getter for the field testClass.

+ * + * @return a {@link java.lang.Class} object. + */ + public Class getTestClass() { + return testClass; + } + + /** + *

Getter for the field pathGenerator.

+ * + * @return a {@link java.lang.Class} object. + */ + public Class getPathGenerator() { + return pathGenerator; + } + + /** + *

Getter for the field stopCondition.

+ * + * @return a {@link java.lang.Class} object. + */ + public Class getStopCondition() { + return stopCondition; + } + + /** + *

Getter for the field stopConditionValue.

+ * + * @return a {@link java.lang.String} object. + */ + public String getStopConditionValue() { + return stopConditionValue; + } + + /** + *

Getter for the field language.

+ * + * @return a {@link java.lang.String} object. + */ + public String getLanguage() { + return language; + } + + /** + *

Getter for the field model.

+ * + * @return a {@link org.graphwalker.core.Model} object. + */ + public Model getModel() { + return model; + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/test/Scanner.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/test/Scanner.java new file mode 100755 index 00000000..a2a93d85 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/test/Scanner.java @@ -0,0 +1,93 @@ +/* + * #%L + * Maven GraphWalker Plugin + * %% + * Copyright (C) 2011 - 2012 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin.test; + +import org.codehaus.plexus.util.DirectoryScanner; +import org.graphwalker.core.annotation.GraphWalker; + +import java.io.File; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +/** + * @author Nils Olsson + */ +public final class Scanner { + + /** + *

scan.

+ * + * @param directories a {@link java.io.File} object. + * @return a {@link java.util.Collection} object. + */ + public Collection> scan(File... directories) { + Map> tests = new HashMap<>(); + for (File directory: directories) { + scan(tests, directory); + } + return tests.values(); + } + + private void scan(Map> tests, File directory) { + for (String fileName: findFiles(directory)) { + try { + String className = getClassName(fileName); + Class clazz = loadClass(className); + if (acceptClass(clazz)) { + tests.put(className, clazz); + } + } catch (ClassNotFoundException e) { + // ignore + } + } + } + + private String[] findFiles(File directory) { + if (directory.exists()) { + DirectoryScanner directoryScanner = new DirectoryScanner(); + directoryScanner.setIncludes(new String[]{"**/*.class"}); + directoryScanner.setBasedir(directory); + directoryScanner.setCaseSensitive(true); + directoryScanner.scan(); + return directoryScanner.getIncludedFiles(); + } else { + return new String[]{}; + } + } + private boolean acceptClass(Class clazz) { + return clazz.isAnnotationPresent(GraphWalker.class); + } + + private Class loadClass(String className) throws ClassNotFoundException { + return Thread.currentThread().getContextClassLoader().loadClass(className); + } + + private String getClassName(String fileName) { + return fileName.substring(0, fileName.indexOf(".")).replace(File.separatorChar, '.'); + } + +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/test/TestGroup.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/test/TestGroup.java new file mode 100644 index 00000000..367d3137 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/test/TestGroup.java @@ -0,0 +1,74 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin.test; + +import java.util.HashSet; +import java.util.Set; + +/** + * @author Nils Olsson + */ +public final class TestGroup { + + private final String name; + private final Set executions = new HashSet<>(); + + /** + *

Constructor for TestGroup.

+ * + * @param name a {@link java.lang.String} object. + */ + public TestGroup(String name) { + this.name = name; + } + + /** + *

Getter for the field name.

+ * + * @return a {@link java.lang.String} object. + */ + public String getName() { + return name; + } + + /** + *

addExecution.

+ * + * @param execution a {@link org.graphwalker.maven.plugin.test.Execution} object. + */ + public void addExecution(Execution execution) { + executions.add(execution); + } + + /** + *

Getter for the field executions.

+ * + * @return a {@link java.util.Set} object. + */ + public Set getExecutions() { + return executions; + } +} diff --git a/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/test/TestManager.java b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/test/TestManager.java new file mode 100644 index 00000000..a77c378b --- /dev/null +++ b/graphwalker-maven-plugin/src/main/java/org/graphwalker/maven/plugin/test/TestManager.java @@ -0,0 +1,168 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2013 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin.test; + +import org.codehaus.plexus.util.SelectorUtils; +import org.graphwalker.core.PathGenerator; +import org.graphwalker.core.StopCondition; +import org.graphwalker.core.annotation.Execute; +import org.graphwalker.core.annotation.GraphWalker; + +import java.util.*; + +/** + * @author Nils Olsson + */ +public final class TestManager { + + private final Configuration configuration; + private final Collection executionGroups; + + /** + *

Constructor for TestManager.

+ * + * @param configuration a {@link org.graphwalker.maven.plugin.test.Configuration} object. + * @param testClasses a {@link java.util.Collection} object. + */ + public TestManager(Configuration configuration, Collection> testClasses) { + this.configuration = configuration; + this.executionGroups = createExecutionGroups(filterTestClasses(testClasses)); + } + + + private Collection> filterTestClasses(Collection> testClasses) { + Set> filteredClasses = new HashSet<>(testClasses.size()); + for (Class testClass: testClasses) { + if (isIncluded(testClass)) { + filteredClasses.add(testClass); + } + } + return filteredClasses; + } + + private boolean isIncluded(Class testClass) { + String name = testClass.getName(); + for (String excluded: configuration.getExcludes()) { + if (SelectorUtils.match(excluded, name, true)) { + return false; + } + } + for (String included: configuration.getIncludes()) { + if (SelectorUtils.match(included, name, true)) { + return true; + } + } + return false; + } + + @SuppressWarnings("unchecked") + private static Class cast(Object event) { + return (Class)event; + } + + private Collection createExecutionGroups(Collection> testClasses) { + Map groups = new HashMap<>(); + for (Class testClass: testClasses) { + Execute[] executions = testClass.getAnnotation(GraphWalker.class).value(); + if (0 == executions.length) { + try { + // if no Execute parameter is supplied the we create a default + String groupName = (String)Execute.class.getMethod("group").getDefaultValue(); + Class pathGenerator = cast(Execute.class.getMethod("pathGenerator").getDefaultValue()); + Class stopCondition = cast(Execute.class.getMethod("stopCondition").getDefaultValue()); + String stopConditionValue = (String)Execute.class.getMethod("stopConditionValue").getDefaultValue(); + String language = (String)Execute.class.getMethod("language").getDefaultValue(); + Execution execution = new Execution(testClass, pathGenerator, stopCondition, stopConditionValue, language); + groups.put(groupName, new TestGroup(groupName)); + groups.get(groupName).addExecution(execution); + } catch (NoSuchMethodException e) { + e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + } + } else { + for (Execute execute: executions) { + if (isExecutionGroup(execute.group())) { + if (!groups.containsKey(execute.group())) { + groups.put(execute.group(), new TestGroup(execute.group())); + } + Execution execution = new Execution(testClass, execute.pathGenerator(), execute.stopCondition(), execute.stopConditionValue(), execute.language()); + groups.get(execute.group()).addExecution(execution); + } + } + } + } + return groups.values(); + } + + private boolean isExecutionGroup(String name) { + for (String group: configuration.getGroups()) { + if (SelectorUtils.match(group, name, true)) { + return true; + } + } + return false; + } + + /** + *

Getter for the field executionGroups.

+ * + * @return a {@link java.util.Collection} object. + */ + public Collection getExecutionGroups() { + return executionGroups; + } + + /** + *

Getter for the field configuration.

+ * + * @return a {@link org.graphwalker.maven.plugin.test.Configuration} object. + */ + public Configuration getConfiguration() { + return configuration; + } + + /** + *

getGroupCount.

+ * + * @return a int. + */ + public int getGroupCount() { + return getExecutionGroups().size(); + } + + /** + *

getTestCount.

+ * + * @return a int. + */ + public int getTestCount() { + int count = 0; + for (TestGroup group: getExecutionGroups()) { + count += group.getExecutions().size(); + } + return count; + } + +} diff --git a/graphwalker-maven-plugin/src/main/resources/META-INF/maven/lifecycle.xml b/graphwalker-maven-plugin/src/main/resources/META-INF/maven/lifecycle.xml new file mode 100644 index 00000000..87f8774a --- /dev/null +++ b/graphwalker-maven-plugin/src/main/resources/META-INF/maven/lifecycle.xml @@ -0,0 +1,69 @@ + + + + graphwalker + + + generate-sources + + + + validate-models + generate-sources + + + + + + generate-test-sources + + + + validate-test-models + generate-test-sources + + + + + + test + + + + test + + + + + false + + + + + + diff --git a/graphwalker-maven-plugin/src/main/resources/junit-4.xsd b/graphwalker-maven-plugin/src/main/resources/junit-4.xsd new file mode 100644 index 00000000..a1d5ab04 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/resources/junit-4.xsd @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/graphwalker-maven-plugin/src/main/resources/plugin.properties b/graphwalker-maven-plugin/src/main/resources/plugin.properties new file mode 100755 index 00000000..4c35e346 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/resources/plugin.properties @@ -0,0 +1,33 @@ +### +# #%L +# Maven GraphWalker Plugin +# %% +# Copyright (C) 2012 GraphWalker +# %% +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# #L% +### + +result.label = Result : +result.summary = Groups: {0}, Tests: {1}, Completed: {2}, Failed: {3}, Not Executed: {4} + +exception.execution.failed = There are test failures.\n\n Please refer to {0} for the individual test results. +exception.execution.interrupted = Execution interrupted +exception.create.test = Couldn''t create test +exception.create.classloader = Couldn''t create class loader diff --git a/graphwalker-maven-plugin/src/main/resources/plugin_es_ES.properties b/graphwalker-maven-plugin/src/main/resources/plugin_es_ES.properties new file mode 100755 index 00000000..95adf6e0 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/resources/plugin_es_ES.properties @@ -0,0 +1,25 @@ +### +# #%L +# Maven GraphWalker Plugin +# %% +# Copyright (C) 2012 GraphWalker +# %% +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# #L% +### diff --git a/graphwalker-maven-plugin/src/main/resources/plugin_sv_SE.properties b/graphwalker-maven-plugin/src/main/resources/plugin_sv_SE.properties new file mode 100755 index 00000000..95adf6e0 --- /dev/null +++ b/graphwalker-maven-plugin/src/main/resources/plugin_sv_SE.properties @@ -0,0 +1,25 @@ +### +# #%L +# Maven GraphWalker Plugin +# %% +# Copyright (C) 2012 GraphWalker +# %% +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# #L% +### diff --git a/graphwalker-maven-plugin/src/test/java/org/graphwalker/maven/plugin/source/CodeGeneratorTest.java b/graphwalker-maven-plugin/src/test/java/org/graphwalker/maven/plugin/source/CodeGeneratorTest.java new file mode 100644 index 00000000..7264924d --- /dev/null +++ b/graphwalker-maven-plugin/src/test/java/org/graphwalker/maven/plugin/source/CodeGeneratorTest.java @@ -0,0 +1,88 @@ +/* + * #%L + * GraphWalker Maven Plugin + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.maven.plugin.source; + +import org.graphwalker.core.Model; +import org.graphwalker.core.SimpleModel; +import org.graphwalker.core.common.Assert; +import org.graphwalker.core.model.Edge; +import org.graphwalker.core.model.Guard; +import org.graphwalker.core.model.Vertex; +import org.junit.Test; + +import java.nio.file.Paths; + +/** + * @author Nils Olsson + */ +public class CodeGeneratorTest { + + @Test + public void unnamedElement() { + Model model = new SimpleModel().addEdge(new Edge(null, new Vertex("Start"), new Vertex("Verify"), new Guard("isConnected()"))); + SourceFile sourceFile = new SourceFile(Paths.get("/example/test.graphml"), Paths.get("/"), Paths.get("/")); + CodeGenerator codeGenerator = new CodeGenerator(sourceFile, model); + String output = codeGenerator.generate(); + Assert.assertFalse(output.contains("Start")); + Assert.assertFalse(output.contains("isConnected()")); + Assert.assertTrue(output.contains("Verify")); + } + + @Test + public void unnamedElements() { + Model model = new SimpleModel().addEdge(new Edge(null, new Vertex("Start"), new Vertex("Verify"), new Guard("isConnected()"))) + .addEdge(new Edge(null, new Vertex("Verify"), new Vertex(null), new Guard("isCompleted()"))); + SourceFile sourceFile = new SourceFile(Paths.get("/example/test.graphml"), Paths.get("/"), Paths.get("/")); + CodeGenerator codeGenerator = new CodeGenerator(sourceFile, model); + String output = codeGenerator.generate(); + Assert.assertFalse(output.contains("Start")); + Assert.assertFalse(output.contains("isConnected()")); + Assert.assertTrue(output.contains("Verify")); + } + + @Test + public void emptyElementName() { + Model model = new SimpleModel().addEdge(new Edge("", new Vertex("Start"), new Vertex("Verify"), new Guard("isConnected()"))); + SourceFile sourceFile = new SourceFile(Paths.get("/example/test.graphml"), Paths.get("/"), Paths.get("/")); + CodeGenerator codeGenerator = new CodeGenerator(sourceFile, model); + String output = codeGenerator.generate(); + Assert.assertFalse(output.contains("Start")); + Assert.assertFalse(output.contains("isConnected()")); + Assert.assertTrue(output.contains("Verify")); + } + + @Test + public void emptyElementNames() { + Model model = new SimpleModel().addEdge(new Edge("", new Vertex("Start"), new Vertex("Verify"), new Guard("isConnected()"))) + .addEdge(new Edge("", new Vertex("Verify"), new Vertex(""), new Guard("isCompleted()"))); + SourceFile sourceFile = new SourceFile(Paths.get("/example/test.graphml"), Paths.get("/"), Paths.get("/")); + CodeGenerator codeGenerator = new CodeGenerator(sourceFile, model); + String output = codeGenerator.generate(); + Assert.assertFalse(output.contains("Start")); + Assert.assertFalse(output.contains("isConnected()")); + Assert.assertTrue(output.contains("Verify")); + } +} diff --git a/graphwalker-soap/pom.xml b/graphwalker-soap/pom.xml new file mode 100644 index 00000000..605be81d --- /dev/null +++ b/graphwalker-soap/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + + + org.graphwalker + graphwalker + 3.0-BETA-SNAPSHOT + + + graphwalker-soap + GraphWalker SOAP + + + + junit + junit + test + + + + + + + org.jvnet.jax-ws-commons + jaxws-maven-plugin + + + wsgen + + wsgen + + + org.graphwalker.soap.BaseSoapService + true + + + + + + + \ No newline at end of file diff --git a/graphwalker-soap/src/main/java/org/graphwalker/soap/BaseSoapService.java b/graphwalker-soap/src/main/java/org/graphwalker/soap/BaseSoapService.java new file mode 100644 index 00000000..609cfb70 --- /dev/null +++ b/graphwalker-soap/src/main/java/org/graphwalker/soap/BaseSoapService.java @@ -0,0 +1,200 @@ +/* + * #%L + * GraphWalker SOAP + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.soap; + +import javax.jws.WebService; + +/** + * @author Nils Olsson + */ +@WebService(endpointInterface = "org.graphwalker.soap.SoapService") +public class BaseSoapService implements SoapService { + + @Override + public boolean ping() { + return true; + } + +/* + private static Logger logger = Util.setupLogger(SoapServices.class); + private Vector stepPair = new Vector(); + public String xmlFile = ""; + private boolean hardStop = false; + public ModelBasedTesting mbt; + + public SoapServices() {} + + public SoapServices(ModelBasedTesting mbt) { + this.mbt = mbt; + Reset(); + } + + public boolean SetCurrentVertex(String newVertex) { + logger.debug("SOAP service SetCurrentVertex recieving: " + newVertex); + boolean value = mbt.setCurrentVertex(newVertex); + logger.debug("SOAP service SetCurrentVertex returning: " + value); + return value; + } + + public String GetDataValue(String data) { + logger.debug("SOAP service getDataValue recieving: " + data); + String value = ""; + try { + value = mbt.getDataValue(data); + } catch (InvalidDataException e) { + logger.error(e); + } + logger.debug("SOAP service getDataValue returning: " + value); + return value; + } + + public String ExecAction(String action) { + logger.debug("SOAP service ExecAction recieving: " + action); + String value = ""; + try { + value = mbt.execAction(action); + } catch (InvalidDataException e) { + logger.error(e); + } catch (Exception e) { + logger.error(e); + } + logger.debug("SOAP service ExecAction returning: " + value); + return value; + } + + public void PassRequirement(String pass) { + logger.debug("SOAP service PassRequirement recieving: " + pass); + if ("TRUE".equalsIgnoreCase(pass)) { + mbt.passRequirement(true); + } else if ("FALSE".equalsIgnoreCase(pass)) { + mbt.passRequirement(false); + } else { + logger.error("SOAP service PassRequirement dont know how to handle: " + pass + "\nOnly the strings true or false are permitted"); + } + } + + public String GetNextStep() { + logger.debug("SOAP service getNextStep"); + String value = ""; + + if (!mbt.hasNextStep() && (stepPair.size() == 0)) { + return value; + } + + if (stepPair.size() == 0) { + try { + stepPair = new Vector(Arrays.asList(mbt.getNextStep())); + } catch (Exception e) { + hardStop = true; + return ""; + } + } + + value = stepPair.remove(0); + value = value.replaceAll("/.*$", ""); + String addInfo = ""; + + if (stepPair.size() == 1) { + mbt.logExecution(mbt.getMachine().getLastEdge(), addInfo); + if (mbt.isUseStatisticsManager()) { + mbt.getStatisticsManager().addProgress(mbt.getMachine().getLastEdge()); + } + } else { + mbt.logExecution(mbt.getMachine().getCurrentVertex(), addInfo); + if (mbt.isUseStatisticsManager()) { + mbt.getStatisticsManager().addProgress(mbt.getMachine().getCurrentVertex()); + } + } + return value; + } + + public boolean HasNextStep() { + logger.debug("SOAP service hasNextStep"); + boolean value = false; + if (hardStop) { + value = false; + } else { + value = stepPair.size() != 0 || mbt.hasNextStep(); + } + logger.debug("SOAP service hasNextStep returning: " + value); + if (!value) { + logger.info(mbt.getStatisticsString()); + } + return value; + } + + public boolean Reload() { + logger.debug("SOAP service reload"); + boolean retValue = true; + try { + if (!this.xmlFile.isEmpty()) { + mbt = Util.loadMbtAsWSFromXml(Util.getFile(this.xmlFile)); + } + } catch (Exception e) { + Util.logStackTraceToError(e); + retValue = false; + } + Reset(); + logger.debug("SOAP service reload returning: " + retValue); + return retValue; + } + + public boolean Load(String xmlFile) { + logger.debug("SOAP service load recieving: " + xmlFile); + if (xmlFile == null) { + logger.error("Web service 'Load' needs a valid xml file name."); + logger.debug("SOAP service load returning: false"); + return false; + } + if (!new File(xmlFile).canRead()) { + logger.error("Web service 'Load' needs a readable xml file name. Check the file: '" + xmlFile + "'"); + logger.debug("SOAP service load returning: false"); + return false; + } + this.xmlFile = xmlFile; + boolean retValue = true; + try { + mbt = Util.loadMbtAsWSFromXml(Util.getFile(this.xmlFile)); + } catch (Exception e) { + Util.logStackTraceToError(e); + retValue = false; + } + Reset(); + logger.debug("SOAP service load returning: " + retValue); + return retValue; + } + + public String GetStatistics() { + logger.debug("SOAP service getStatistics"); + return mbt.getStatisticsVerbose(); + } + + private void Reset() { + hardStop = false; + stepPair.clear(); + } +*/ +} diff --git a/graphwalker-soap/src/main/java/org/graphwalker/soap/SoapService.java b/graphwalker-soap/src/main/java/org/graphwalker/soap/SoapService.java new file mode 100644 index 00000000..3e44d1c8 --- /dev/null +++ b/graphwalker-soap/src/main/java/org/graphwalker/soap/SoapService.java @@ -0,0 +1,48 @@ +/* + * #%L + * GraphWalker SOAP + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.soap; + +import javax.jws.WebService; + +/** + * @author Nils Olsson + */ +@WebService +public interface SoapService { + + boolean ping(); +/* + boolean setCurrentVertex(String newVertex); + String getDataValue(String data): + String execAction(String action); + void passRequirement(String pass); + String getNextStep(); + boolean hasNextStep(); + boolean reload(); + boolean load(String xmlFile); + String getStatistics(); +*/ +} diff --git a/graphwalker-soap/src/test/java/org/graphwalker/soap/SoapServiceTest.java b/graphwalker-soap/src/test/java/org/graphwalker/soap/SoapServiceTest.java new file mode 100644 index 00000000..c16600e8 --- /dev/null +++ b/graphwalker-soap/src/test/java/org/graphwalker/soap/SoapServiceTest.java @@ -0,0 +1,73 @@ +/* + * #%L + * GraphWalker SOAP + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +package org.graphwalker.soap; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import javax.xml.namespace.QName; +import javax.xml.ws.Endpoint; +import javax.xml.ws.Service; +import java.net.MalformedURLException; +import java.net.URL; + +/** + * @author Nils Olsson + */ +public class SoapServiceTest { + + private Endpoint endpoint; + + @Before + public void setup() { + endpoint = Endpoint.publish("http://localhost:8080/graphwalker", new BaseSoapService()); + Assert.assertTrue(endpoint.isPublished()); + Assert.assertEquals("http://schemas.xmlsoap.org/wsdl/soap/http", endpoint.getBinding().getBindingID()); + } + + @After + public void teardown() { + endpoint.stop(); + Assert.assertFalse(endpoint.isPublished()); + } + + private SoapService getService() throws MalformedURLException { + URL url = new URL("http://localhost:8080/graphwalker?wsdl"); + String namespaceURI = "http://soap.graphwalker.org/"; + String servicePart = "BaseSoapServiceService"; + String portName = "BaseSoapServicePort"; + QName serviceQN = new QName(namespaceURI, servicePart); + QName portQN = new QName(namespaceURI, portName); + return Service.create(url, serviceQN).getPort(portQN, SoapService.class); + } + + @Test + public void ping() throws MalformedURLException { + Assert.assertTrue(getService().ping()); + } +} diff --git a/graphwalker-webrenderer/pom.xml b/graphwalker-webrenderer/pom.xml new file mode 100644 index 00000000..674519d8 --- /dev/null +++ b/graphwalker-webrenderer/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + + + org.graphwalker + graphwalker + 3.0-BETA-SNAPSHOT + + + graphwalker-webrenderer + GraphWalker Web Renderer + + + + org.graphwalker + graphwalker-core + + + org.webbitserver + webbit + + + com.googlecode.json-simple + json-simple + + + org.graphstream + gs-core + 1.2 + + + org.graphstream + gs-algo + 1.2 + + + + \ No newline at end of file diff --git a/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/HierarchicalLayout.java b/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/HierarchicalLayout.java new file mode 100644 index 00000000..1ebf57ff --- /dev/null +++ b/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/HierarchicalLayout.java @@ -0,0 +1,451 @@ +package org.graphwalker.webrenderer; + +/* + * #%L + * GraphWalker Web Renderer + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ + +import org.graphstream.algorithm.Prim; +import org.graphstream.algorithm.SpanningTree; +import org.graphstream.algorithm.util.FibonacciHeap; +import org.graphstream.graph.Edge; +import org.graphstream.graph.Graph; +import org.graphstream.graph.Node; +import org.graphstream.graph.implementations.AdjacencyListGraph; +import org.graphstream.stream.PipeBase; +import org.graphstream.ui.geom.Point3; +import org.graphstream.ui.layout.Layout; + +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.LinkedList; + +/** + * @author Nils Olsson + */ +public class HierarchicalLayout extends PipeBase implements Layout { + + public static enum Rendering { + VERTICAL, HORIZONTAL, DISK + } + + private final LinkedList roots; + private final Graph internalGraph; + private boolean structureChanged; + private Rendering renderingType; + private Point3 hi, lo; + private long lastStep; + private int nodeMoved; + + public HierarchicalLayout() { + roots = new LinkedList<>(); + internalGraph = new AdjacencyListGraph("hierarchical_layout-intern"); + hi = new Point3(); + lo = new Point3(); + renderingType = Rendering.VERTICAL; + } + + public Graph getGraph() { + return internalGraph; + } + + public void clear() { + } + + public void compute() { + nodeMoved = 0; + + if (structureChanged) { + structureChanged = false; + computePositions(); + } + + publishPositions(); + lastStep = System.currentTimeMillis(); + } + + protected void computePositions() { + final int[] levels = new int[internalGraph.getNodeCount()]; + Arrays.fill(levels, -1); + + LinkedList roots = new LinkedList<>(), roots2 = new LinkedList<>(); + + if (this.roots.size() > 0) { + for (String root : this.roots) roots.add(internalGraph.getNode(root)); + } + + SpanningTree tree = new Prim("weight", "inTree"); + tree.init(internalGraph); + tree.compute(); + + if (roots.size() == 0) { + int max = internalGraph.getNode(0).getDegree(); + int maxIndex = 0; + + for (int i = 1; i < internalGraph.getNodeCount(); i++) + if (internalGraph.getNode(i).getDegree() > max) { + max = internalGraph.getNode(i).getDegree(); + maxIndex = i; + } + + roots.add(internalGraph.getNode(maxIndex)); + } + + Box rootBox = new Box(); + LevelBox rootLevelBox = new LevelBox(0); + LinkedList levelBoxes = new LinkedList<>(); + + rootLevelBox.add(rootBox); + levelBoxes.add(rootLevelBox); + + for (Node n : roots) { + levels[n.getIndex()] = 0; + setBox(rootBox, n); + } + + do { + while (roots.size() > 0) { + Node root = roots.poll(); + int level = levels[root.getIndex()] + 1; + Box box = getChildrenBox(root); + + for (Edge e : root.getEdgeSet()) { + if (e.getAttribute(tree.getFlagAttribute()).equals( + tree.getFlagOn())) { + Node op = e.getOpposite(root); + + if (levels[op.getIndex()] < 0 + || level < levels[op.getIndex()]) { + levels[op.getIndex()] = level; + roots2.add(op); + op.setAttribute("parent", root); + setBox(box, op); + } + } + } + } + + roots.addAll(roots2); + roots2.clear(); + } while (roots.size() > 0); + + FibonacciHeap boxes = new FibonacciHeap<>(); + boxes.add(0, rootBox); + + for (int i = 0; i < internalGraph.getNodeCount(); i++) { + Box box = getChildrenBox(internalGraph.getNode(i)); + + if (box != null) { + boxes.add(box.level, box); + + while (levelBoxes.size() <= box.level) + levelBoxes.add(new LevelBox(levelBoxes.size())); + + levelBoxes.get(box.level).add(box); + } + } + + for (LevelBox levelBox : levelBoxes) levelBox.sort(); + + while (boxes.size() > 0) + renderBox(boxes.extractMin()); + + hi.x = hi.y = Double.MIN_VALUE; + lo.x = lo.y = Double.MAX_VALUE; + + for (int idx = 0; idx < internalGraph.getNodeCount(); idx++) { + Node n = internalGraph.getNode(idx); + double y = n.getNumber("y"); + double x = n.getNumber("x"); + + if (!n.hasNumber("oldX") || n.getNumber("oldX") != x + || !n.hasNumber("oldY") || n.getNumber("oldY") != y) { + n.setAttribute("oldX", x); + n.setAttribute("oldY", y); + n.addAttribute("changed"); + nodeMoved++; + } + + hi.x = Math.max(hi.x, x); + hi.y = Math.max(hi.y, y); + lo.x = Math.min(lo.x, x); + lo.y = Math.min(lo.y, y); + } + } + + protected void setBox(Box box, Node node) { + if (node.hasAttribute("box")) + getBox(node).remove(node); + + box.add(node); + node.setAttribute("box", box); + + if (!node.hasAttribute("children")) + node.addAttribute("children", new Box(node, 1)); + + getChildrenBox(node).level = box.level + 1; + } + + protected static Box getBox(Node node) { + return node.getAttribute("box"); + } + + protected static Box getChildrenBox(Node node) { + return node.getAttribute("children"); + } + + protected void renderBox(Box box) { + if (box.size() == 0) + return; + + for (int i = 0; i < box.size(); i++) { + Node n = box.get(i); + + switch (renderingType) { + case VERTICAL: + n.setAttribute("x", box.width * i / (double) box.size()); + n.setAttribute("y", box.height / 2); + break; + case DISK: + case HORIZONTAL: + n.setAttribute("x", box.width / 2); + n.setAttribute("y", box.height * i / (double) box.size()); + break; + } + } + + double sx = 1, sy = 1; + double dx = 0, dy = 0; + + if (box.parent != null) { + Box parentBox = getBox(box.parent); + + switch (renderingType) { + case VERTICAL: + sx = 1 / (double) parentBox.size(); + sy = 1 / Math.pow(2, box.level); + break; + case DISK: + case HORIZONTAL: + sx = 1 / Math.pow(2, box.level); + sy = 1 / (double) parentBox.size(); + break; + } + } + + box.scale(sx, sy); + + if (box.parent != null) { + Box parentBox = getBox(box.parent); + + dx = box.parent.getNumber("x"); + dy = box.parent.getNumber("y"); + + switch (renderingType) { + case VERTICAL: + dx -= box.width / 2; + dy += parentBox.height / 2; + break; + case DISK: + case HORIZONTAL: + dx += parentBox.width / 2; + dy -= box.height / 2; + break; + } + } + + box.translate(dx, dy); + } + + protected void publishPositions() { + for (Node n : internalGraph) { + if (n.hasAttribute("changed")) { + n.removeAttribute("changed"); + + sendNodeAttributeChanged(sourceId, n.getId(), "xyz", null, + new double[]{n.getNumber("x"), n.getNumber("y"), 0}); + } + } + } + + public void freezeNode(String id, boolean frozen) { + } + + public double getForce() { + return 0; + } + + public Point3 getHiPoint() { + return hi; + } + + public long getLastStepTime() { + return lastStep; + } + + public String getLayoutAlgorithmName() { + return "Hierarchical"; + } + + public Point3 getLowPoint() { + return lo; + } + + public int getNodeMovedCount() { + return nodeMoved; + } + + public double getQuality() { + return 0; + } + + public double getStabilization() { + return 1 - nodeMoved / (double) internalGraph.getNodeCount(); + } + + public double getStabilizationLimit() { + return 1; + } + + public int getSteps() { + return 0; + } + + public void moveNode(String id, double x, double y, double z) { + } + + public void setForce(double value) { + } + + public void setQuality(double qualityLevel) { + } + + public void setSendNodeInfos(boolean send) { + } + + public void setStabilizationLimit(double value) { + } + + public void shake() { + } + + public void nodeAdded(String sourceId, long timeId, String nodeId) { + internalGraph.addNode(nodeId); + structureChanged = true; + } + + public void nodeRemoved(String sourceId, long timeId, String nodeId) { + internalGraph.removeNode(nodeId); + structureChanged = true; + } + + public void edgeAdded(String sourceId, long timeId, String edgeId, String fromId, String toId, boolean directed) { + internalGraph.addEdge(edgeId, fromId, toId, directed); + structureChanged = true; + } + + public void edgeRemoved(String sourceId, long timeId, String edgeId) { + internalGraph.removeEdge(edgeId); + structureChanged = true; + } + + public void graphCleared(String sourceId, long timeId) { + internalGraph.clear(); + structureChanged = true; + } + + static class Box extends LinkedList { + private static final long serialVersionUID = -1929536876444346726L; + + Node parent; + int level; + double x, y; + double width, height; + int order; + + Box() { + this(null, 0); + } + + Box(Node parent, int level) { + this.parent = parent; + this.level = level; + this.width = 5; + this.height = 1; + this.order = 0; + this.x = 0; + this.y = 0; + } + + void scale(double sx, double sy) { + width *= sx; + height *= sy; + + for (Node edges : this) { + edges.setAttribute("x", sx * edges.getNumber("x")); + edges.setAttribute("y", sy * edges.getNumber("y")); + } + } + + void translate(double dx, double dy) { + for (Node edges : this) { + edges.setAttribute("x", dx + edges.getNumber("x")); + edges.setAttribute("y", dy + edges.getNumber("y")); + } + } + } + + static class LevelBox extends LinkedList { + private static final long serialVersionUID = -5818919480025868466L; + + int level; + + LevelBox(int level) { + this.level = level; + } + + void sort() { + if (level > 0) { + Collections.sort(this, new Comparator() { + public int compare(Box b0, Box b1) { + Box pb0 = getBox(b0.parent); + Box pb1 = getBox(b1.parent); + + if (pb0.order < pb1.order) + return -1; + else if (pb0.order > pb1.order) + return 1; + + return 0; + } + }); + } + + for (int i = 0; i < size(); i++) + get(i).order = i; + } + } +} + diff --git a/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/WebRenderer.java b/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/WebRenderer.java new file mode 100644 index 00000000..bdf7bacb --- /dev/null +++ b/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/WebRenderer.java @@ -0,0 +1,340 @@ +package org.graphwalker.webrenderer; + +/* + * #%L + * GraphWalker Web Renderer + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ + +import org.graphstream.graph.Graph; +import org.graphstream.graph.Node; +import org.graphwalker.core.Machine; +import org.graphwalker.core.event.MachineSink; +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.model.Edge; +import org.graphwalker.core.model.Vertex; +import org.json.simple.JSONObject; +import org.webbitserver.*; +import org.webbitserver.handler.EmbeddedResourceHandler; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * @author Nils Olsson + */ +public class WebRenderer extends BaseWebSocketHandler implements MachineSink { + + private final Machine machine; + private final WebServer server; + private final Set connections = new HashSet<>(); + + public WebRenderer(Machine machine) { + this(machine, 9191); + } + + public WebRenderer(Machine machine, int port) { + this(machine, "/graphwalker", port); + } + + public WebRenderer(Machine machine, String path, int port) { + this.machine = machine; + this.server = WebServers.createWebServer(port); + this.server.add(path, this); + this.server.add(new EmbeddedResourceHandler("")); + } + + public WebServer add(HttpHandler handler) { + return server.add(handler); + } + + public void start() { + server.start(); + } + + public void stop() { + for (WebSocketConnection connection : connections) { + connection.close(); + } + server.stop(); + } + + private HierarchicalLayout doLayout(ExecutionContext context) { + HierarchicalLayout layout = new HierarchicalLayout(); + for (Vertex vertex : context.getModel().getVertices()) { + layout.nodeAdded(context.getModel().toString(), 0, vertex.getName()); + } + for (Edge edge : context.getModel().getEdges()) { + layout.edgeAdded(context.getModel().toString(), 0, edge.getName(), edge.getSourceVertex().getName(), edge.getTargetVertex().getName(), true); + } + layout.compute(); + return layout; + } + + private JSONObject build(Machine machine) { + JSONObject root = new JSONObject(); + root.put("type", "initial"); + List models = new ArrayList<>(); + for (ExecutionContext context : machine.getExecutionContexts()) { + Graph graph = doLayout(context).getGraph(); + JSONObject model = new JSONObject(); + model.put("state", "started"); + model.put("id", "123"); + model.put("name", "123"); + List vertices = new ArrayList<>(); + for (Node node : graph.getNodeSet()) { + Vertex vertex = context.getModel().getVertex(node.getId()); + JSONObject element = new JSONObject(); + element.put("id", node.getId()); + element.put("state", "unvisited"); + element.put("color", "#555555"); + element.put("label", vertex.getName()); + JSONObject geometry = new JSONObject(); + geometry.put("x", 100 * (Double) node.getAttribute("x")); //TODO: convert to the viewers coordinate space + geometry.put("y", 100 * (Double) node.getAttribute("y")); + geometry.put("width", 100); + geometry.put("height", 50); + element.put("geometry", geometry); + vertices.add(element); + } + model.put("nodes", vertices); + List edges = new ArrayList<>(); + for (org.graphstream.graph.Edge layoutEdge : graph.getEdgeSet()) { + //Edge edge = context.getModel().getEdges(layoutEdge.getId()).get(0); + JSONObject element = new JSONObject(); + element.put("id", layoutEdge.getId()); + element.put("source", layoutEdge.getSourceNode().getId()); + element.put("target", layoutEdge.getTargetNode().getId()); + element.put("state", "unvisited"); + JSONObject edgeLabel = new JSONObject(); + //edgeLabel.put("x", edge.getLabel().getX()); + //edgeLabel.put("y", edge.getLabel().getY()); + //edgeLabel.put("label", edge.getLabel().getText()); + JSONObject edgePath = new JSONObject(); + edgePath.put("sx", 0);//edge.getPathSource().getX()); + edgePath.put("sy", 0);//edge.getPathSource().getY()); + edgePath.put("tx", 0);//edge.getPathTarget().getX()); + edgePath.put("ty", 0);//edge.getPathTarget().getY()); + List pathPoints = new ArrayList<>(); + //for (Point point : edge.getPathPoints()) { + // JSONObject pathPoint = new JSONObject(); + // pathPoint.put("x", point.getX()); + // pathPoint.put("y", point.getY()); + // pathPoints.add(pathPoint); + //} + edgePath.put("points", pathPoints); + element.put("path", edgePath); + element.put("label", edgeLabel); + edges.add(element); + } + model.put("edges", edges); + model.put("variables", new ArrayList()); + models.add(model); + } + root.put("models", models); + return root; + } + + @Override + public void onOpen(WebSocketConnection connection) { + connections.add(connection); + connection.send(build(machine).toJSONString()); + } + + @Override + public void onClose(WebSocketConnection connection) { + connections.remove(connection); + } + + + //private static //logger //logger = Util.setupLogger(WebRendererOld.class); + +// private WebSocketConnection wsConnection = null; +// +// private JSONObject model; +// private JSONObject edge; +// private JSONObject node; +// private JSONObject point; +// private JSONObject allModels; +// private JSONObject updateModels; +// +// private String stringTest = ""; +// +// private List edges; +// private List nodes; +// private List models; +// private List points; +// private List updateBuffer = new ArrayList(); +// +// //private ModelHandler modelHandler = null; +// //private Map mbts = new HashMap(); +// +// //public WebRendererOld(ModelHandler modelHandler, String name, ModelAPI api) { +// // this.modelHandler = modelHandler; +// // addModel(name, api); +// //} +// +// +// public void addModel(String name, ModelAPI api) { +// //logger.debug("Adding model: " + name + ", to web renderer"); +// api.getMbt().addObserver(this); +// mbts.put(name, api.getMbt()); +// } +// +// @SuppressWarnings("unchecked") +// public void update(Observable obj, Object arg) { +// //logger.debug("Updating webrenderer"); +// updateModels = new JSONObject(); +// +// updateModels.put("type", "update"); +// +// models = new ArrayList(); +// model = new JSONObject(); +// +// model.put("id", modelHandler.getCurrentRunningModel()); +// //logger.debug(mbts.get(modelHandler.getCurrentRunningModel()).getDataAsJSON()); +// model.put("variables", mbts.get(modelHandler.getCurrentRunningModel()).getDataAsJSON()); +// +// JSONObject startNode = new JSONObject(); +// startNode.put("id", "n0"); +// startNode.put("state", "visited"); +// +// if (arg instanceof Vertex) { +// node = new JSONObject(); +// node.put("id", ((AbstractElement) arg).getIdKey()); +// node.put("state", getState((AbstractElement) arg)); +// node.put("visited", ((AbstractElement) arg).getVisitedKey()); +// +// nodes = new ArrayList(); +// nodes.add(node); +// nodes.add(startNode); +// model.put("nodes", nodes); +// } else if (arg instanceof Edge) { +// edge = new JSONObject(); +// edge.put("id", ((AbstractElement) arg).getIdKey()); +// edge.put("state", getState((AbstractElement) arg)); +// +// edges = new ArrayList(); +// edges.add(edge); +// model.put("edges", edges); +// } else { +// // TODO: More classes should be added to the generic method "update". +// // Everything that could be updated should be in here. +// //logger.warn("Error, trying to update something that is not an edge nor vertex"); +// } +// models.add(model); +// +// updateModels.put("models", models); +// +// if (getWSConnection() != null) +// send(updateModels.toJSONString()); +// else +// updateBuffer.add(updateModels); +// } +// + +// +// private String getState(AbstractElement n) { +// //logger.debug("getState AbstractElement n: " + n + ", n.getVisitedKey(): " + n.getVisitedKey() + ", mbt: "+ ObjectUtils.identityToString(mbts.get(modelHandler.getCurrentRunningModel()).getCurrentAbstractElement())); +// String state = ""; +// if (n.getVisitedKey() == 0) { +// state = "unvisited"; +// } else { +// state = "visited"; +// } +// if (mbts.get(modelHandler.getCurrentRunningModel()).getCurrentAbstractElement() == n) { +// state = "active"; +// } +// return state; +// } +// +// /* +// * WebSockets +// */ +// @Override +// public void onOpen(WebSocketConnection connection) { +// this.wsConnection = connection; +// send(stringTest); +// if (updateBuffer.size() > 0) { +// for (JSONObject jo : updateBuffer) { +// send(jo.toJSONString()); +// } +// } +// +// } +// +// public static Boolean readRunProperty() { +// PropertiesConfiguration conf = null; +// if (new File("graphwalker.properties").canRead()) { +// try { +// conf = new PropertiesConfiguration("graphwalker.properties"); +// } catch (ConfigurationException e) { +// //logger.error(e.getMessage()); +// } +// } else { +// conf = new PropertiesConfiguration(); +// try { +// conf.load(WebRendererOld.class.getResourceAsStream("/org/graphwalker/resources/graphwalker.properties")); +// } catch (ConfigurationException e) { +// //logger.error(e.getMessage()); +// } +// } +// +// String readprop = conf.getString("graphwalker.wr.run"); +// Boolean run = false; +// if (readprop != null) { +// run = Boolean.valueOf(readprop); +// } +// //logger.debug("Read graphwalker.wr.port from graphwalker.properties. Will run webrenderer: " + run); +// return run; +// } +// +// public static String readWRPort() { +// PropertiesConfiguration conf = null; +// if (new File("graphwalker.properties").canRead()) { +// try { +// conf = new PropertiesConfiguration("graphwalker.properties"); +// } catch (ConfigurationException e) { +// //logger.error(e.getMessage()); +// } +// } else { +// conf = new PropertiesConfiguration(); +// try { +// conf.load(WebRendererOld.class.getResourceAsStream("/org/graphwalker/resources/graphwalker.properties")); +// } catch (ConfigurationException e) { +// //logger.error(e.getMessage()); +// } +// } +// String port = conf.getString("graphwalker.wr.port"); +// //logger.debug("Read graphwalker.wr.port from graphwalker.properties: " + port); +// if (port == null) { +// port = "9191"; +// //logger.debug("Setting WebRendererOld port to: 9191"); +// } +// return port; +// } + + +} diff --git a/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/geometry/Edge.java b/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/geometry/Edge.java new file mode 100644 index 00000000..cd1c2628 --- /dev/null +++ b/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/geometry/Edge.java @@ -0,0 +1,82 @@ +package org.graphwalker.webrenderer.geometry; + +/* + * #%L + * GraphWalker Web Renderer + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ + +import java.util.List; +import java.util.UUID; + +/** + * @author Nils Olsson + */ +public class Edge { + + private UUID id; + private Label label; + private Vertex source; + private Vertex target; + private Point pathSource; + private Point pathTarget; + private List pathPoints; + + public Edge(UUID id, Label label, Vertex source, Vertex target, Point pathSource, Point pathTarget, List pathPoints) { + this.id = id; + this.label = label; + this.source = source; + this.target = target; + this.pathSource = pathSource; + this.pathTarget = pathTarget; + this.pathPoints = pathPoints; + } + + public UUID getId() { + return id; + } + + public Label getLabel() { + return label; + } + + public Vertex getSource() { + return source; + } + + public Vertex getTarget() { + return target; + } + + public Point getPathSource() { + return pathSource; + } + + public Point getPathTarget() { + return pathTarget; + } + + public List getPathPoints() { + return pathPoints; + } +} diff --git a/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/geometry/Label.java b/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/geometry/Label.java new file mode 100644 index 00000000..0de9b655 --- /dev/null +++ b/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/geometry/Label.java @@ -0,0 +1,55 @@ +package org.graphwalker.webrenderer.geometry; + +/* + * #%L + * GraphWalker Web Renderer + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ + +/** + * @author Nils Olsson + */ +public class Label { + + private int x; + private int y; + private String text; + + public Label(String text, int x, int y) { + this.x = x; + this.y = y; + this.text = text; + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } + + public String getText() { + return text; + } +} diff --git a/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/geometry/Point.java b/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/geometry/Point.java new file mode 100644 index 00000000..774dda54 --- /dev/null +++ b/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/geometry/Point.java @@ -0,0 +1,49 @@ +package org.graphwalker.webrenderer.geometry; + +/* + * #%L + * GraphWalker Web Renderer + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ + +/** + * @author Nils Olsson + */ +public class Point { + + private int x; + private int y; + + public Point(int x, int y) { + this.x = x; + this.y = y; + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } +} diff --git a/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/geometry/Vertex.java b/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/geometry/Vertex.java new file mode 100644 index 00000000..737e2c77 --- /dev/null +++ b/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/geometry/Vertex.java @@ -0,0 +1,89 @@ +package org.graphwalker.webrenderer.geometry; + +/* + * #%L + * GraphWalker Web Renderer + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ + +import java.util.*; + +/** + * @author Nils Olsson + */ +public class Vertex { + + private UUID id; + private String name; + private int x; + private int y; + private int width; + private int height; + private Map edgeMap = new HashMap<>(); + + public Vertex(UUID id, String name, int x, int y, int width, int height) { + this.id = id; + this.name = name; + this.x = x; + this.y = y; + this.width = width; + this.height = height; + } + + public UUID getId() { + return id; + } + + public String getName() { + return name; + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } + + public int getWidth() { + return width; + } + + public int getHeight() { + return height; + } + + public void translate(long dx, long dy) { + this.x += dx; + this.y += dy; + } + + public void addEdge(Edge edge) { + edgeMap.put(edge.getId().toString(), edge); + } + + public List getEdges() { + return new ArrayList<>(edgeMap.values()); + } +} diff --git a/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/geometry/layout/SpringEmbedder.java b/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/geometry/layout/SpringEmbedder.java new file mode 100644 index 00000000..c00d2fea --- /dev/null +++ b/graphwalker-webrenderer/src/main/java/org/graphwalker/webrenderer/geometry/layout/SpringEmbedder.java @@ -0,0 +1,131 @@ +package org.graphwalker.webrenderer.geometry.layout; + +/* + * #%L + * GraphWalker Web Renderer + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ + +import org.graphwalker.core.Model; +import org.graphwalker.webrenderer.geometry.Edge; +import org.graphwalker.webrenderer.geometry.Label; +import org.graphwalker.webrenderer.geometry.Point; +import org.graphwalker.webrenderer.geometry.Vertex; + +import java.util.*; + +/** + * @author Nils Olsson + */ +public class SpringEmbedder { + + private final Model model; + private final double edgeLength; + private final double force; + private final double friction; + private final double[][] changes; + private final List vertices; + private final List edges; + + public SpringEmbedder(Model model) { + this(model, 0.3, 0.01, 0.85); + } + + public SpringEmbedder(Model model, double edgeLength, double force, double friction) { + this.model = model; + this.edgeLength = edgeLength; + this.force = force; + this.friction = friction; + this.changes = new double[model.getVertices().size()][2]; + this.vertices = new ArrayList<>(model.getVertices().size()); + this.edges = new ArrayList<>(model.getEdges().size()); + initialize(model); + embedSprings(); + } + + public List getVertices() { + return vertices; + } + + public List getEdges() { + return edges; + } + + private void initialize(Model model) { + Random random = new Random(); + Map vertexMap = new HashMap<>(); + for (org.graphwalker.core.model.Vertex vertex : model.getVertices()) { + vertexMap.put(vertex, new Vertex(UUID.randomUUID() + , vertex.getName() + , 100 + random.nextInt(1000) + , 100 + random.nextInt(1000) + , 100 + , 100)); + } + for (org.graphwalker.core.model.Edge edge : model.getEdges()) { + Edge newEdge = new Edge(UUID.randomUUID() + , new Label(edge.getName(), 0, 0) + , vertexMap.get(edge.getSourceVertex()) + , vertexMap.get(edge.getTargetVertex()) + , new Point(vertexMap.get(edge.getSourceVertex()).getX(), vertexMap.get(edge.getSourceVertex()).getY()) + , new Point(vertexMap.get(edge.getTargetVertex()).getX(), vertexMap.get(edge.getTargetVertex()).getY()) + , new ArrayList()); + vertexMap.get(edge.getSourceVertex()).addEdge(newEdge); + vertexMap.get(edge.getTargetVertex()).addEdge(newEdge); + edges.add(newEdge); + } + vertices.addAll(vertexMap.values()); + } + + private void embedSprings() { + for (int i = 0; i < vertices.size(); i++) { + Vertex vertex = vertices.get(i); + for (Edge edge : vertex.getEdges()) { + double dx = (vertex.getX() - edge.getTarget().getX()); //TODO: + double dy = (vertex.getY() - edge.getTarget().getY()); //TODO: + double change = Math.hypot(dx, dy); + if (change == 0) { + dx = 1.0; + dy = 0.0; + } else { + dx /= change; + dy /= change; + } + change = (change - edgeLength) / edgeLength; + dx *= change * force; + dy *= change * force; + changes[i][0] -= dx; + changes[i][1] -= dy; + } + } + for (int i = 0; i < vertices.size(); i++) { + for (int j = 0; j < 2; j++) { + changes[i][j] *= friction; + } + } + for (int i = 0; i < vertices.size(); i++) { + vertices.get(i).translate(Math.round(changes[i][0]), Math.round(changes[i][1])); + } + } + +} diff --git a/graphwalker-webrenderer/src/main/resources/index.html b/graphwalker-webrenderer/src/main/resources/index.html new file mode 100644 index 00000000..934f5970 --- /dev/null +++ b/graphwalker-webrenderer/src/main/resources/index.html @@ -0,0 +1,38 @@ + + + + Simple graphml viewer + + + +Model: +
+
+ + + + diff --git a/graphwalker-webrenderer/src/main/resources/style.css b/graphwalker-webrenderer/src/main/resources/style.css new file mode 100644 index 00000000..3d5d8df3 --- /dev/null +++ b/graphwalker-webrenderer/src/main/resources/style.css @@ -0,0 +1,185 @@ +/* + * #%L + * GraphWalker Web Renderer + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +.container { + background: lightgrey; + border-radius: 10px; + width: 700px; + height: 700px; + overflow: hidden; + margin: 10px; + float: left; + position: relative; +} + +.container.activemodel { + -moz-box-shadow: inset 0 0 10px #000000; + -webkit-box-shadow: inset 0 0 10px #000000; +} + +.model { + width: 700px; + height: 700px; + position: absolute; +} + +.modelname { + font-family: "Lucida Sans Unicode", sans-serif; + position: absolute; + left: 300px; + top: 10px; + z-index: 2; + font-size: 20px; +} + +.model.animated { + -webkit-transition: all 1s ease-in-out; + -moz-transition: all 1s ease-in-out; + -o-transition: all 1s ease-in-out; + transition: all 1s ease-in-out; +} + +.line { + position:absolute; + transform-origin:0% 0%; + -ms-transform-origin:0% 0%; + -webkit-transform-origin:0% 0%; + -moz-transform-origin:0% 0%; + -o-transform-origin:0% 0%; +} +.edge { + z-index:0; + height: auto; +} +.edge.unvisited>.line { + border-left: 2px solid black; +} +.edge.active>.line { + border-left: 2px solid green; +} +.edge.failed>.line { + border-left: 2px solid red; +} +.edge.visited:not(.failed):not(.active)>.line { + border-left: 2px dashed gray; +} +.arrow-down { + width: 0; + height: 0; + bottom:0; + left:-7px; + position:absolute; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-top: 7px solid #000; +} +.node { + position: absolute; + color: black; + border-radius: 10px; + display: table; + z-index:1; +} + +.node.active { + border:2px solid black; + background-image: -moz-linear-gradient(top, rgb(150, 228, 150), rgb(50, 128, 50)); + background-image: -webkit-linear-gradient(top, rgb(150, 228, 150), rgb(50, 128, 50)); +} + +.node.failed { + background-image: -moz-linear-gradient(top, rgb(228, 150, 150), rgb(128, 50, 50)); + background-image: -webkit-linear-gradient(top, rgb(228, 150, 150), rgb(128, 50, 50)); +} + +.node.visited:not(.failed):not(.active) { + background-image: -moz-linear-gradient(top, #AAAAAA, #666666); + background-image: -webkit-linear-gradient(top, #AAAAAA, #666666); +} + +.zoomdiv { + position: relative; + top: 10px; + left: 10px; + z-index: 2; +} + +.zoominput { + width:30px; + border-radius:5px; +} + +p { + font-family: "Lucida Sans Unicode", sans-serif; +} + +p.label { + display: table-cell; + vertical-align: middle; + text-align: center; + font-size:80%; +} + +table.variables { + position: relative; + top: 15px; + left: 10px; + font-family: "Lucida Sans Unicode", sans-serif; + z-index: 2; + border-radius: 5px; + opacity: 0.8; + background: gray; + -webkit-transition: all 0.2s ease-in-out; + -moz-transition: all 0.2s ease-in-out; + -o-transition: all 0.2s ease-in-out; + transition: all 0.2s ease-in-out; +} + +table.animate { + transform: scale(1.2); + -ms-transform: scale(1.2); + -webkit-transform: scale(1.2); + -moz-transform: scale(1.2); + -o-transform: scale(1.2); +} + +input[type=text] { + font-family: Arial, Sans-Serif; + font-size: 13px; + margin: 5px; + display: block; + padding: 4px; + width: 200px; + border: solid 1px #85b1de; +} + +input[type=text]:hover { + background:#F0F0F0; +} + +input[type=text]:focus { + background:#F9F9F9; + border: solid 1px #373737; +} diff --git a/graphwalker-webrenderer/src/main/resources/update.js b/graphwalker-webrenderer/src/main/resources/update.js new file mode 100644 index 00000000..f222c111 --- /dev/null +++ b/graphwalker-webrenderer/src/main/resources/update.js @@ -0,0 +1,411 @@ +/* + * #%L + * GraphWalker Web Renderer + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ +var ws; +var modelsHash = {}; + +var transformprop = getsupportedprop([ "transform", "MozTransform", + "webkitTransform" ]); +var transformoriginprop = getsupportedprop([ "transformOrigin", + "MozTransformOrigin", "webkitTransformOrigin" ]); +var boxshadowprop = getsupportedprop([ "boxShadow", "MozBoxShadow", + "webkitBoxShadow" ]); + +window.onload = function connect() { + var inputField = document.getElementById("serverAdr"); + port = window.location.port; + ipAddr = window.location.hostname; + var wsconnection = "ws://" + ipAddr + ":" + port + "/graphwalker"; + ws = new WebSocket(wsconnection); // "ws://nisse:8080/hellowebsocket" + + ws.onopen = function() {}; + ws.onclose = function() {}; + + ws.onmessage = function(msg) { + handleMessage(msg.data); + }; + var mC = document.getElementById("modelsContainer"); + while (mC.firstChild) { + mC.removeChild(mC.firstChild); + } +} + +function handleMessage(data) { + var message = JSON.parse(data); + if (message.type == "initial") { + message.models.forEach(function(model) { + var m = new modelObject(model); + m.drawGraph(); + modelsHash[model.id] = m; + }); + } else if (message.type == "update") { + update(message.models); + } +} + +function update(models) { + var activeElements = document.getElementsByClassName("active"); + for ( var i = 0; i < activeElements.length; i++) { + activeElements[i].classList.add("visited"); + activeElements[i].classList.remove("active"); + + } + + models.forEach(function(model) { + var modelId = model.id; + highlightContainer(modelId); + if (model.nodes) { + model.nodes.forEach(function(n) { + var node = document.getElementById(n.id + "_" + modelId); + node.style.background = ""; + node.classList.remove("unvisited"); + node.classList.add(n.state); + if (n.state == "active") { + modelsHash[modelId].centerOnElement(node); + } + }); + } + if (model.edges) { + model.edges.forEach(function(e) { + var edge = document.getElementById(e.id + "_" + modelId); + edge.classList.remove("unvisited"); + edge.classList.add(e.state); + modelsHash[modelId].centerOnElement(edge); + if (e.state == "active") { + modelsHash[modelId].centerOnElement(edge); + } + }); + } + if (model.variables) { + var new_tbody = document.createElement("tbody"); + new_tbody.id = "data_body_" + modelId; + model.variables.forEach(function(item) { + var row = document.createElement("tr"); + var key = document.createElement("td"); + key.innerHTML = item.name + ":"; + var value = document.createElement("td"); + value.innerHTML = item.value; + value.id = item.name + "_" + modelId; + row.appendChild(key); + row.appendChild(value); + new_tbody.appendChild(row); + }); + vtable = document.getElementById("data_table_" + modelId); + old_tbody = document.getElementById("data_body_" + modelId); + vtable.replaceChild(new_tbody, old_tbody) + } + }); +} + +function highlightContainer(id) { + var containers = document.getElementsByClassName("container"); + for(var i = 0; i < containers.length; i++) { + if (containers[i].id == "container_" + id) { + containers[i].classList.add("activemodel"); + } else { + containers[i].classList.remove("activemodel"); + } + } +} + +function modelObject(data) { + var graph = data; + var m_id = graph.id; + var modelName = graph.name; + var modelsContainer = document.getElementById("modelsContainer"); + var container = document.createElement("div"); + container.id = "container_" + m_id; + container.classList.add("container") + modelsContainer.appendChild(container); + var graphDiv = document.createElement("div"); + graphDiv.id = "model_" + m_id; + graphDiv.classList.add("model"); + container.appendChild(graphDiv); + + var panning = false; + var mousedownX = 0; + var mousedownY = 0; + var transX = 0; + var transY = 0; + var scale = 1; + container.onmousedown = function(e) { + panning = true; + mousedownX = e.clientX; + mousedownY = e.clientY; + graphDiv.classList.remove("animated"); + }; + container.onmouseup = function(e) { + panning = false; + transX += e.clientX - mousedownX; + transY += e.clientY - mousedownY; + }; + container.onmousemove = handlePanning; + + var minY = 1e9; + var minX = 1e9; + + this.centerOnElement = function(element) { + graphDiv.classList.add("animated"); + transX = element.parentNode.offsetWidth / 2 + - (element.offsetLeft + element.offsetWidth / 2); + transY = element.parentNode.offsetHeight / 2 + - (element.offsetTop + element.offsetHeight / 2); + graphDiv.style[transformprop] = "translate(" + transX + "px," + transY + + "px) scale(" + scale + ")"; + graphDiv.style[transformoriginprop] = (element.offsetLeft + element.offsetWidth / 2) + + "px " + (element.offsetTop + element.offsetHeight / 2) + "px"; + } + + this.drawGraph = function() { + var zoomControls = document.createElement("div"); + zoomControls.classList.add("zoomdiv"); + var zIn = document.createElement("input"); + zIn.type = "button"; + zIn.onclick = zoom; + zIn.classList.add("zoominput"); + zIn.value = "+"; + var zOut = document.createElement("input"); + zOut.type = "button"; + zOut.onclick = zoom; + zOut.classList.add("zoominput"); + zOut.value = "-"; + zoomControls.appendChild(zIn); + zoomControls.appendChild(zOut); + container.appendChild(zoomControls); + + var vtable = document.createElement("table"); + vtable.id = "data_table_" + m_id; + vtable.classList.add("variables"); + var vbody = document.createElement("tbody"); + vbody.id = "data_body_" + m_id; + graph.variables.forEach(function(item) { + var row = document.createElement("tr"); + var key = document.createElement("td"); + key.innerHTML = item.name + ":"; + var value = document.createElement("td"); + value.innerHTML = item.value; + value.id = item.name + "_" + m_id; + row.appendChild(key); + row.appendChild(value); + vbody.appendChild(row); + }); + vtable.appendChild(vbody); + container.appendChild(vtable); + + var nameSpan = document.createElement("span"); + nameSpan.classList.add("modelname"); + if (modelName) { + nameSpan.innerHTML = modelName; + } + container.appendChild(nameSpan); + + graph.nodes.forEach(function(item) { + if (item.geometry.y < minY) + minY = item.geometry.y; + if (item.geometry.x < minX) + minX = item.geometry.x; + }); + + graph.edges.forEach(function(edge) { + edge.path.points.forEach(function(point) { + if (point.y < minY) + minY = point.y; + if (point.x < minX) + minX = point.x; + }); + }); + + nodes = {}; + minX = minX - 50; + minY = minY - 50; + + graph.nodes.forEach(function(item) { + var div = document.createElement("div"); + div.style.width = item.geometry.width + "px"; + div.style.height = item.geometry.height + "px"; + div.style.left = item.geometry.x - minX + "px"; + div.style.top = item.geometry.y - minY + "px"; + div.style[boxshadowprop] = "5px 5px 5px #888"; + div.style.backgroundColor = item.color; + div.style.background = "-moz-linear-gradient(top , " + + LightenDarkenColor(item.color, 100) + ", " + item.color + + ")"; + div.style.background = "-webkit-linear-gradient(top, " + + LightenDarkenColor(item.color, 100) + ", " + item.color + + ")"; + div.className = "node " + item.state; + div.id = item.id + "_" + m_id; + var par = document.createElement("p"); + par.classList.add("label"); + par.innerHTML = item.label.replace(/,/g, '
'); + div.appendChild(par); + graphDiv.appendChild(div); + nodes[div.id] = item; + }); + graph.edges.forEach(function(item) { + var source = nodes[item.source + "_" + m_id]; + var target = nodes[item.target + "_" + m_id]; + add_arrow(item, source, target); + }); + } + + function add_arrow(item, source, target) { + var from = { + x : source.geometry.x + source.geometry.width / 2 + item.path.sx, + y : source.geometry.y + source.geometry.height / 2 + item.path.sy + }; + var start = { + x : from.x, + y : from.y + }; + var to = { + x : target.geometry.x + target.geometry.width / 2 + item.path.tx, + y : target.geometry.y + target.geometry.height / 2 + item.path.ty + }; + var edge = document.createElement("div"); + edge.id = item.id + "_" + m_id; + edge.style.left = from.x - minX + "px"; + edge.style.top = from.y - minY + "px"; + edge.style.position = "absolute"; + edge.className = "edge " + item.state; + + var label = document.createElement('p'); + label.classList.add("label"); + label.style.left = item.label.x + "px"; + label.style.top = item.label.y + "px"; + label.innerHTML = item.label.label; + label.style.position = "absolute"; + edge.appendChild(label); + + item.path.points.forEach(function(point) { + var d = { + x : point.x - from.x, + y : point.y - from.y + }; + var length = Math.sqrt(d.x * d.x + d.y * d.y); + var angle = Math.atan2(d.y, d.x) - Math.PI / 2; + line = document.createElement("div"); + line.style.height = length + "px"; + line.style.left = from.x - start.x + "px"; + line.style.top = from.y - start.y + "px"; + line.style[transformprop] = "rotate(" + angle + "rad)"; + line.className = "line"; + edge.appendChild(line); + from = point; + }); + + var d = { + x : to.x - from.x, + y : to.y - from.y + }; + var length = Math.sqrt(d.x * d.x + d.y * d.y); + var angle = Math.atan2(d.y, d.x) - Math.PI / 2; + line = document.createElement("div"); + line.style.height = length + "px"; + line.style.left = from.x - start.x + "px"; + line.style.top = from.y - start.y + "px"; + line.style[transformprop] = "rotate(" + angle + "rad)"; + line.className = "line"; + var head = document.createElement("div"); + head.className = "arrow-down"; + line.appendChild(head); + edge.appendChild(line); + graphDiv.appendChild(edge); + + } + + function handleVerticeClick(e) { + var className = e.srcElement.parentNode.className; + if (className.indexOf("active") > -1) { + ws + .send('{"type":"update", "models":[{"id": "test", "nodes":[{"id":"' + + e.target.parentNode.id.replace("_" + m_id, "") + + '", "state":"failed"}]}]}'); + } else { + ws + .send('{"type":"update", "models":[{"id": "test", "nodes":[{"id":"' + + e.target.parentNode.id.replace("_" + m_id, "") + + '", "state":"active"}]}]}'); + } + } + + function handlePanning(e) { + if (panning) { + graphDiv.style[transformprop] = "translate(" + + (transX + e.clientX - mousedownX) + "px," + + (transY + e.clientY - mousedownY) + "px) scale(" + scale + + ")"; + } + } + + function zoom(e) { + var siblings = e.target.parentNode.parentNode.childNodes; + for ( var i = 0; i < siblings.length; i++) { + if (siblings[i].classList.contains("model")) { + if (e.target.value == "+") { + scale = scale * 1.1; + } else { + scale = scale / 1.1; + } + siblings[i].style[transformprop] = "translate(" + transX + + "px," + transY + "px) scale(" + scale + ")"; + } + } + } +} + +function getsupportedprop(proparray) { + var root = document.documentElement //reference root element of document + for ( var i = 0; i < proparray.length; i++) { //loop through possible properties + if (typeof root.style[proparray[i]] == "string") { //if the property value is a string (versus undefined) + return proparray[i] //return that string + } + } +} + +function LightenDarkenColor(col, amt) { + var usePound = false; + if (col[0] == "#") { + col = col.slice(1); + usePound = true; + } + var num = parseInt(col, 16); + var r = (num >> 16) + amt; + if (r > 255) + r = 255; + else if (r < 0) + r = 0; + var b = ((num >> 8) & 0x00FF) + amt; + if (b > 255) + b = 255; + else if (b < 0) + b = 0; + var g = (num & 0x0000FF) + amt; + if (g > 255) + g = 255; + else if (g < 0) + g = 0; + return (usePound ? "#" : "") + (g | (b << 8) | (r << 16)).toString(16); +} \ No newline at end of file diff --git a/graphwalker-webrenderer/src/test/java/org/graphwalker/webrenderer/WebRendererTest.java b/graphwalker-webrenderer/src/test/java/org/graphwalker/webrenderer/WebRendererTest.java new file mode 100644 index 00000000..991a4dad --- /dev/null +++ b/graphwalker-webrenderer/src/test/java/org/graphwalker/webrenderer/WebRendererTest.java @@ -0,0 +1,82 @@ +package org.graphwalker.webrenderer; + +/* + * #%L + * GraphWalker Web Renderer + * %% + * Copyright (C) 2011 - 2014 GraphWalker + * %% + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * #L% + */ + +import org.graphwalker.core.*; +import org.graphwalker.core.condition.VertexCoverage; +import org.graphwalker.core.generator.RandomPath; +import org.graphwalker.core.machine.ExecutionContext; +import org.graphwalker.core.model.Edge; +import org.graphwalker.core.model.Vertex; +import org.junit.Test; +import org.webbitserver.handler.StaticFileHandler; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.Arrays; +import java.util.concurrent.ExecutionException; + +/** + * @author Nils Olsson + */ +public class WebRendererTest { + + @Test + public void simpleTest() throws Exception { + //WebRenderer renderer = new WebRenderer("", 8080); + //renderer.add(new StaticFileHandler("src/main/resources")); + //renderer.start(); + //renderer.stop(); + } + + + public static void main(String[] args) throws InterruptedException, ExecutionException, IOException, URISyntaxException { + + //Model model = new SimpleModel().addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))); + + Model model = new SimpleModel() + .addEdge(new Edge("e0", new Vertex("v0"), new Vertex("v1"))) + .addEdge(new Edge("e1", new Vertex("v1"), new Vertex("v2"))) + .addEdge(new Edge("e2", new Vertex("v1"), new Vertex("v3"))) + .addEdge(new Edge("e3", new Vertex("v3"), new Vertex("v4"))) + .addEdge(new Edge("e4", new Vertex("v4"), new Vertex("v1"))); + + PathGenerator pathGenerator = new RandomPath(new VertexCoverage()); + ExecutionContext context = new ExecutionContext(model, pathGenerator); + Machine machine = new SimpleMachine(Arrays.asList(context, context)); + + WebRenderer renderer = new WebRenderer(machine, 8080); + renderer.add(new StaticFileHandler("src/main/resources")); + renderer.start(); + + //while (machine.hasNextStep()) { + // machine.getNextStep(); + //} + + //renderer.stop(); + } +} diff --git a/pom.xml b/pom.xml index a87a39d6..de94cb69 100644 --- a/pom.xml +++ b/pom.xml @@ -1,173 +1,340 @@ - - 4.0.0 - org.graphwalker - graphwalker - jar - 2.5.14-SNAPSHOT - graphwalker - GraphWalker is a tool for generating offline and online test sequences from Finite State Machines and Extended Finite State Machines. - http://graphwalker.org - - - MIT License - http://www.opensource.org/licenses/mit-license.php - repo - - - - http://mbt.tigris.org/svn/mbt/trunk/graphwalker - scm:svn:http://mbt.tigris.org/svn/mbt/trunk/graphwalker - scm:svn:http://mbt.tigris.org/svn/mbt/trunk/graphwalker - - - - krikar - Kristian Karl - kristian.hermann.karl@gmail.com - - - johtej - Johan Tejle - johan.tejle@systemverification.com - - - - - Stefan Vahlgren - - - Peter Johansson - - - Ola Sundin - - - Johan Brorson - - - Harald Hartwig - - - Fredrik Gustafsson - - + - - UTF-8 - + 4.0.0 + org.graphwalker + graphwalker + 3.0-BETA-SNAPSHOT + pom + GraphWalker + http://graphwalker.org + 2011 - - org.sonatype.oss - oss-parent - 5 - + + GraphWalker is a tool for model based testing. + - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.6 - 1.6 - - - - maven-assembly-plugin - - - src/assemble/standalone.xml - - - src/main/resources/META-INF/MANIFEST.MF - - - - - org.codehaus.mojo - jaxws-maven-plugin - - - wsgen - - wsgen - - - org.graphwalker.SoapServices - - - - - - - - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.6 - - true - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - + + graphwalker-core + graphwalker-soap + graphwalker-webrenderer + graphwalker-jenkins-plugin + graphwalker-maven-plugin + graphwalker-example + graphwalker-cli + graphwalker-io + + + + GraphWalker + http://graphwalker.org + + + + + MIT-License + http://www.opensource.org/licenses/mit-license.php + repo + + + + + + krikar + Kristian Karl + kristian.hermann.karl@gmail.com + + Lead + + + + + + + Fredrik Gustafsson + + + Harald Hartwig + + + Johan Brorson + + + Johan Tejle + + + Nils Olsson + + + Ola Sundin + + + Stefan Vahlgren + + + Peter Johansson + + + + + UTF-8 + UTF-8 + + + + + + org.graphwalker + graphwalker-core + ${project.version} + + + org.apache.commons + commons-lang3 + 3.1 + + + junit + junit + 4.11 + + + org.webbitserver + webbit + 0.4.15 + + + com.googlecode.json-simple + json-simple + 1.1.1 + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.7 + 1.7 + + + + org.codehaus.mojo + license-maven-plugin + + mit + + + + update-license + prepare-package + + update-file-header + + + + + + org.apache.maven.plugins + maven-source-plugin + + + bundle-sources + + jar + + + true + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + bundle-javadoc + + jar + + + + + + org.apache.maven.plugins + maven-site-plugin + + + + + + org.apache.maven.plugins + maven-site-plugin + 3.3 + + + org.codehaus.mojo + license-maven-plugin + 1.6 + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + org.codehaus.mojo + build-helper-maven-plugin + 1.7 + + + org.apache.maven.plugins + maven-shade-plugin + 2.2 + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + org.apache.maven.plugins + maven-surefire-plugin + 2.16 + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.16 + + + org.apache.maven.plugins + maven-jar-plugin + 2.4 + + + org.apache.maven.plugins + maven-assembly-plugin + 2.4 + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.7 + + + org.jvnet.jax-ws-commons + jaxws-maven-plugin + 2.3 + + + org.codehaus.mojo + jaxb2-maven-plugin + 1.5 + + + org.codehaus.mojo + aspectj-maven-plugin + 1.6 + + + org.apache.maven.plugins + maven-surefire-report-plugin + 2.16 + + + org.codehaus.mojo + cobertura-maven-plugin + 2.6 + + + org.codehaus.mojo + findbugs-maven-plugin + 2.6 + + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.11 + + + org.apache.maven.plugins + maven-jxr-plugin + 2.4 + + + org.apache.maven.plugins + maven-clean-plugin + 2.5 + + + + + + + + + org.apache.maven.plugins + maven-surefire-report-plugin + 2.17 + + + + org.codehaus.mojo + cobertura-maven-plugin + 2.6 + + + + xml + html + + + + + + + + - - - junit - junit - 4.8.2 - test - - - com.sun.xml.ws - jaxws-rt - 2.1.3 - - - commons-cli - commons-cli - 1.2 - - - log4j - log4j - 1.2.16 - - - org.jdom - jdom - 1.1 - - - commons-configuration - commons-configuration - 1.6 - - - net.sf.jung - jung-graph-impl - 2.0.1 - - - org.beanshell - bsh - 2.0b4 - - - net.sf.jung - jung-algorithms - 2.0.1 - - - net.sf.jung - jung-visualization - 2.0.1 - - diff --git a/src/assemble/standalone.xml b/src/assemble/standalone.xml deleted file mode 100644 index fbb132f3..00000000 --- a/src/assemble/standalone.xml +++ /dev/null @@ -1,36 +0,0 @@ - - standalone - - jar - - false - - - - - true - runtime - - org.jdom:jdom - commons-logging:commons-logging - net.sourceforge.collections:collections-generic - commons-lang:commons-lang - commons-collections:commons-collections - commons-cli:commons-cli - commons-configuration:commons-configuration - org.beanshell:bsh - net.sf.jung:jung-graph-impl - net.sf.jung:jung-algorithms - net.sf.jung:jung-visualization - net.sf.jung:jung-api - log4j:log4j:* - - - - - - target/classes - - - - diff --git a/src/main/java/org/graphwalker/CLI.java b/src/main/java/org/graphwalker/CLI.java deleted file mode 100644 index 026a862b..00000000 --- a/src/main/java/org/graphwalker/CLI.java +++ /dev/null @@ -1,1081 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.PrintStream; -import java.net.InetAddress; -import java.util.Iterator; -import java.util.Map.Entry; -import java.util.Timer; -import java.util.TimerTask; -import java.util.Vector; - -import javax.xml.ws.Endpoint; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.CommandLineParser; -import org.apache.commons.cli.HelpFormatter; -import org.apache.commons.cli.MissingArgumentException; -import org.apache.commons.cli.MissingOptionException; -import org.apache.commons.cli.OptionBuilder; -import org.apache.commons.cli.Options; -import org.apache.commons.cli.PosixParser; -import org.apache.commons.cli.UnrecognizedOptionException; -import org.apache.log4j.Logger; -import org.graphwalker.GUI.App; -import org.graphwalker.Keywords.Generator; -import org.graphwalker.Keywords.StopCondition; -import org.graphwalker.conditions.AlternativeCondition; -import org.graphwalker.exceptions.GeneratorException; -import org.graphwalker.exceptions.StopConditionException; -import org.graphwalker.io.PrintHTMLTestSequence; -import org.jdom.JDOMException; - -/** - * Command Line Interface object, to the org.graphwalker package. The object - * provides a way of working with MBT using a Windows DOS, or a console window - * in *nix system. The CLI works like the cvs or the subversion command svn. The - * syntax is:
- * - *
- * java -jar graphwalker.jar COMMAND 
- * 
- * - * Where graphwalker.jar is the whole package org.graphwalker using - * org.graphwalker.CLI as the main class
- *
- * Example: Print help for graphwalker.jar
- * - *
- * java -jar graphwalker.jar help
- * 
- * - *
- * Example: Merge graphml files and save the merged result.
- * - *
- * java -jar graphwalker.jar merge -f folder
- * 
- * - *
- * Example: Generate offline test sequence, using random walk
- * - *
- * java -jar graphwalker.jar offline -f folder -g RANDOM -s EDGE_COVERAGE:30
- * 
- * - *
- * Example: Generate online test sequence, using shortest walk
- * - *
- * java -jar graphwalker.jar online -f folder -g A_STAR -s EDGE_COVERAGE:100
- * 
- * - *
- * Example: Print all names of edges and vertices (Sorted, and - * unique)
- * - *
- * java -jar graphwalker.jar methods -f folder
- * 
- * - *
- * Example: When you need to define more complex abstract test - * cases working with the CLI can sometimes be a burden. For this reason we have - * added a easier way to structure the abstract test cases, using XML.
- * - *
- * java -jar graphwalker.jar xml -f testcase.xml
- * 
- * - *
- * - */ -public class CLI { - - public static class VerboseStatisticsLogger extends Thread { - private ModelBasedTesting mbt = null; - - private VerboseStatisticsLogger(ModelBasedTesting modelBasedTesting) { - this.mbt = modelBasedTesting; - } - - @Override - public void run() { - logger.info(mbt.getStatisticsVerbose()); - } - } - - private static Logger logger = Util.setupLogger(CLI.class); - private ModelBasedTesting mbt = null; - private Timer timer = null; - private Options opt = new Options(); - private static Endpoint endpoint = null; - - public CLI() { - mbt = new ModelBasedTesting(); - } - - private ModelBasedTesting getMbt() { - return mbt; - } - - /** - * @param mbt - * the ModelBasedTesting to set - */ - private void setMbt(ModelBasedTesting mbt) { - this.mbt = mbt; - } - - public static void main(String[] args) { - CLI cli = new CLI(); - Thread shutDownThread = new CLI.VerboseStatisticsLogger(cli.getMbt()); - try { - Runtime.getRuntime().addShutdownHook(shutDownThread); - } catch (IllegalArgumentException e) { - logger.debug("Could not register ShutdownHook for statistics logger, it has already been registered"); - } - try { - cli.run(args); - endpoint = cli.GetEndpoint(); - } catch (Exception e) { - Util.logStackTraceToError(e); - } - } - - private void run(String[] args) { - if (args.length < 1) { - System.err.println("Type 'java -jar graphwalker.jar help' for usage."); - return; - } else { - if (args[0].equals("help")) { - if (args.length == 1) { - printGeneralHelpText(); - } else { - printHelpText(args[1]); - } - return; - } else if (args[0].equalsIgnoreCase("requirements")) { - buildRequirementsCLI(); - } else if (args[0].equalsIgnoreCase("online")) { - buildOnlineCLI(); - } else if (args[0].equalsIgnoreCase("offline")) { - buildOfflineCLI(); - } else if (args[0].equalsIgnoreCase("methods")) { - buildMethodsCLI(); - } else if (args[0].equalsIgnoreCase("merge")) { - buildMergeCLI(); - } else if (args[0].equalsIgnoreCase("source")) { - buildSourceCLI(); - } else if (args[0].equalsIgnoreCase("manual")) { - buildManualCLI(); - } else if (args[0].equalsIgnoreCase("xml")) { - buildXmlCLI(); - } else if (args[0].equalsIgnoreCase("soap")) { - buildSoapCLI(); - } else if (args[0].equalsIgnoreCase("gui")) { - buildGuiCLI(); - } else if (args[0].equalsIgnoreCase("log")) { - buildLogCLI(); - } else if (args[0].equals("-v") || args[0].equals("--version")) { - printVersionInformation(); - return; - } else if (args[0].equals("-h") || args[0].equals("--help")) { - printGeneralHelpText(); - return; - } else { - System.err.println("Unkown command: " + args[0]); - System.err.println("Type 'java -jar graphwalker.jar help' for usage."); - return; - } - } - - try { - timer = new Timer(); - CommandLineParser parser = new PosixParser(); - CommandLine cl = parser.parse(opt, args); - - /** - * Command: requirements - */ - if (args[0].equalsIgnoreCase("requirements")) { - RunCommandRequirements(cl); - } - /** - * Command: online - */ - if (args[0].equalsIgnoreCase("online")) { - RunCommandOnline(cl); - } - /** - * Command: offline - */ - else if (args[0].equalsIgnoreCase("offline")) { - RunCommandOffline(cl); - } - /** - * Command: methods - */ - else if (args[0].equalsIgnoreCase("methods")) { - RunCommandMethods(cl); - } - /** - * Command: merge - */ - else if (args[0].equalsIgnoreCase("merge")) { - RunCommandMerge(cl); - } - /** - * Command: source - */ - else if (args[0].equalsIgnoreCase("source")) { - RunCommandSource(cl); - } - /** - * Command: xml - */ - else if (args[0].equalsIgnoreCase("xml")) { - RunCommandXml(cl); - } - /** - * Command: soap - */ - else if (args[0].equalsIgnoreCase("soap")) { - RunCommandSoap(cl); - } - /** - * Command: gui - */ - else if (args[0].equalsIgnoreCase("gui")) { - RunCommandGui(cl); - } - /** - * Command: log - */ - else if (args[0].equalsIgnoreCase("log")) { - RunCommandLog(cl); - } - /** - * Command: manual - */ - else if (args[0].equalsIgnoreCase("manual")) { - RunCommandManual(cl); - } - } catch (ArrayIndexOutOfBoundsException e) { - logger.warn(e.getMessage()); - System.err.println("The arguments for either the generator, or the stop-condition, is incorrect."); - System.err.println("Example: java -jar graphwalker.jar offline -f ../demo/model/UC01.graphml -s EDGE_COVERAGE:100 -g A_STAR"); - System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); - } catch (MissingOptionException e) { - logger.warn(e.getMessage()); - System.err.println("Mandatory option(s) are missing."); - System.err.println(e.getMessage()); - System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); - } catch (MissingArgumentException e) { - logger.warn(e.getMessage()); - System.err.println("Argument is required to the option."); - System.err.println(e.getMessage()); - System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); - } catch (UnrecognizedOptionException e) { - logger.warn(e.getMessage()); - System.err.println(e.getMessage()); - System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); - } catch (StopConditionException e) { - logger.warn(e.getMessage()); - System.err.println(e.getMessage()); - System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); - } catch (GeneratorException e) { - logger.warn(e.getMessage()); - System.err.println(e.getMessage()); - System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); - } catch (JDOMException e) { - logger.warn(e.getMessage()); - System.err.println("Can not access file: " + e.getMessage()); - System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); - } catch (FileNotFoundException e) { - logger.warn(e.getMessage()); - System.err.println("Can not access file: " + e.getMessage()); - System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); - } catch (IOException e) { - logger.warn(e.getMessage()); - System.err.println(e.getMessage()); - System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); - } catch (Exception e) { - Util.logStackTraceToError(e); - System.err.println(e.getMessage()); - System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); - } finally { - timer.cancel(); - } - } - - private void printGeneralHelpText() { - System.out.println("usage: 'java -jar graphwalker.jar [OPTION] [ARGUMENT]'\n"); - System.out.println("Type 'java -jar graphwalker.jar help ' to get specific help about a command."); - System.out.println("Valid commands are:"); - System.out.println(" gui"); - System.out.println(" help"); - System.out.println(" manual"); - System.out.println(" merge"); - System.out.println(" methods"); - System.out.println(" offline"); - System.out.println(" online"); - System.out.println(" requirements"); - System.out.println(" soap"); - System.out.println(" source"); - System.out.println(" log"); - System.out.println(" xml\n"); - System.out.println("Type 'java -jar graphwalker.jar -v (--version)' for version information."); - } - - private void printHelpText(String helpSection) { - String header = ""; - if (helpSection.equalsIgnoreCase("online")) { - buildOnlineCLI(); - header = "Run the test online.\n" + "MBT will return a test sequence, one line at a time to standard output, " - + "it will wait until a line is fed back via standard input. The data fed back can be:\n" - + " '0' which means, continue the test as normal\n" + " '2' will end the test normally\n" - + "anything else will abort the execution.\n"; - } else if (helpSection.equalsIgnoreCase("requirements")) { - buildRequirementsCLI(); - header = "Print a list of requiremnts found in the model.\n"; - } else if (helpSection.equalsIgnoreCase("offline")) { - buildOfflineCLI(); - header = "Generate a test sequence offline. The sequence is printed to the standard output\n"; - } else if (helpSection.equalsIgnoreCase("manual")) { - buildManualCLI(); - header = "Generate a test sequence (offline). The output will be a HTML formatted test case document\n"; - } else if (helpSection.equalsIgnoreCase("methods")) { - buildMethodsCLI(); - header = "Generate all methods, or tests existing in the model.\n" - + "MBT will parse the graph(s), and return all methods (or tests) that" - + " exists in the graph(s). The list will onyl print out a unique name once." + " The list is printed to stdout.\n"; - } else if (helpSection.equalsIgnoreCase("merge")) { - buildMergeCLI(); - header = "Merge several graphml files into one single graphml file.\n" - + "The files to be merged, shall all exist in a single folder.\n"; - } else if (helpSection.equalsIgnoreCase("source")) { - buildSourceCLI(); - header = "Generate code from a template.\n" - + "Will generate code using a template. The code generated will contain all lables/names " - + "defined by the vertices and edges. This enables the user to write templates for a " - + "multitude of scripting or programming languages. " + "The result will be printed to stdout. " - + "There is 1 variable in the template, that will be replaced: {LABEL} ->Will be replace " - + "by the actual name of the edge or vertex."; - } else if (helpSection.equalsIgnoreCase("xml")) { - buildXmlCLI(); - header = "Setup mbt engine from xml.\n" + "Will setup and execute an engine based on xml specified criterias."; - } else if (helpSection.equalsIgnoreCase("soap")) { - buildSoapCLI(); - header = "Run MBT as a Web Services (SOAP) server.\n" - + "To see the services, see the WSDL file at: http://localhost:8080/mbt-services?WSDL"; - } else if (helpSection.equalsIgnoreCase("gui")) { - buildGuiCLI(); - header = "Run MBT in a GUI mode.\n" + "Also an mbt xml file can be supplied."; - } else if (helpSection.equalsIgnoreCase("log")) { - buildLogCLI(); - header = "This will start MBT's GUI, and load a model and it's log file.\n" - + "MBT parses the log file and shows the user how it traversed the model." - + " This is usefull when the user whishes to debug a session, and analyze the test."; - } else { - System.err.println("Type 'java -jar graphwalker.jar help' for usage."); - return; - } - - HelpFormatter f = new HelpFormatter(); - f.printHelp(100, "java -jar graphwalker.jar " + helpSection.toLowerCase(), header, opt, "", true); - } - - @SuppressWarnings("static-access") - private void buildRequirementsCLI() { - opt.addOption(OptionBuilder.isRequired().withArgName("file|folder") - .withDescription("The file (or folder) containing graphml formatted files.").hasArg().withLongOpt("input_graphml").create("f")); - } - - private String generateListOfValidStopConditions() { - StringBuilder stringBuilder = new StringBuilder(); - for (StopCondition sc : Keywords.getStopConditions()) { - stringBuilder.append(sc.getDescription()); - stringBuilder.append(System.getProperty("line.separator")); - } - return stringBuilder.toString(); - } - - private String generateListOfValidGenerators() { - StringBuilder stringBuilder = new StringBuilder(); - for (Generator g : Keywords.getGenerators()) { - if (g.isPublished()) { - stringBuilder.append(g.getDescription()); - stringBuilder.append(System.getProperty("line.separator")); - } - } - return stringBuilder.toString(); - } - - @SuppressWarnings("static-access") - private void buildOnlineCLI() { - opt.addOption("a", "statistics", false, "Prints the statistics of the test, at the end of the run."); - opt.addOption("x", "extended", false, "Use an extended finite state machine to handle the model."); - opt.addOption("j", false, "Enable JavaScript engine"); - opt.addOption(OptionBuilder - .isRequired() - .withArgName("stop-condition") - .withDescription( - "Defines the stop condition(s).\nHalts the generation after the specified stop-conditon(s) has been met. " - + "At least 1 condition must be given. If more than 1 is given, the condition that meets " - + "it's stop-condition first, will cause the generation to halt. " - + "To separate multiple conditions, the separator pipe-character | is used. " - + "A list of valid stop-conditions are:\n -------------------\n" + generateListOfValidStopConditions() - + " -------------------\nFor more extensive examples, " + "see http://mbt.tigris.org/wiki/All_about_stop_conditions") - .hasArg().create("s")); - opt.addOption(OptionBuilder - .isRequired() - .withArgName("generator") - .withDescription( - "The generator to be used when traversing the model. At least 1 generator must be given. " - + "To separate multiple generators, the separator pipe-character | is used. " - + "A list of valid generators are:\n -------------------\n" + generateListOfValidGenerators() - + " -------------------\nFor more extensive examples, " + "see http://mbt.tigris.org/wiki/All_about_generators").hasArg() - .create("g")); - opt.addOption(OptionBuilder.isRequired().withArgName("file|folder") - .withDescription("The file (or folder) containing graphml formatted files.").hasArg().withLongOpt("input_graphml").create("f")); - opt.addOption(OptionBuilder - .withArgName("seconds") - .withDescription( - "Prints the test coverage of the graph during execution every . The printout goes to the log file defined in " - + "mbt.properties, and only, if at least INFO level is set in " + "that same file.").hasArg().withLongOpt("log-coverage") - .create("o")); - opt.addOption("c", "class_name", true, "Optional class name to use for test execution."); - opt.addOption("t", "report-template", true, "Optional report template to use. (Also requires option -r) (To be better documented)"); - opt.addOption("r", "report-output", true, - "Optional report filename to save report to. (Also requires option -t) (To be better documented)"); - opt.addOption("w", "weighted", false, "Use weighted values if they exist in the model, and the generator is RANDOM."); - opt.addOption("d", "dry-run", false, "Will execute a dry-run of the model. Dialog will pop up for every edge and vertex."); - } - - /** - * Build the command offline command line parser - */ - @SuppressWarnings("static-access") - private void buildOfflineCLI() { - opt.addOption("a", false, "Prints the statistics of the test, at the end of the run."); - opt.addOption("x", false, "Use an extended finite state machine to handle the model."); - opt.addOption("j", false, "Enable JavaScript engine"); - opt.addOption(OptionBuilder - .isRequired() - .withArgName("stop-condition") - .withDescription( - "Defines the stop condition(s).\nHalts the generation after the specified stop-conditon(s) has been met. " - + "At least 1 condition must be given. If more than 1 is given, the condition that meets " - + "it's stop-condition first, will cause the generation to halt. " - + "To separate multiple conditions, the separator pipe-character | is used. " - + "A list of valid stop-conditions are:\n -------------------\n" + generateListOfValidStopConditions() - + " -------------------\nFor more extensive examples, " + "see http://mbt.tigris.org/wiki/All_about_stop_conditions") - .hasArg().create("s")); - opt.addOption(OptionBuilder - .isRequired() - .withArgName("generator") - .withDescription( - "The generator to be used when traversing the model. At least 1 generator must be given. " - + "To separate multiple generators, the separator pipe-character | is used. " - + "A list of valid generators are:\n -------------------\n" + generateListOfValidGenerators() - + " -------------------\nFor more extensive examples, " + "see http://mbt.tigris.org/wiki/All_about_generators").hasArg() - .create("g")); - opt.addOption(OptionBuilder.isRequired().withArgName("file|folder") - .withDescription("The file (or folder) containing graphml formatted files.").hasArg().create("f")); - opt.addOption(OptionBuilder - .withArgName("seconds") - .withDescription( - "Prints the test coverage of the graph during execution every . The printout goes to the log file defined in " - + "mbt.properties, and only, if at least INFO level is set in " + "that same file.").hasArg().create("o")); - opt.addOption("t", "report-template", true, "Optional report template to use. (Also requires option -r) (To be better documented)"); - opt.addOption("r", "report-output", true, - "Optional report filename to save report to. (Also requires option -t) (To be better documented)"); - opt.addOption("w", "weighted", false, "Use weighted values if they exist in the model, and the generator is RANDOM."); - } - - /** - * Build the command manual command line parser - */ - @SuppressWarnings("static-access") - private void buildManualCLI() { - opt.addOption("x", false, "Use an extended finite state machine to handle the model."); - opt.addOption("j", false, "Enable JavaScript engine"); - opt.addOption(OptionBuilder - .isRequired() - .withArgName("stop-condition") - .withDescription( - "Defines the stop condition(s).\nHalts the generation after the specified stop-conditon(s) has been met. " - + "At least 1 condition must be given. If more than 1 is given, the condition that meets " - + "it's stop-condition first, will cause the generation to halt. " - + "To separate multiple conditions, the separator pipe-character | is used. " - + "A list of valid stop-conditions are:\n -------------------\n" + generateListOfValidStopConditions() - + " -------------------\nFor more extensive examples, " + "see http://mbt.tigris.org/wiki/All_about_stop_conditions") - .hasArg().create("s")); - opt.addOption(OptionBuilder - .isRequired() - .withArgName("generator") - .withDescription( - "The generator to be used when traversing the model. At least 1 generator must be given. " - + "To separate multiple generators, the separator pipe-character | is used. " - + "A list of valid generators are:\n -------------------\n" + generateListOfValidGenerators() - + " -------------------\nFor more extensive examples, " + "see http://mbt.tigris.org/wiki/All_about_generators").hasArg() - .create("g")); - opt.addOption(OptionBuilder.isRequired().withArgName("file|folder") - .withDescription("The file (or folder) containing graphml formatted files.").hasArg().create("f")); - opt.addOption("w", "weighted", false, "Use weighted values if they exist in the model, and the generator is RANDOM."); - } - - @SuppressWarnings("static-access") - private void buildMethodsCLI() { - opt.addOption(OptionBuilder.isRequired().withArgName("file|folder") - .withDescription("The file (or folder) containing graphml formatted files.").hasArg().withLongOpt("input_graphml").create("f")); - } - - /** - * Build the command merge command line parser - */ - @SuppressWarnings("static-access") - private void buildMergeCLI() { - opt.addOption(OptionBuilder.isRequired().withArgName("file|folder") - .withDescription("The file (or folder) containing graphml formatted files.").hasArg().withLongOpt("input_graphml").create("f")); - opt.addOption("i", "index", true, "Print out the INDEX value when merging models. Default is true"); - } - - /** - * Build the command source command line parser - */ - @SuppressWarnings("static-access") - private void buildSourceCLI() { - opt.addOption(OptionBuilder.isRequired().withArgName("file|folder") - .withDescription("The file (or folder) containing graphml formatted files.").hasArg().withLongOpt("input_graphml").create("f")); - opt.addOption(OptionBuilder.isRequired().withArgName("file").withDescription("The template file").hasArg().withLongOpt("template") - .create("t")); - } - - /** - * Build the command xml command line parser - */ - @SuppressWarnings("static-access") - private void buildXmlCLI() { - opt.addOption("a", false, "Prints the statistics of the test, at the end of the run."); - opt.addOption(OptionBuilder.isRequired().withArgName("file").withDescription("The xml file containing the mbt settings.").hasArg() - .create("f")); - opt.addOption(OptionBuilder - .withArgName("seconds") - .withDescription( - "Prints the test coverage of the graph during execution every . The printout goes to the log file defined in " - + "mbt.properties, and only, if at least INFO level is set in " + "that same file.").hasArg().create("o")); - opt.addOption("d", "dry-run", false, "Will execute a dry-run of the model. Dialog will pop up for every edge and vertex."); - } - - /** - * Build the command soap command line parser - */ - @SuppressWarnings("static-access") - private void buildSoapCLI() { - opt.addOption(OptionBuilder.withArgName("file").withDescription("The xml file containing the mbt model and settings.").hasArg() - .create("f")); - opt.addOption(OptionBuilder.withArgName("interface") - .withDescription("The network interface to which mbt should bind to. " + "If not given, the default is 0.0.0.0").hasArg() - .create("i")); - opt.addOption(OptionBuilder.withArgName("port") - .withDescription("The port to which mbt should listen to. " + "If not given, the default is 9090").hasArg().create("p")); - } - - /** - * Build the command gui command line parser - */ - @SuppressWarnings("static-access") - private void buildGuiCLI() { - opt.addOption(OptionBuilder.withArgName("file").withDescription("The xml file containing the mbt settings.").hasArg().create("f")); - } - - /** - * Build the command log command line parser - */ - @SuppressWarnings("static-access") - private void buildLogCLI() { - opt.addOption(OptionBuilder.isRequired().withArgName("file|folder") - .withDescription("The file (or folder) containing graphml formatted files.").hasArg().withLongOpt("input_graphml").create("f")); - opt.addOption(OptionBuilder.withArgName("log").withDescription("The log file from a previuos run.").hasArg().create("l")); - } - - /** - * Print version information - */ - private void printVersionInformation() { - System.out.println("org.graphwalker version " + mbt.getVersionString() + "\n"); - System.out.println("org.graphwalker is open source software licensed under MIT licens"); - System.out.println("The software (and it's source) can be downloaded from http://graphwalker.org"); - System.out - .println("For a complete list of this package software dependencies, see http://graphwalker.org:8080/job/graphwalker/site/dependencies.html"); - } - - /** - * Run the offline command - * - * @param cl - * @throws StopConditionException - * @throws GeneratorException - * @throws InterruptedException - * @throws FileNotFoundException - */ - private void RunCommandOffline(CommandLine cl) throws StopConditionException, GeneratorException, InterruptedException, - FileNotFoundException { - /** - * Get the model from the graphml file (or folder) - */ - if (helpNeeded("offline", !cl.hasOption("f"), "Missing the input graphml file (folder), See -f (--input_graphml)") - || helpNeeded("offline", !cl.hasOption("s"), "A stop condition must be supplied, See option -s") - || helpNeeded("offline", cl.hasOption("t") && !cl.hasOption("r"), - "A report output file must be set, See -t, when using a report template") - || helpNeeded("offline", !cl.hasOption("t") && cl.hasOption("r"), - "A report template must be set, See -r, when using a report output file") - || helpNeeded("offline", !cl.hasOption("g"), "Missing the generator, See option -g")) - return; - - getMbt().readGraph(cl.getOptionValue("f")); - getMbt().enableJsScriptEngine(cl.hasOption("j")); - getMbt().enableExtended(cl.hasOption("x")); - getMbt().setWeighted(cl.hasOption("w")); - - /* - * Set the stop-conditions(s) - */ - AlternativeCondition alternativeCondition = new AlternativeCondition(); - String[] stopConditions = cl.getOptionValue("s").split("\\|"); - for (String stopCondition : stopConditions) { - String[] sc = stopCondition.trim().split(":"); - alternativeCondition.add(Util.getCondition(null, Keywords.getStopCondition(sc[0].trim()) // Stop - // condition - , (sc.length == 1 ? "" : sc[1].trim()))); // Optional condition - // parameter - } - - /* - * Set the generators(s) - */ - String[] generators = cl.getOptionValue("g").split("\\|"); - for (String genrator : generators) { - getMbt().setGenerator(Keywords.getGenerator(genrator.trim())); - } - getMbt().getGenerator().setStopCondition(alternativeCondition); - - if (cl.hasOption("o")) { - long seconds = Integer.valueOf(cl.getOptionValue("o")).longValue(); - - logger.info("Append coverage to log every: " + seconds + " seconds"); - - TimerTask logTask; - if (cl.hasOption("t") && cl.hasOption("r")) { - getMbt().setUseStatisticsManager(true); - getMbt().getStatisticsManager().setReportTemplate(new FileInputStream(new File(cl.getOptionValue('t')))); - final String reportName = cl.getOptionValue('r'); - logTask = new TimerTask() { - @Override - public void run() { - try { - getMbt().getStatisticsManager().writeFullReport(new PrintStream(reportName)); - } catch (FileNotFoundException e) { - throw new RuntimeException("Could not open or write report file '" + reportName + "'", e); - } - } - }; - } else { - logTask = new TimerTask() { - @Override - public void run() { - logger.info(getMbt().getStatisticsCompact()); - } - }; - } - timer = new Timer(); - timer.schedule(logTask, 500, seconds * 1000); - } - - getMbt().writePath(); - - if (cl.hasOption("a")) { - writeStatisticsVerbose(System.out); - } - if (cl.hasOption("o")) { - logger.info(mbt.getStatisticsCompact()); - } - if (cl.hasOption("t") && cl.hasOption("r")) { - getMbt().getStatisticsManager().setReportTemplate(new FileInputStream(new File(cl.getOptionValue('t')))); - getMbt().getStatisticsManager().writeFullReport(cl.getOptionValue('r')); - } - - } - - /** - * Run the manual command - * - * @param cl - * @throws StopConditionException - * @throws GeneratorException - * @throws InterruptedException - */ - private void RunCommandManual(CommandLine cl) throws StopConditionException, GeneratorException, InterruptedException { - /** - * Get the model from the graphml file (or folder) - */ - if (helpNeeded("manual", !cl.hasOption("f"), "Missing the input graphml file (folder), See -f (--input_graphml)") - || helpNeeded("manual", !cl.hasOption("s"), "A stop condition must be supplied, See option -s") - || helpNeeded("manual", !cl.hasOption("g"), "Missing the generator, See option -g")) - return; - - getMbt().setManualTestSequence(true); - getMbt().readGraph(cl.getOptionValue("f")); - getMbt().enableJsScriptEngine(cl.hasOption("j")); - getMbt().enableExtended(cl.hasOption("x")); - getMbt().setWeighted(cl.hasOption("w")); - - /* - * Set the stop-conditions(s) - */ - AlternativeCondition alternativeCondition = new AlternativeCondition(); - String[] stopConditions = cl.getOptionValue("s").split("\\|"); - for (String stopCondition : stopConditions) { - String[] sc = stopCondition.trim().split(":"); - alternativeCondition.add(Util.getCondition(null, Keywords.getStopCondition(sc[0].trim()) // Stop - // condition - , (sc.length == 1 ? "" : sc[1].trim()))); // Optional condition - // parameter - } - - /* - * Set the generators(s) - */ - String[] generators = cl.getOptionValue("g").split("\\|"); - for (String genrator : generators) { - getMbt().setGenerator(Keywords.getGenerator(genrator.trim())); - } - getMbt().getGenerator().setStopCondition(alternativeCondition); - - Vector testSequence = new Vector(); - getMbt().writePath(testSequence); - - new PrintHTMLTestSequence(testSequence, System.out); - } - - /** - * Run the online command - * - * @param cl - * @throws StopConditionException - * @throws GeneratorException - * @throws InterruptedException - * @throws FileNotFoundException - */ - private void RunCommandOnline(CommandLine cl) throws StopConditionException, GeneratorException, InterruptedException, - FileNotFoundException { - /** - * Get the model from the graphml file (or folder) - */ - if (helpNeeded("online", !cl.hasOption("f"), "Missing the input graphml file (folder), See -f (--input_graphml)") - || helpNeeded("online", !cl.hasOption("s"), "A stop condition must be supplied, See option -s") - || helpNeeded("online", cl.hasOption("t") && !cl.hasOption("r"), - "A report output file must be set, See -t, when using a report template") - || helpNeeded("online", !cl.hasOption("t") && cl.hasOption("r"), - "A report template must be set, See -r, when using a report output file") - || helpNeeded("online", !cl.hasOption("g"), "Missing the generator, See option -g")) - return; - - getMbt().readGraph(cl.getOptionValue("f")); - getMbt().enableJsScriptEngine(cl.hasOption("j")); - getMbt().enableExtended(cl.hasOption("x")); - getMbt().setWeighted(cl.hasOption("w")); - - /* - * Set the stop-conditions(s) - */ - AlternativeCondition alternativeCondition = new AlternativeCondition(); - String[] stopConditions = cl.getOptionValue("s").split("\\|"); - for (String stopCondition : stopConditions) { - String[] sc = stopCondition.trim().split(":"); - alternativeCondition.add(Util.getCondition(null, Keywords.getStopCondition(sc[0].trim()) // Stop - // condition - , (sc.length == 1 ? "" : sc[1].trim()))); // Optional condition - // parameter - } - - /* - * Set the generators(s) - */ - String[] genrators = cl.getOptionValue("g").split("\\|"); - for (String genrator : genrators) { - getMbt().setGenerator(Keywords.getGenerator(genrator.trim())); - } - getMbt().getGenerator().setStopCondition(alternativeCondition); - - /** - * Set dry-run - */ - getMbt().setDryRun(cl.hasOption("d")); - - if (cl.hasOption("o")) { - long seconds = Integer.valueOf(cl.getOptionValue("o")).longValue(); - - logger.info("Append coverage to log every: " + seconds + " seconds"); - - TimerTask logTask; - if (cl.hasOption("t") && cl.hasOption("r")) { - getMbt().setUseStatisticsManager(true); - getMbt().getStatisticsManager().setReportTemplate(new FileInputStream(new File(cl.getOptionValue('t')))); - final String reportName = cl.getOptionValue('r'); - logTask = new TimerTask() { - @Override - public void run() { - try { - getMbt().getStatisticsManager().writeFullReport(new PrintStream(reportName)); - } catch (FileNotFoundException e) { - throw new RuntimeException("Could not open or write report file '" + reportName + "'", e); - } - } - }; - } else { - logTask = new TimerTask() { - @Override - public void run() { - logger.info(getMbt().getStatisticsCompact()); - } - }; - } - timer = new Timer(); - timer.schedule(logTask, 500, seconds * 1000); - } - - if (cl.hasOption("c")) { - getMbt().executePath(cl.getOptionValue("c")); - } else if (cl.hasOption("d")) { - getMbt().executePath((String) null); - } else { - getMbt().interractivePath(); - } - - if (cl.hasOption("a")) { - writeStatisticsVerbose(System.out); - } - if (cl.hasOption("o")) { - logger.info(mbt.getStatisticsCompact()); - } - if (cl.hasOption("t") && cl.hasOption("r")) { - getMbt().getStatisticsManager().setReportTemplate(new FileInputStream(new File(cl.getOptionValue('t')))); - getMbt().getStatisticsManager().writeFullReport(cl.getOptionValue('r')); - } - - } - - private void writeStatisticsVerbose(PrintStream out) { - out.println(getMbt().getStatisticsVerbose()); - } - - /** - * Run the source command - * - * @param cl - * @throws GeneratorException - * @throws IOException - * @throws InterruptedException - */ - private void RunCommandSource(CommandLine cl) throws GeneratorException, IOException, InterruptedException { - if (helpNeeded("source", !cl.hasOption("f"), "Missing the input graphml file (folder), See -f (--input_graphml)") - || helpNeeded("source", !cl.hasOption("t"), "Missing the template file. See -t (--template)")) - return; - - getMbt().readGraph(cl.getOptionValue("f")); - getMbt().setTemplate(cl.getOptionValue("t")); - getMbt().setGenerator(Keywords.GENERATOR_STUB); - getMbt().writePath(System.out); - } - - /** - * Run the requirements command This method prints out all the Requirements - * found in the graph. - * - * @throws GeneratorException - * @throws InterruptedException - */ - private void RunCommandRequirements(CommandLine cl) throws GeneratorException, InterruptedException { - if (helpNeeded("requirements", !cl.hasOption("f"), "Missing the input graphml file (folder), See -f (--input_graphml)")) - return; - - getMbt().readGraph(cl.getOptionValue("f")); - getMbt().getMachine().populateReqHashMap(); - - Iterator> it = getMbt().getMachine().getReqs().entrySet().iterator(); - while (it.hasNext()) { - Entry pairs = it.next(); - System.out.println(pairs.getKey()); - } - } - - /** - * Run the methods command - * - * @param cl - * @throws GeneratorException - * @throws InterruptedException - */ - private void RunCommandMethods(CommandLine cl) throws GeneratorException, InterruptedException { - if (helpNeeded("methods", !cl.hasOption("f"), "Missing the input graphml file (folder), See -f (--input_graphml)")) - return; - - getMbt().readGraph(cl.getOptionValue("f")); - getMbt().setTemplate(new String[] { "", "{LABEL}", "" }); - getMbt().setGenerator(Keywords.GENERATOR_STUB); - getMbt().writePath(System.out); - } - - /** - * Run the merge command - * - * @param cl - */ - private void RunCommandMerge(CommandLine cl) { - if (helpNeeded("merge", !cl.hasOption("f"), "Missing the input graphml file (folder), See -f (--input_graphml)")) - return; - - getMbt().readGraph(cl.getOptionValue("f")); - getMbt().writeModel(System.out, !cl.hasOption("i")); - } - - /** - * Run the xml command - * - * @param cl - * @throws StopConditionException - * @throws GeneratorException - * @throws IOException - * @throws JDOMException - * @throws InterruptedException - */ - private void RunCommandXml(CommandLine cl) throws StopConditionException, GeneratorException, IOException, JDOMException, - InterruptedException { - if (helpNeeded("xml", !cl.hasOption("f"), "Missing the input xml file, See option -f")) - return; - - setMbt(Util.loadMbtFromXml(Util.getFile(cl.getOptionValue("f")), cl.hasOption("d"))); - - if (cl.hasOption("a")) { - logger.info(getMbt().getStatisticsVerbose()); - writeStatisticsVerbose(System.out); - } - } - - /** - * Run the soap command - * - * @param cl - * @throws StopConditionException - * @throws GeneratorException - * @throws IOException - * @throws JDOMException - * @throws InterruptedException - */ - private void RunCommandSoap(CommandLine cl) throws StopConditionException, GeneratorException, IOException, JDOMException, - InterruptedException { - String port = null; - String nicAddr = null; - if (cl.hasOption("p")) { - port = cl.getOptionValue("p"); - } else { - port = Util.readWSPort(); - } - - if (cl.hasOption("i")) { - nicAddr = Util.getInternetAddr(cl.getOptionValue("i")).getCanonicalHostName(); - } else { - nicAddr = "0.0.0.0"; - } - - String file = cl.getOptionValue("f"); - if (file == null || file.isEmpty()) { - setMbt(new ModelBasedTesting()); - } else { - setMbt(Util.loadMbtAsWSFromXml(Util.getFile(file))); - } - - String wsURL = "http://" + nicAddr + ":" + port + "/mbt-services"; - SoapServices soapService = new SoapServices(getMbt()); - soapService.xmlFile = file; - - endpoint = Endpoint.publish(wsURL, soapService); - - if (nicAddr.equals("0.0.0.0")) { - wsURL = wsURL.replace("0.0.0.0", InetAddress.getLocalHost().getHostName()); - } - - System.out.println("Now running as a SOAP server. For the WSDL file, see: " + wsURL + "?WSDL"); - System.out.println("Press Ctrl+C to quit"); - System.out.println(""); - } - - /** - * Run the gui command - * - * @param cl - * @throws IOException - */ - private void RunCommandGui(CommandLine cl) throws IOException { - if (cl.hasOption("f")) { - App.main(new String[] { cl.getOptionValue("f") }); - } else { - App.main(); - } - } - - /** - * Run the log command - * - * @param cl - * @throws IOException - */ - private void RunCommandLog(CommandLine cl) throws IOException { - if (helpNeeded("log", !cl.hasOption("f"), "Missing the input graphml file (folder), See -f (--input_graphml)") - || helpNeeded("log", !cl.hasOption("l"), "Missing the log file. See -l")) - return; - - App.main(new String[] { cl.getOptionValue("f"), cl.getOptionValue("l") }); - } - - private boolean helpNeeded(String module, boolean condition, String message) { - if (condition) { - System.out.println(message); - System.out.println("Type 'java -jar graphwalker.jar help " + module + "' for help."); - } - return condition; - } - - private Endpoint GetEndpoint() { - return endpoint; - } -} \ No newline at end of file diff --git a/src/main/java/org/graphwalker/ClassPathHack.java b/src/main/java/org/graphwalker/ClassPathHack.java deleted file mode 100644 index d019febb..00000000 --- a/src/main/java/org/graphwalker/ClassPathHack.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.graphwalker; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Method; -import java.net.URL; -import java.net.URLClassLoader; - -public class ClassPathHack { - private static final Class[] parameters = new Class[] { URL.class }; - - @SuppressWarnings("deprecation") - public static void addFile(File f) throws IOException { - // f.toURL is deprecated - addURL(f.toURL()); - } - - protected static void addURL(URL u) throws IOException { - URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader(); - Class sysclass = URLClassLoader.class; - - try { - Method method = sysclass.getDeclaredMethod("addURL", parameters); - method.setAccessible(true); - method.invoke(sysloader, u); - } catch (Exception e) { - Util.logStackTraceToError(e); - throw new IOException("Error, could not add URL to system classloader"); - } - - } -} diff --git a/src/main/java/org/graphwalker/EventDrivenModels.java b/src/main/java/org/graphwalker/EventDrivenModels.java deleted file mode 100644 index ef0b316f..00000000 --- a/src/main/java/org/graphwalker/EventDrivenModels.java +++ /dev/null @@ -1,150 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker; - -import java.util.Stack; -import java.util.Vector; - -import org.apache.log4j.Logger; - -public class EventDrivenModels { - private static Logger logger = Util.setupLogger(EventDrivenModels.class); - Vector models = new Vector(); - Stack pausedModels = new Stack(); - private Object executionClass = null; - private ThreadWrapper executingModel = null; - private static final Object lockbox = new Object(); - - public EventDrivenModels(Object executionClass) { - this.executionClass = executionClass; - } - - public EventDrivenModels() { - } - - public Vector getModels() { - return models; - } - - public void addModel(ModelBasedTesting model) { - models.add(model); - } - - public void runModel(String modelName) { - stopAndSwitchModel(modelName); - } - - public void stopAndSwitchModel(String modelName) { - logger.debug("Will switch to model: " + modelName); - if (executingModel != null) { - logger.debug("Stopping model thread: " + executingModel); - executingModel.getModel().stop(); - executingModel = null; - } - for (ModelBasedTesting m : models) { - if (modelName.equals(m.getGraph().getLabelKey())) { - logger.debug("Found the model, will now start it: " + m.getGraph().getLabelKey()); - executingModel = new ThreadWrapper(m); - executingModel.start(); - return; - } - } - throw new RuntimeException("Did not find a model: " + modelName); - } - - public void pauseAndSwitchModel(String modelName) { - logger.debug("Will switch to model: " + modelName); - if (executingModel != null) { - logger.debug("Suspending model thread: " + executingModel); - executingModel.getModel().suspend(); - pausedModels.push(executingModel); - executingModel = null; - } - for (ModelBasedTesting m : models) { - if (modelName.equals(m.getGraph().getLabelKey())) { - logger.debug("Found the model, will now start it: " + m.getGraph().getLabelKey()); - executingModel = new ThreadWrapper(m); - executingModel.start(); - return; - } - } - throw new RuntimeException("Did not find a model: " + modelName); - } - - public void waitToFinish() { - try { - while (true) { - synchronized (lockbox) { - if (executingModel == null) { - if (pausedModels.isEmpty()) { - logger.debug("All threads terminated"); - return; - } - logger.debug("Found suspended model: " + pausedModels.peek()); - executingModel = pausedModels.pop(); - executingModel.getModel().resume(); - } else { - if (executingModel.getState() == Thread.State.TERMINATED) { - logger.debug("Terminated: " + executingModel); - executingModel = null; - } - } - } - Thread.sleep(100); - } - } catch (InterruptedException e) { - Util.logStackTraceToError(e); - } - } - - public class ThreadWrapper extends Thread { - private ModelBasedTesting model; - - public ModelBasedTesting getModel() { - return model; - } - - public void setModel(ModelBasedTesting model) { - this.model = model; - } - - public ThreadWrapper(ModelBasedTesting model) { - this.model = model; - setName(model.getGraph().getLabelKey()); - } - - @Override - public void run() { - try { - model.setCurrentVertex("Start"); - model.reload(); - model.executePath(executionClass); - } catch (InterruptedException e) { - Util.logStackTraceToError(e); - } catch (RuntimeException e) { - logger.debug(e.getMessage()); - } - } - } -} diff --git a/src/main/java/org/graphwalker/GUI/App.java b/src/main/java/org/graphwalker/GUI/App.java deleted file mode 100644 index 02c9103b..00000000 --- a/src/main/java/org/graphwalker/GUI/App.java +++ /dev/null @@ -1,1115 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.GUI; - -import java.awt.BasicStroke; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Paint; -import java.awt.Shape; -import java.awt.Stroke; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.geom.Point2D; -import java.awt.geom.Rectangle2D; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.lang.reflect.Constructor; -import java.net.InetAddress; -import java.net.URL; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.List; -import java.util.Timer; -import java.util.TimerTask; -import java.util.Vector; - -import javax.swing.DefaultListCellRenderer; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JSplitPane; -import javax.swing.JTextArea; -import javax.swing.JToolBar; -import javax.swing.SwingConstants; -import javax.swing.SwingWorker; -import javax.swing.event.ChangeEvent; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.xml.ws.Endpoint; - -import org.apache.commons.collections15.Transformer; -import org.apache.log4j.Logger; -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.SoapServices; -import org.graphwalker.Util; -import org.graphwalker.events.AppEvent; -import org.graphwalker.events.MbtEvent; -import org.graphwalker.exceptions.GeneratorException; -import org.graphwalker.exceptions.GuiStoppedExecution; -import org.graphwalker.exceptions.StopConditionException; -import org.graphwalker.graph.AbstractElement; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; -import org.graphwalker.io.ParseLog; -import org.jdom.JDOMException; - -import edu.uci.ics.jung.algorithms.layout.CircleLayout; -import edu.uci.ics.jung.algorithms.layout.FRLayout; -import edu.uci.ics.jung.algorithms.layout.ISOMLayout; -import edu.uci.ics.jung.algorithms.layout.KKLayout; -import edu.uci.ics.jung.algorithms.layout.SpringLayout; -import edu.uci.ics.jung.algorithms.layout.SpringLayout2; -import edu.uci.ics.jung.algorithms.layout.StaticLayout; -import edu.uci.ics.jung.algorithms.layout.Layout; -import edu.uci.ics.jung.visualization.Layer; -import edu.uci.ics.jung.visualization.VisualizationViewer; -import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; -import edu.uci.ics.jung.visualization.layout.LayoutTransition; -import edu.uci.ics.jung.visualization.picking.ShapePickSupport; -import edu.uci.ics.jung.visualization.renderers.Renderer; -import edu.uci.ics.jung.visualization.util.Animator; - -public class App extends JFrame implements ActionListener, MbtEvent { - /** - * - */ - private static final long serialVersionUID = -8605452811238545133L; - private static final String title = "GraphWalker " + ModelBasedTesting.getInstance().getVersionString(); - - private ModelBasedTesting mbt; - - private JSplitPane splitPaneMessages = null; - private JSplitPane splitPaneGraph = null; - private JPanel panelStatistics = null; - private JPanel panelVariables = null; - private JPanel panelGraph = null; - private JTextArea statisticsTextArea = null; - private JTextArea variablesTextArea = null; - private JLabel latestVertexLabel = null; - private JFileChooser fileChooser = new JFileChooser(System.getProperty("user.dir")); - private VisualizationViewer vv; - private Layout graphLayout; - - private File xmlFile = null; - private File graphmlFile = null; - private File logFile = null; - private ExecuteMBT executeMBT = null; - private Timer updateColorLatestVertexLabel = new Timer(); - - static private Logger logger; - private Endpoint endpoint = null; - private SoapServices soapService = null; - - private JButton loadButton; - private JButton reloadButton; - private JButton firstButton; - private JButton backButton; - private JButton runButton; - private JButton pauseButton; - private JButton nextButton; - private JCheckBox soapButton; - private JCheckBox centerOnVertexButton; - private StatusBar statusBar; - - private Status status = new Status(); - private Vector parsedLogFile = null; - private Integer currentStep = null; - - public Status getStatus() { - return status; - } - - public void setStatus(Status status) { - this.status = status; - setButtons(); - } - - public ModelBasedTesting getMbt() { - return mbt; - } - - public void setMbt(ModelBasedTesting mbt) { - this.mbt = mbt; - } - - private String newline = "\n"; - static final private String LOAD = "load"; - static final private String RELOAD = "reload"; - static final private String FIRST = "first"; - static final private String BACK = "BACK"; - static final private String RUN = "run"; - static final private String PAUSE = "pause"; - static final private String NEXT = "next"; - static final private String SOAP = "soap"; - static final private String CENTERONVERTEX = "centerOnVertex"; - - static private AppEvent appEvent = null; - static private ChangeEvent changeEvent = null; - - @SuppressWarnings({ "unchecked", "rawtypes" }) - private static Class[] getCombos() { - List> layouts = new ArrayList>(); - layouts.add(StaticLayout.class); - layouts.add(KKLayout.class); - layouts.add(FRLayout.class); - layouts.add(CircleLayout.class); - layouts.add(SpringLayout.class); - layouts.add(SpringLayout2.class); - layouts.add(ISOMLayout.class); - return layouts.toArray(new Class[layouts.size()]); - } - - private void stopSoap() { - endpoint.stop(); - status.unsetState(Status.executingSoapTest); - status.setState(Status.paused); - statusBar.setMessage("Paused"); - setButtons(); - logger.debug("SOAP service stopped"); - loadModel(); - } - - private void runSoap() { - if (endpoint != null) { - endpoint = null; - } - setWaitCursor(); - - if (executeMBT != null) { - executeMBT.cancel(true); - } - - String wsURL = "http://0.0.0.0:" + Util.readWSPort() + "/mbt-services"; - try { - mbt = Util.loadMbtAsWSFromXml(Util.getFile(xmlFile.getAbsolutePath())); - mbt.setUseGUI(); - soapService = new SoapServices(mbt); - soapService.xmlFile = xmlFile.getAbsolutePath(); - } catch (Exception e) { - logger.error("Failed to start the SOAP service. " + e.getMessage()); - JOptionPane.showMessageDialog(App.getInstance(), "Failed to start the SOAP service. " + e.getMessage()); - soapButton.setSelected(false); - status.setStopped(); - reset(); - return; - } - endpoint = Endpoint.publish(wsURL, soapService); - - try { - String msg = "Now running as a SOAP server. For the WSDL file, see: " - + wsURL.replace("0.0.0.0", InetAddress.getLocalHost().getHostName()) + "?WSDL"; - logger.info(msg); - if (!Util.readSoapGuiStartupState()) { - JOptionPane.showMessageDialog(App.getInstance(), msg); - } - status.unsetState(Status.stopped); - status.unsetState(Status.paused); - status.setState(Status.executingSoapTest); - statusBar.setMessage(msg); - } catch (UnknownHostException e) { - logger.error("Failed to start the SOAP service. " + e.getMessage()); - JOptionPane.showMessageDialog(App.getInstance(), "Failed to start the SOAP service. " + e.getMessage()); - soapButton.setSelected(false); - status.setStopped(); - reset(); - } finally { - setButtons(); - setDefaultCursor(); - updateLayout(); - } - } - - @Override - public void getNextEvent() { - updateUI(); - getVv().stateChanged(changeEvent); - if (centerOnVertexButton.isSelected()) { - centerOnVertex(); - } - } - - @Override - public void actionPerformed(ActionEvent e) { - String cmd = e.getActionCommand(); - logger.debug("Got action: " + cmd); - - // Handle each button. - if (LOAD.equals(cmd)) { - load(); - } else if (RELOAD.equals(cmd)) { - reload(); - } else if (FIRST.equals(cmd)) { - first(); - } else if (BACK.equals(cmd)) { - prev(); - } else if (RUN.equals(cmd)) { - if (status.isExecutingLogTest()) - next(); - else - run(); - } else if (PAUSE.equals(cmd)) { - pause(); - } else if (NEXT.equals(cmd)) { - if (status.isExecutingLogTest()) - last(); - else - next(); - } else if (SOAP.equals(cmd)) { - if (soapButton.isSelected()) { - runSoap(); - } else { - stopSoap(); - } - } else if (CENTERONVERTEX.equals(cmd)) { // center on vertex checkbox - // clicked - if (centerOnVertexButton.isSelected()) { - centerOnVertex(); - getVv().repaint(); - } - } - } - - private void load() { - status.setStopped(); - statusBar.setMessage("Stopped"); - - fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); - FileNameExtensionFilter filter = new FileNameExtensionFilter("XML files", "xml"); - fileChooser.setFileFilter(filter); - int returnVal = fileChooser.showOpenDialog(getContentPane()); - if (returnVal == JFileChooser.APPROVE_OPTION) { - xmlFile = fileChooser.getSelectedFile(); - logger.debug("Got file: " + xmlFile.getAbsolutePath()); - loadModel(); - if (appEvent != null) { - appEvent.getLoadEvent(); - } - } - } - - private void outPut() { - if (mbt.getMachine() == null || mbt.getGraph() == null) { - statisticsTextArea.setText(""); - variablesTextArea.setText(""); - return; - } - statisticsTextArea.setText(mbt.getStatisticsString()); - - String str = (mbt.getMachine().getLastEdge() == null ? "" : "Edge: " + mbt.getMachine().getLastEdge().getLabelKey()) - + (mbt.getMachine().getCurrentVertex() == null ? "" : " Vertex: " + mbt.getMachine().getCurrentVertex().getLabelKey()); - getLatestVertexLabel().setText(str); - - if (status.isExecutingLogTest()) { - if (parsedLogFile.get(currentStep).data != null) { - str = parsedLogFile.get(currentStep).data; - } else { - str = variablesTextArea.getText(); - } - } else { - str = mbt.getMachine().getCurrentDataString(); - } - str = str.replaceAll(";", newline); - variablesTextArea.setText(str); - } - - public void setButtons() { - if (status.isStopped()) { - loadButton.setEnabled(true); - reloadButton.setEnabled(true); - firstButton.setEnabled(false); - backButton.setEnabled(false); - runButton.setEnabled(false); - pauseButton.setEnabled(false); - nextButton.setEnabled(false); - soapButton.setEnabled(false); - } else if (status.isPaused() && status.isExecutingSoapTest()) { - loadButton.setEnabled(true); - reloadButton.setEnabled(true); - firstButton.setEnabled(false); - backButton.setEnabled(false); - runButton.setEnabled(true); - pauseButton.setEnabled(false); - nextButton.setEnabled(true); - soapButton.setEnabled(true); - } else if (status.isRunning() || status.isNext() || status.isExecutingJavaTest() || status.isExecutingSoapTest()) { - loadButton.setEnabled(false); - reloadButton.setEnabled(false); - firstButton.setEnabled(false); - backButton.setEnabled(false); - runButton.setEnabled(false); - pauseButton.setEnabled(true); - nextButton.setEnabled(false); - soapButton.setEnabled(false); - } else if (status.isPaused() && !(status.isNext() || status.isExecutingJavaTest())) { - loadButton.setEnabled(true); - reloadButton.setEnabled(true); - firstButton.setEnabled(true); - backButton.setEnabled(false); - runButton.setEnabled(true); - pauseButton.setEnabled(false); - nextButton.setEnabled(true); - soapButton.setEnabled(true); - } else if (status.isExecutingLogTest()) { - loadButton.setEnabled(false); - reloadButton.setEnabled(false); - firstButton.setEnabled(true); - backButton.setEnabled(true); - runButton.setEnabled(true); - pauseButton.setEnabled(false); - nextButton.setEnabled(true); - soapButton.setEnabled(false); - } - } - - @SuppressWarnings("synthetic-access") - private void loadModel() { - setWaitCursor(); - if (executeMBT != null) { - executeMBT.cancel(true); - } - logger.debug("Loading model"); - status.unsetState(Status.stopped); - status.setState(Status.paused); - statusBar.setMessage("Paused"); - try { - if (soapButton.isSelected()) { - mbt = Util.loadMbtAsWSFromXml(Util.getFile(xmlFile.getAbsolutePath())); - mbt.setUseGUI(); - soapService.mbt = mbt; - } else { - mbt = Util.loadMbtFromXml(Util.getFile(xmlFile.getAbsolutePath())); - } - setTitle(title + " - " + xmlFile.getName()); - } catch (ArrayIndexOutOfBoundsException e) { - logger.warn(e.getMessage()); - JOptionPane.showMessageDialog(App.getInstance(), e.getMessage()); - reset(); - return; - } catch (StopConditionException e) { - logger.warn(e.getMessage()); - JOptionPane.showMessageDialog(App.getInstance(), e.getMessage()); - reset(); - return; - } catch (GeneratorException e) { - logger.warn(e.getMessage()); - JOptionPane.showMessageDialog(App.getInstance(), e.getMessage()); - reset(); - return; - } catch (JDOMException e) { - logger.warn(e.getMessage()); - JOptionPane.showMessageDialog(App.getInstance(), e.getMessage()); - reset(); - return; - } catch (FileNotFoundException e) { - logger.warn(e.getMessage()); - JOptionPane.showMessageDialog(App.getInstance(), e.getMessage()); - reset(); - return; - } catch (IOException e) { - logger.warn(e.getMessage()); - JOptionPane.showMessageDialog(App.getInstance(), e.getMessage()); - reset(); - return; - } catch (RuntimeException e) { - logger.warn(e.getMessage()); - JOptionPane.showMessageDialog(App.getInstance(), e.getMessage()); - reset(); - return; - } catch (Exception e) { - Util.logStackTraceToError(e); - JOptionPane.showMessageDialog(App.getInstance(), e.getMessage()); - reset(); - return; - } - mbt.setUseGUI(); - centerOnVertex(); - updateLayout(); - - if (!soapButton.isSelected()) { - if (executeMBT != null) { - executeMBT = null; - } - (executeMBT = new ExecuteMBT()).execute(); - } - setButtons(); - setDefaultCursor(); - } - - private void reset() { - statisticsTextArea.setText(""); - variablesTextArea.setText(""); - getLatestVertexLabel().setText(""); - - setTitle(title); - mbt.reset(); - setGraphLayout(new StaticLayout(new Graph())); - getVv().setGraphLayout(getGraphLayout()); - status.reset(); - setButtons(); - setDefaultCursor(); - } - - public void run() { - status.unsetState(Status.stopped); - if (status.isExecutingSoapTest()) { - status.unsetState(Status.paused); - } else { - status.setState(Status.running); - } - statusBar.setMessage("Running"); - setButtons(); - } - - public void executingJavaTest(boolean executingJavaTest) { - if (executingJavaTest) { - status.setState(Status.executingJavaTest); - statusBar.setMessage("Executing a Java test"); - } else { - status.unsetState(Status.executingJavaTest); - } - setButtons(); - } - - private class ExecuteMBT extends SwingWorker { - private Logger log = Util.setupLogger(ExecuteMBT.class); - - @Override - protected Void doInBackground() { - try { - log.debug("GUI is starting to traverse the model"); - mbt.executePath(); - } catch (InterruptedException e) { - // - } catch (GuiStoppedExecution e) { - // - } catch (Exception e) { - Util.logStackTraceToError(e); - log.error(e.getMessage()); - log.error(e.getCause()); - JOptionPane.showMessageDialog(App.getInstance(), e.getCause().getMessage()); - } - return null; - } - - @Override - protected void done() { - super.done(); - log.debug("GUI is finished traversing the model"); - App.getInstance().stop(); - } - } - - private void stop() { - status.setState(Status.stopped); - statusBar.setMessage("Stopped"); - setButtons(); - } - - public void pause() { - status.unsetState(Status.stopped); - status.unsetState(Status.running); - status.setState(Status.paused); - statusBar.setMessage("Paused"); - setButtons(); - } - - private void first() { - if (status.isExecutingLogTest()) { - mbt.setAllUnvisited(); - currentStep = 0; - Integer index = parsedLogFile.get(currentStep).index; - AbstractElement ae = mbt.getMachine().findElement(index); - if (ae instanceof Edge) { - mbt.getMachine().setLastEdge((Edge) ae); - mbt.setCurrentVertex((Vertex) null); - } else if (ae instanceof Vertex) { - mbt.setCurrentVertex((Vertex) ae); - mbt.getMachine().setLastEdge(null); - } - outPut(); - if (centerOnVertexButton.isSelected()) - centerOnVertex(); - getVv().repaint(); - } - } - - private void last() { - if (status.isExecutingLogTest()) { - Integer index = null; - for (; currentStep < parsedLogFile.size(); currentStep++) { - index = parsedLogFile.get(currentStep).index; - mbt.setAsVisited(index); - } - index = parsedLogFile.get(--currentStep).index; - AbstractElement ae = mbt.getMachine().findElement(index); - if (ae instanceof Edge) { - mbt.getMachine().setLastEdge((Edge) ae); - mbt.setCurrentVertex((Vertex) null); - } else if (ae instanceof Vertex) { - mbt.setCurrentVertex((Vertex) ae); - mbt.getMachine().setLastEdge(null); - } - outPut(); - if (centerOnVertexButton.isSelected()) - centerOnVertex(); - getVv().repaint(); - } - } - - private void prev() { - if (status.isExecutingLogTest()) { - Integer index = parsedLogFile.get(currentStep).index; - AbstractElement ae = mbt.decrementVisited(index); - if (currentStep > 0) - currentStep--; - index = parsedLogFile.get(currentStep).index; - ae = mbt.decrementVisited(index); - if (ae instanceof Edge) { - mbt.getMachine().setLastEdge((Edge) ae); - mbt.setCurrentVertex((Vertex) null); - } else if (ae instanceof Vertex) { - mbt.setCurrentVertex((Vertex) ae); - mbt.getMachine().setLastEdge(null); - } - outPut(); - if (centerOnVertexButton.isSelected()) - centerOnVertex(); - getVv().repaint(); - } - } - - private void next() { - if (status.isExecutingLogTest()) { - if (currentStep < parsedLogFile.size() - 1) - currentStep++; - Integer index = parsedLogFile.get(currentStep).index; - AbstractElement ae = mbt.setAsVisited(index); - if (ae instanceof Edge) { - mbt.getMachine().setLastEdge((Edge) ae); - mbt.setCurrentVertex((Vertex) null); - } else if (ae instanceof Vertex) { - mbt.setCurrentVertex((Vertex) ae); - mbt.getMachine().setLastEdge(null); - } - outPut(); - if (centerOnVertexButton.isSelected()) - centerOnVertex(); - getVv().repaint(); - return; - } - if (!mbt.hasNextStep()) { - status.setState(Status.stopped); - statusBar.setMessage("Stopped"); - setButtons(); - return; - } - if (status.isNext()) { - return; - } - status.setState(Status.next); - setButtons(); - if (centerOnVertexButton.isSelected()) - centerOnVertex(); - } - - private void centerOnVertex() { - Vertex v = mbt.getCurrentVertex(); - if (v != null) { - Point2D target = getVv().getGraphLayout().transform(v); - Point2D current = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(vv.getCenter()); - double dx = current.getX() - target.getX(); - double dy = current.getY() - target.getY(); - vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).translate(dx, dy); - } - } - - private void updateUI() { - logger.debug("Updating the UI"); - outPut(); - } - - private void reload() { - logger.debug("reload"); - status.setStopped(); - statusBar.setMessage("Stopped"); - loadModel(); - } - - public void setGraphLayout(Layout graphLayout) { - logger.debug("setLayout using: " + graphLayout.toString()); - this.graphLayout = graphLayout; - - Transformer vertexLocation = new Transformer() { - @Override - public Point2D transform(Vertex v) { - return v.getLocation(); - } - }; - - this.graphLayout.setInitializer(vertexLocation); - } - - public VisualizationViewer getVv() { - return vv; - } - - private void setWaitCursor() { - setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - } - - private void setDefaultCursor() { - setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - } - - public void updateLayout() { - if (mbt == null || mbt.getGraph() == null) { - return; - } - if (isVisible()) { - logger.debug("updateLayout"); - setWaitCursor(); - setGraphLayout(new StaticLayout(mbt.getGraph())); - getVv().setGraphLayout(getGraphLayout()); - updateUI(); - setDefaultCursor(); - } - } - - public class MyEdgePaintFunction implements Transformer { - @Override - public Paint transform(Edge e) { - if (mbt.getMachine().getLastEdge() != null && mbt.getMachine().getLastEdge().equals(e)) - return Color.RED; - else if (e.getVisitedKey() > 0) - return Color.LIGHT_GRAY; - else - return Color.BLUE; - } - } - - private class MyEdgeStrokeFunction implements Transformer { - private final Stroke UNVISITED = new BasicStroke(3); - private final Stroke VISITED = new BasicStroke(1); - private final Stroke CURRENT = new BasicStroke(3); - - @Override - public Stroke transform(Edge e) { - if (mbt.getMachine().getLastEdge() != null && mbt.getMachine().getLastEdge().equals(e)) - return CURRENT; - else if (e.getVisitedKey() > 0) - return VISITED; - else - return UNVISITED; - } - - } - - private class MyVertexPaintFunction implements Transformer { - @Override - public Paint transform(Vertex v) { - if (mbt.getMachine().isCurrentVertex(v)) - return Color.RED; - else if (v.getVisitedKey() > 0) - return Color.LIGHT_GRAY; - else - return Color.BLUE; - } - } - - private class MyVertexFillPaintFunction implements Transformer { - @Override - public Paint transform(Vertex v) { - if (mbt.getMachine().isCurrentVertex(v)) - return Color.RED; - else if (v.getVisitedKey() > 0) - return Color.LIGHT_GRAY; - else - return v.getFillColor(); - } - } - - private VisualizationViewer getGraphViewer() { - if (mbt == null || mbt.getGraph() == null) - setGraphLayout(new StaticLayout(new Graph())); - else - setGraphLayout(new StaticLayout(mbt.getGraph())); - - vv = new VisualizationViewer(getGraphLayout()); - - DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse(); - vv.setGraphMouse(graphMouse); - vv.setPickSupport(new ShapePickSupport(vv)); - vv.setBackground(Color.WHITE); - vv.getRenderContext().setVertexDrawPaintTransformer(new MyVertexPaintFunction()); - vv.getRenderContext().setVertexFillPaintTransformer(new MyVertexFillPaintFunction()); - vv.getRenderContext().setEdgeDrawPaintTransformer(new MyEdgePaintFunction()); - vv.getRenderContext().setEdgeStrokeTransformer(new MyEdgeStrokeFunction()); - vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR); - - Transformer vertexShape = new Transformer() { - @Override - public Shape transform(Vertex v) { - return new Rectangle2D.Float(0, 0, v.getWidth(), v.getHeight()); - } - }; - vv.getRenderContext().setVertexShapeTransformer(vertexShape); - - Transformer vertexStringer = new Transformer() { - @Override - public String transform(Vertex v) { - return "
" + v.getFullLabelKey().replaceAll("\\n", "

") + "

INDEX=" + v.getIndexKey(); - } - }; - vv.getRenderContext().setVertexLabelTransformer(vertexStringer); - - Transformer edgeStringer = new Transformer() { - @Override - public String transform(Edge e) { - return "

" + e.getFullLabelKey().replaceAll("\\n", "

") + "

INDEX=" + e.getIndexKey(); - } - }; - vv.getRenderContext().setEdgeLabelTransformer(edgeStringer); - - return vv; - } - - private void createPanelStatistics() { - panelStatistics = new JPanel(); - panelStatistics.setLayout(new BorderLayout()); - - statisticsTextArea = new JTextArea(); - statisticsTextArea.setPreferredSize(new Dimension(300, 100)); - panelStatistics.add(statisticsTextArea, BorderLayout.CENTER); - } - - private void createPanelVariables() { - panelVariables = new JPanel(); - panelVariables.setLayout(new BorderLayout()); - - variablesTextArea = new JTextArea(); - variablesTextArea.setPreferredSize(new Dimension(100, 100)); - panelVariables.add(variablesTextArea, BorderLayout.CENTER); - } - - private JButton makeNavigationButton(String imageName, String actionCommand, String toolTipText, String altText, boolean enabled) { - // Look for the image. - String imgLocation = "resources/icons/" + imageName + ".png"; - URL imageURL = App.class.getResource(imgLocation); - - // Create and initialize the button. - JButton button = new JButton(); - button.setActionCommand(actionCommand); - button.setToolTipText(toolTipText); - button.addActionListener(this); - button.setEnabled(enabled); - - if (imageURL != null) { // image found - button.setIcon(new ImageIcon(imageURL, altText)); - } else { // no image found - button.setText(altText); - logger.error("Resource not found: " + imgLocation); - } - - return button; - } - - private JCheckBox makeNavigationCheckBoxButton(String imageName, String actionCommand, String toolTipText, String altText) { - // Create and initialize the button. - JCheckBox button = new JCheckBox(); - button.setActionCommand(actionCommand); - button.setToolTipText(toolTipText); - button.addActionListener(this); - - button.setText(altText); - - return button; - } - - private final class LayoutChooser implements ActionListener { - private final JComboBox jcb; - private final VisualizationViewer vv; - - private LayoutChooser(JComboBox jcb, VisualizationViewer vv) { - super(); - this.jcb = jcb; - this.vv = vv; - } - - @Override - @SuppressWarnings("unchecked") - public void actionPerformed(ActionEvent arg0) { - Graph graph = null; - if (mbt == null || mbt.getGraph() == null) - graph = new Graph(); - else - graph = mbt.getGraph(); - - Object[] constructorArgs = { graph }; - - Class> layoutC = (Class>) jcb.getSelectedItem(); - try { - Constructor> constructor = layoutC - .getConstructor(new Class[] { edu.uci.ics.jung.graph.Graph.class }); - Object o = constructor.newInstance(constructorArgs); - Layout l = (Layout) o; - l.setInitializer(vv.getGraphLayout()); - l.setSize(vv.getSize()); - - LayoutTransition lt = new LayoutTransition(vv, vv.getGraphLayout(), l); - Animator animator = new Animator(lt); - animator.start(); - vv.getRenderContext().getMultiLayerTransformer().setToIdentity(); - vv.repaint(); - - } catch (Exception e) { - Util.logStackTraceToError(e); - } - } - } - - @SuppressWarnings("serial") - private void addButtons(JToolBar toolBar) { - loadButton = makeNavigationButton("open", LOAD, "Load a model (graphml file)", "Load", true); - toolBar.add(loadButton); - - reloadButton = makeNavigationButton("reload", RELOAD, "Reload/Restart already loaded Model", "Reload", false); - toolBar.add(reloadButton); - - firstButton = makeNavigationButton("first", FIRST, "Start at the beginning", "First", false); - toolBar.add(firstButton); - - backButton = makeNavigationButton("back", BACK, "Backs a step", "Back", false); - toolBar.add(backButton); - - runButton = makeNavigationButton("run", RUN, "Starts the execution/Take a step forward in the log", "Run", false); - toolBar.add(runButton); - - pauseButton = makeNavigationButton("pause", PAUSE, "Pauses the execution", "Pause", false); - toolBar.add(pauseButton); - - nextButton = makeNavigationButton("next", NEXT, "Walk a step in the model/Go to the end of log", "Next", false); - toolBar.add(nextButton); - - soapButton = makeNavigationCheckBoxButton("soap", SOAP, "Run MBT in SOAP(Web Services) mode", "Soap"); - soapButton.setSelected(Util.readSoapGuiStartupState()); - toolBar.add(soapButton); - - centerOnVertexButton = makeNavigationCheckBoxButton("centerOnVertex", CENTERONVERTEX, "Center the layout on the current vertex", - "Center on current vertex"); - toolBar.add(centerOnVertexButton); - - @SuppressWarnings("rawtypes") - Class[] combos = getCombos(); - final JComboBox jcb = new JComboBox(combos); - // use a renderer to shorten the layout name presentation - jcb.setRenderer(new DefaultListCellRenderer() { - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - String valueString = value.toString(); - valueString = valueString.substring(valueString.lastIndexOf('.') + 1); - return super.getListCellRendererComponent(list, valueString, index, isSelected, cellHasFocus); - } - }); - jcb.addActionListener(new LayoutChooser(jcb, getVv())); - jcb.setSelectedItem(StaticLayout.class); - - toolBar.add(jcb); - } - - private void createPanelGraph() { - panelGraph = new JPanel(); - panelGraph.setLayout(new BorderLayout()); - setLatestVertexLabel(new JLabel(" ")); - getLatestVertexLabel().setHorizontalAlignment(SwingConstants.CENTER); - getLatestVertexLabel().setOpaque(true); - panelGraph.add(getLatestVertexLabel(), BorderLayout.NORTH); - panelGraph.add(getGraphViewer(), BorderLayout.CENTER); - } - - private void init() { - setTitle(title); - setBackground(Color.gray); - - JPanel topPanel = new JPanel(); - topPanel.setLayout(new BorderLayout()); - getContentPane().add(topPanel); - - // Create the panels - createPanelStatistics(); - createPanelVariables(); - createPanelGraph(); - - // Create a splitter panes - splitPaneGraph = new JSplitPane(JSplitPane.VERTICAL_SPLIT); - topPanel.add(splitPaneGraph, BorderLayout.CENTER); - splitPaneGraph.setTopComponent(panelGraph); - - splitPaneMessages = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); - splitPaneGraph.setBottomComponent(splitPaneMessages); - splitPaneMessages.setLeftComponent(panelStatistics); - splitPaneMessages.setRightComponent(panelVariables); - - JToolBar toolBar = new JToolBar("Toolbar"); - add(toolBar, BorderLayout.PAGE_START); - addButtons(toolBar); - - statusBar = new StatusBar(); - getContentPane().add(statusBar, java.awt.BorderLayout.SOUTH); - - int delay = 1000; // delay for 1 sec. - int period = 500; // repeat every 0.5 sec. - updateColorLatestVertexLabel = new Timer(); - - updateColorLatestVertexLabel.scheduleAtFixedRate(new TimerTask() { - @Override - public void run() { - if (getStatus().isStopped()) { - if (getLatestVertexLabel().getBackground().equals(Color.GRAY)) { - return; - } - getLatestVertexLabel().setBackground(Color.GRAY); - } - - if (getStatus().isPaused() && !(getStatus().isNext() || getStatus().isExecutingJavaTest())) { - getLatestVertexLabel().setBackground(Color.RED); - } else if (getStatus().isRunning() || getStatus().isNext() || getStatus().isExecutingJavaTest() - || getStatus().isExecutingSoapTest()) { - getLatestVertexLabel().setBackground(Color.GREEN); - } - } - }, delay, period); - - if (xmlFile != null) - loadModel(); - else if (graphmlFile != null && logFile != null) { - setWaitCursor(); - try { - mbt.readGraph(graphmlFile.getAbsolutePath()); - } catch (Exception e) { - Util.logStackTraceToError(e); - JOptionPane.showMessageDialog(App.getInstance(), "Failed to load model. " + e.getMessage()); - } - try { - parsedLogFile = ParseLog.readLog(logFile); - currentStep = 0; - } catch (IOException e) { - Util.logStackTraceToError(e); - JOptionPane.showMessageDialog(App.getInstance(), "Failed to load log file. " + e.getMessage()); - } - - Integer index = parsedLogFile.get(currentStep).index; - AbstractElement ae = mbt.setAsVisited(index); - if (ae instanceof Edge) { - mbt.getMachine().setLastEdge((Edge) ae); - mbt.setCurrentVertex((Vertex) null); - } - - status.setState(Status.executingLogTest); - status.unsetState(Status.stopped); - setButtons(); - setDefaultCursor(); - } - } - - // Private constructor prevents instantiation from other classes - private App() { - logger = Util.setupLogger(App.class); - mbt = new ModelBasedTesting(); - init(); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - pack(); - setLocationByPlatform(true); - setVisible(true); - updateLayout(); - } - - /** - * AppHolder is loaded on the first execution of App.getInstance() or the - * first access to AppHolder.INSTANCE, not before. - */ - @SuppressWarnings("synthetic-access") - private static class AppHolder { - private static final App INSTANCE = new App(); - } - - @SuppressWarnings("synthetic-access") - public static App getInstance() { - return AppHolder.INSTANCE; - } - - public static void main() { - App.getInstance(); - } - - public static void main(String args[]) { - if (args != null && args.length == 1) { - App.getInstance().setXmlFile(new File(args[0])); - } else if (args != null && args.length == 2) { - App.getInstance().setGraphmlFile(new File(args[0])); - App.getInstance().setLogFile(new File(args[1])); - } - App.getInstance(); - } - - public void setLatestVertexLabel(JLabel latestVertexLabel) { - this.latestVertexLabel = latestVertexLabel; - } - - public JLabel getLatestVertexLabel() { - return latestVertexLabel; - } - - public File getXmlFile() { - return xmlFile; - } - - public Layout getGraphLayout() { - return graphLayout; - } - - public void setXmlFile(File xmlFile) { - this.xmlFile = xmlFile; - } - - public void setGraphmlFile(File graphmlFile) { - this.graphmlFile = graphmlFile; - } - - public void setLogFile(File logFile) { - this.logFile = logFile; - } -} diff --git a/src/main/java/org/graphwalker/GUI/Status.java b/src/main/java/org/graphwalker/GUI/Status.java deleted file mode 100644 index c604a115..00000000 --- a/src/main/java/org/graphwalker/GUI/Status.java +++ /dev/null @@ -1,166 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.GUI; - -import org.apache.log4j.Logger; -import org.graphwalker.Util; - -public class Status { - static private Logger log = Util.setupLogger(Status.class); - private int state = stopped; - - public static final int initial = 1; - public static final int running = 2; - public static final int previous = 4; - public static final int next = 8; - public static final int paused = 16; - public static final int stopped = 32; - public static final int executingJavaTest = 64; - public static final int executingSoapTest = 128; - public static final int executingLogTest = 256; - - public boolean isExecutingLogTest() { - return (state & executingLogTest) == executingLogTest; - } - - public boolean isExecutingSoapTest() { - return (state & executingSoapTest) == executingSoapTest; - } - - public boolean isExecutingJavaTest() { - return (state & executingJavaTest) == executingJavaTest; - } - - public boolean isInitial() { - return (state & initial) == initial; - } - - public boolean isStopped() { - return (state & stopped) == stopped; - } - - public boolean isPrevious() { - return (state & previous) == previous; - } - - public boolean isNext() { - return (state & next) == next; - } - - public boolean isRunning() { - return (state & running) == running; - } - - public boolean isPaused() { - return (state & paused) == paused; - } - - public void setState(int state) { - log.debug("Set the state with: " + toStr(state)); - this.state |= state; - log.debug("State: " + toStr(this.state)); - } - - public void unsetState(int state) { - log.debug("Unset the state with: " + toStr(state)); - if ((this.state & state) == state) { - this.state ^= state; - } - log.debug("State: " + toStr(this.state)); - } - - protected void setStopped() { - log.debug("Set the state to stopped"); - state = stopped; - } - - protected void reset() { - log.debug("Reset the state to initial"); - state = initial; - } - - public String toStr(int state) { - String str = ""; - if ((state & initial) == initial) { - str += "inital"; - } - if ((state & running) == running) { - if (str.isEmpty()) { - str += "running"; - } else { - str += " | running"; - } - } - if ((state & previous) == previous) { - if (str.isEmpty()) { - str += "previous"; - } else { - str += " | previous"; - } - } - if ((state & next) == next) { - if (str.isEmpty()) { - str += "next"; - } else { - str += " | next"; - } - } - if ((state & paused) == paused) { - if (str.isEmpty()) { - str += "paused"; - } else { - str += " | paused"; - } - } - if ((state & stopped) == stopped) { - if (str.isEmpty()) { - str += "stopped"; - } else { - str += " | stopped"; - } - } - if ((state & executingJavaTest) == executingJavaTest) { - if (str.isEmpty()) { - str += "executingJavaTest"; - } else { - str += " | executingJavaTest"; - } - } - if ((state & executingSoapTest) == executingSoapTest) { - if (str.isEmpty()) { - str += "executingSoapTest"; - } else { - str += " | executingSoapTest"; - } - } - if ((state & executingLogTest) == executingLogTest) { - if (str.isEmpty()) { - str += "executingLogTest"; - } else { - str += " | executingLogTest"; - } - } - return str; - } -} diff --git a/src/main/java/org/graphwalker/GUI/StatusBar.java b/src/main/java/org/graphwalker/GUI/StatusBar.java deleted file mode 100644 index 829660f1..00000000 --- a/src/main/java/org/graphwalker/GUI/StatusBar.java +++ /dev/null @@ -1,42 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.GUI; - -import java.awt.Dimension; - -import javax.swing.JLabel; - -@SuppressWarnings("serial") -public class StatusBar extends JLabel { - - /** Creates a new instance of StatusBar */ - public StatusBar() { - super.setPreferredSize(new Dimension(100, 16)); - setMessage("Ready"); - } - - public void setMessage(String message) { - setText(" " + message); - } -} diff --git a/src/main/java/org/graphwalker/GUI/resources/icons/back.png b/src/main/java/org/graphwalker/GUI/resources/icons/back.png deleted file mode 100644 index f4be8c35..00000000 Binary files a/src/main/java/org/graphwalker/GUI/resources/icons/back.png and /dev/null differ diff --git a/src/main/java/org/graphwalker/GUI/resources/icons/exit.png b/src/main/java/org/graphwalker/GUI/resources/icons/exit.png deleted file mode 100644 index e66d3a73..00000000 Binary files a/src/main/java/org/graphwalker/GUI/resources/icons/exit.png and /dev/null differ diff --git a/src/main/java/org/graphwalker/GUI/resources/icons/first.png b/src/main/java/org/graphwalker/GUI/resources/icons/first.png deleted file mode 100644 index bb949c38..00000000 Binary files a/src/main/java/org/graphwalker/GUI/resources/icons/first.png and /dev/null differ diff --git a/src/main/java/org/graphwalker/GUI/resources/icons/new.png b/src/main/java/org/graphwalker/GUI/resources/icons/new.png deleted file mode 100644 index 44e444fd..00000000 Binary files a/src/main/java/org/graphwalker/GUI/resources/icons/new.png and /dev/null differ diff --git a/src/main/java/org/graphwalker/GUI/resources/icons/next.png b/src/main/java/org/graphwalker/GUI/resources/icons/next.png deleted file mode 100644 index af634050..00000000 Binary files a/src/main/java/org/graphwalker/GUI/resources/icons/next.png and /dev/null differ diff --git a/src/main/java/org/graphwalker/GUI/resources/icons/open.png b/src/main/java/org/graphwalker/GUI/resources/icons/open.png deleted file mode 100644 index 28b43db0..00000000 Binary files a/src/main/java/org/graphwalker/GUI/resources/icons/open.png and /dev/null differ diff --git a/src/main/java/org/graphwalker/GUI/resources/icons/pause.png b/src/main/java/org/graphwalker/GUI/resources/icons/pause.png deleted file mode 100644 index 073ab781..00000000 Binary files a/src/main/java/org/graphwalker/GUI/resources/icons/pause.png and /dev/null differ diff --git a/src/main/java/org/graphwalker/GUI/resources/icons/reload.png b/src/main/java/org/graphwalker/GUI/resources/icons/reload.png deleted file mode 100644 index f935359c..00000000 Binary files a/src/main/java/org/graphwalker/GUI/resources/icons/reload.png and /dev/null differ diff --git a/src/main/java/org/graphwalker/GUI/resources/icons/run.png b/src/main/java/org/graphwalker/GUI/resources/icons/run.png deleted file mode 100644 index c1772427..00000000 Binary files a/src/main/java/org/graphwalker/GUI/resources/icons/run.png and /dev/null differ diff --git a/src/main/java/org/graphwalker/GUI/resources/icons/save.png b/src/main/java/org/graphwalker/GUI/resources/icons/save.png deleted file mode 100644 index 9c9a2259..00000000 Binary files a/src/main/java/org/graphwalker/GUI/resources/icons/save.png and /dev/null differ diff --git a/src/main/java/org/graphwalker/Keywords.java b/src/main/java/org/graphwalker/Keywords.java deleted file mode 100644 index 05642558..00000000 --- a/src/main/java/org/graphwalker/Keywords.java +++ /dev/null @@ -1,493 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker; - -import java.util.Vector; - -import org.graphwalker.exceptions.GeneratorException; -import org.graphwalker.exceptions.StopConditionException; -import org.graphwalker.multipleModels.ModelHandler; - -/** - * Handles the common constants for the org.graphwalker package. This includes - * reserved key words, and text strings used for storing custom data as - * UserDatum in graphs, vertices and edges. - */ -public class Keywords { - - /** - * Each graph has a start (entry) vertex, and that vertex holds this datum.
- * There is only one vertex in a graph, holding this datum.
- * Used by MBT when merging graphs, and when generating test sequences. - */ - public static final String START_NODE = "Start"; - - /** - * Each graph has one and only one vertex to which the START_NODE points to. - * The vertex which has this keyword set, is that node. - */ - public static final String GRAPH_VERTEX = "graph_vertex"; - - /** - * The stop (exit) vertex denotes an exit point in a graph.
- * There can only be one vertex in a graph, holding this datum.
- * Only sub-graphs can have a stop vertex.
- * Used by MBT only when merging graphs. - */ - public static final String STOP_NODE = "Stop"; - - /** - * The id taken from the graphml file. TODO Investigate if this datum is - * deprecated - */ - public static final String ID_KEY = "id"; - - /** - * The graph editor yEd, can use images to depict vertices, which normally - * gets lost during merging. So, when writing merged graphs back to file, this - * datum holds the path and file of that image. - */ - public static final String IMAGE_KEY = "image"; - - /** - * The graph editor yEd, can use images to depict vertices, which normally - * gets lost during merging. So, when writing merged graphs back to file, this - * datum holds the width of that image. - */ - public static final String WIDTH_KEY = "width"; - - /** - * The graph editor yEd, can use images to depict vertices, which normally - * gets lost during merging. So, when writing merged graphs back to file, this - * datum holds the height of that image. - */ - public static final String HEIGHT_KEY = "height"; - - /** - * The x position of the node, as saved by the yEd editor. - */ - public static final String X_POS = "x_pos"; - - /** - * The y position of the node, as saved by the yEd editor. - */ - public static final String Y_POS = "y_pos"; - - /** - * When merging graphs, the source file of each graph is noted, so that in the - * event of an error, the correct graph file can be used in meaningful error - * messages to the end user. - */ - public static final String FILE_KEY = "file"; - - /** - * The name of the vertex or edge, that will result in a method or function - * call in the executing test tool.
- * * The label of an edge can be empty (or null).
- * * A vertex must always have a label.
- * * The label is always defined at the first line in a label.
- */ - public static final String LABEL_KEY = "label"; - - /** - * This datum contain the complete text hold by a label. - */ - public static final String FULL_LABEL_KEY = "full_label"; - - /** - * This datum contains a counter for each vertex and edge. Used by MBT during - * a online test. Every time a vertex or an edge is traversed it is visited, - * thus incremented once. - */ - public static final String VISITED_KEY = "visited"; - - /** - * Used by MBT during random walks during test sequence generation. It holds a - * real value between 0 and 1, and represents the probability that a specific - * edge should be chosen. A value of 0.05, would mean a 5% chance of that edge - * to be selected during a run.
- * * Only edges uses this datum. - */ - public static final String WEIGHT_KEY = "weight"; - - /** - * Used by MBT to store information about manual testing. This data should - * containing text regarding an action or expected result. - */ - public static final String DATA_KEY = "data"; - - /** - * The datum provides the edge or vertex a unique integer number, uniquely - * identifying the object.
- * Generated by MBT when reading and merging graphs. Also used to provide - * better info during logging at:
- * * Parsing graphml files
- * * Merging
- * * Generating offline and online test sequences - */ - public static final String INDEX_KEY = "index"; - - /** - * This datum is used by MBT when merging graphs. It tells MBT that the vertex - * containing this key word, should be merged with the first occurence of a - * vertex with the same label. - */ - public static final String MERGE = "merge"; - - /** - * This datum is used by MBT when merging graphs. It tells MBT that the vertex - * containing this key word, should not merge this vertex with any subgraph. - */ - public static final String NO_MERGE = "no merge"; - - /** - * Used internally by MBT. When graphs are merged, MBT keeps track of which - * vertices have been merged by MBT. - */ - public static final String MERGED_BY_MBT = "merged by mbt"; - - /** - * Used internally by MBT. A vertex in a graph with the label START, and a - * single empty out edge is defined as the main graph (or Mother Graph) - */ - public static final String MOTHER_GRAPH_START_VERTEX = "mother graph start vertex"; - - /** - * Used internally by MBT. A vertex in a graph with the label START, and a - * single non-empty out edge is defined as a subgraph. - */ - public static final String SUBGRAPH_START_VERTEX = "subgraph start vertex"; - - /** - * A vertex or an edge with the key word BLOCKED, will not participate in the - * resulting (merged) graph, end thus be excluded. - */ - public static final String BLOCKED = "BLOCKED"; - - /** - * An edge with the key word BACKTRACK is used to enable a simple logic that - * enables a end user to backtrack in the graph to the previous vertex.
- * This is used only during a online run. - */ - public static final String BACKTRACK = "BACKTRACK"; - - /** - * This datum contains the label parameter used by an edge in EFSM models. - */ - public static final String PARAMETER_KEY = "parameter"; - - /** - * This datum contains the label guard used by an edge in EFSM models. - */ - public static final String GUARD_KEY = "guard"; - - /** - * This datum contains the actions used by an edge in EFSM models. The datum - * is a String containing the actions. - */ - public static final String ACTIONS_KEY = "action"; - - /** - * This datum contains the requirement tag which can be set in a vertex or - * edge. The datum is a String containing one or more requirement tag. - * Multiple tags are to be separated using commas. - */ - public static final String REQTAG_KEY = "reqtag"; - - /** - * Used when running multiple-models, see also {@link ModelHandler}. The - * meaning of this keyword is that if a vertex has this set, the execution of - * the model will be paused, and the execution may switch to another model - * with the same label as the vertex of the {@link Keywords#GRAPH_VERTEX - * GRAPH_VERTEX} in that other model. - */ - public static final String SWITCH_MODEL = "switch_model"; - - /** - * This datum contains the dijkstra object used to find the shortest path in - * models. - */ - public static final String DIJKSTRA = "dijkstra"; - - public static final int CONDITION_REACHED_EDGE = 1001; - - public static final int CONDITION_REACHED_VERTEX = 1002; - - public static final int CONDITION_EDGE_COVERAGE = 1003; - - public static final int CONDITION_VERTEX_COVERAGE = 1004; - - public static final int CONDITION_TEST_LENGTH = 1005; - - public static final int CONDITION_TEST_DURATION = 1006; - - public static final int CONDITION_REQUIREMENT_COVERAGE = 1007; - - public static final int CONDITION_REACHED_REQUIREMENT = 1008; - - public static final int CONDITION_NEVER = 1009; - - public static final int GENERATOR_RANDOM = 2001; - - public static final int GENERATOR_A_STAR = 2002; - - public static final int GENERATOR_LIST = 2003; - - public static final int GENERATOR_STUB = 2004; - - public static final int GENERATOR_REQUIREMENTS = 2005; - - public static final int GENERATOR_SHORTEST_NON_OPTIMIZED = 2006; - - public static final int GENERATOR_MANUAL_HTML = 2007; - - public static final int GENERATOR_ALL_PATH_PERMUTATIONS = 2008; - - /** - * Holds the pre-defined key words - */ - private static Vector reservedKeyWords = new Vector(); - - /** - * Defines the key words - */ - static { - Keywords.reservedKeyWords.add("BLOCKED"); - Keywords.reservedKeyWords.add("BACKTRACK"); - Keywords.reservedKeyWords.add("MERGE"); - Keywords.reservedKeyWords.add("NO_MERGE"); - Keywords.reservedKeyWords.add("SWITCH_MODEL"); - } - - /** - * Returns true if the wordToCheck is a pre-defined key word. - */ - public static boolean isKeyWord(final String wordToCheck) { - return Keywords.reservedKeyWords.contains(wordToCheck.toUpperCase()); - } - - static class StopCondition { - private String name; - private String description; - private Integer id; - - private StopCondition(final String name, final String description, final Integer id) { - this.name = name; - this.description = description; - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(final String description) { - this.description = description; - } - - public Integer getId() { - return id; - } - - public void setId(final Integer id) { - this.id = id; - } - } - - /** - * Holds the pre-defined list of stop-condition. - */ - private static Vector stopConditions = new Vector(); - - /** - * Defines the stop-condition strings - */ - static { - Keywords.stopConditions.add(new StopCondition("REACHED_EDGE", "REACHED_EDGE:", Keywords.CONDITION_REACHED_EDGE)); - Keywords.stopConditions.add(new StopCondition("REACHED_VERTEX", - "REACHED_VERTEX:", Keywords.CONDITION_REACHED_VERTEX)); - Keywords.stopConditions.add(new StopCondition("EDGE_COVERAGE", "EDGE_COVERAGE:", - Keywords.CONDITION_EDGE_COVERAGE)); - Keywords.stopConditions.add(new StopCondition("VERTEX_COVERAGE", "VERTEX_COVERAGE:", - Keywords.CONDITION_VERTEX_COVERAGE)); - Keywords.stopConditions.add(new StopCondition("TEST_LENGTH", "TEST_LENGTH:", - Keywords.CONDITION_TEST_LENGTH)); - Keywords.stopConditions.add(new StopCondition("TEST_DURATION", "TEST_DURATION:

-	 * '<EDGE LABEL>', INDEX=x ('<SOURCE VERTEX LABEL>', INDEX=y -> '<DEST VERTEX LABEL>', INDEX=z)
-	 * 
- * - * Where x, y and n are the unique indexes for the edge, the source - * vertex and the destination vertex.
- * Please note that the label of an edge can be either null, or empty - * (""); - */ - private static String getCompleteEdgeName(final Edge edge) { - return "Edge: '" + edge.getLabelKey() + "', INDEX=" + edge.getIndexKey(); - } - - /** - * Retries information regarding a vertex, and returns it as a String. This - * method is for logging purposes. - * - * @param vertex - * The vertex about which information shall be retrieved. - * @return Returns a String with information regarding the vertex. The format - * is:
- * - *
-	 * '<VERTEX LABEL>', INDEX=n
-	 * 
- * - * Where is the unique index for the vertex. - */ - private static String getCompleteVertexName(final Vertex vertex) { - return "Vertex: '" + vertex.getLabelKey() + "', INDEX=" + vertex.getIndexKey(); - } - - public static void AbortIf(final boolean bool, final String message) { - if (bool) { - throw new RuntimeException(message); - } - } - - public static Logger setupLogger(@SuppressWarnings("rawtypes") final Class classParam) { - Logger logger = Logger.getLogger(classParam); - if (new File("graphwalker.properties").canRead()) { - PropertyConfigurator.configure("graphwalker.properties"); - } else { - PropertyConfigurator.configure(classParam.getResource("/org/graphwalker/resources/graphwalker.properties")); - } - return logger; - } - - /** - * Creates an adds a vertex to a graph. - * - * @param graph - * The graph to which a vertex is to be added. - * @param strLabel - * The label of the vertex. - * @return The newly created vertex. - */ - public static Vertex addVertexToGraph(final Graph graph, final String strLabel) { - Vertex retur = new Vertex(); - retur.setIndexKey(graph.getEdgeCount() + graph.getVertexCount() + 1); - if (strLabel != null) { - retur.setLabelKey(strLabel); - } - graph.addVertex(retur); - return retur; - } - - /** - * Creates and adds an edge to a graph. - * - * @param graph - * The graph to which the edge is to be added. - * @param vertexFrom - * The source point of the edge. - * @param vertexTo - * The destination point of the edge. - * @param strLabel - * The label of the edge. - * @param strParameter - * The parameter(s) to be passed to the method implementing the edge - * in a test. - * @param strGuard - * The guard of the edge. - * @param strAction - * The action to be performed. - * @return The newly created edge. - */ - public static Edge addEdgeToGraph(final Graph graph, final Vertex vertexFrom, final Vertex vertexTo, final String strLabel, - final String strParameter, final String strGuard, final String strAction) { - Edge retur = new Edge(); - retur.setIndexKey(graph.getEdgeCount() + graph.getVertexCount() + 1); - if (strLabel != null) { - retur.setLabelKey(strLabel); - } - if (strParameter != null) { - retur.setParameterKey(strParameter); - } - if (strGuard != null) { - retur.setGuardKey(strGuard); - } - if (strAction != null) { - retur.setActionsKey(strAction); - } - graph.addEdge(retur, vertexFrom, vertexTo); - return retur; - } - - /** - * Adds a stop condition for the model. - * - * @param machine - * @param conditionType - * The condition type. - * @param conditionValue - * The value of the condition. - * @return The newly created stop condition. - * @throws StopConditionException - */ - public static StopCondition getCondition(final FiniteStateMachine machine, final int conditionType, final String conditionValue) - throws StopConditionException { - StopCondition condition = null; - try { - switch (conditionType) { - case Keywords.CONDITION_EDGE_COVERAGE: - condition = new EdgeCoverage(Double.parseDouble(conditionValue) / 100); - break; - case Keywords.CONDITION_REACHED_EDGE: - if (conditionValue == null || conditionValue.isEmpty()) { - throw new StopConditionException("The name of reached edge must not be empty"); - } - if (machine != null && machine.findEdge(Edge.getLabelAndParameter(conditionValue)[0]) == null) { - throw new StopConditionException("The name of reached edge: '" + Edge.getLabelAndParameter(conditionValue)[0] - + "' (in stop condition: '" + conditionValue + "') does not exists in the model."); - } - condition = new ReachedEdge(conditionValue); - break; - case Keywords.CONDITION_REACHED_VERTEX: - if (conditionValue == null || conditionValue.isEmpty()) { - throw new StopConditionException("The name of reached vertex must not be empty"); - } - if (machine != null && machine.getModel().findVertex(Vertex.getLabel(conditionValue)) == null) { - throw new StopConditionException("The name of reached vertex: '" + Vertex.getLabel(conditionValue) + "' (in stop condition: '" - + conditionValue + "') does not exists in the model."); - } - condition = new ReachedVertex(conditionValue); - break; - case Keywords.CONDITION_VERTEX_COVERAGE: - condition = new VertexCoverage(Double.parseDouble(conditionValue) / 100); - break; - case Keywords.CONDITION_TEST_DURATION: - condition = new TimeDuration(Long.parseLong(conditionValue)); - break; - case Keywords.CONDITION_TEST_LENGTH: - condition = new TestCaseLength(Integer.parseInt(conditionValue)); - break; - case Keywords.CONDITION_NEVER: - condition = new NeverCondition(); - break; - case Keywords.CONDITION_REQUIREMENT_COVERAGE: - condition = new RequirementCoverage(Double.parseDouble(conditionValue) / 100); - break; - case Keywords.CONDITION_REACHED_REQUIREMENT: - condition = new ReachedRequirement(conditionValue); - break; - default: - throw new StopConditionException("Unsupported stop condition selected"); - } - } catch (NumberFormatException e) { - if (conditionValue == null || conditionValue.isEmpty()) { - throw new StopConditionException("Stop condition value is missing. "); - } else { - throw new StopConditionException("Invalid stop condition value: " + conditionValue); - } - } - return condition; - } - - protected static PathGenerator getGenerator(final int generatorType) throws GeneratorException { - PathGenerator generator = null; - - switch (generatorType) { - case Keywords.GENERATOR_RANDOM: - generator = new RandomPathGenerator(); - break; - - case Keywords.GENERATOR_ALL_PATH_PERMUTATIONS: - generator = new AllPathPermutationsGenerator(); - break; - - case Keywords.GENERATOR_A_STAR: - generator = new A_StarPathGenerator(); - break; - - case Keywords.GENERATOR_STUB: - generator = new CodeGenerator(); - break; - - case Keywords.GENERATOR_LIST: - generator = new ListGenerator(); - break; - - case Keywords.GENERATOR_REQUIREMENTS: - generator = new RequirementsGenerator(); - break; - - case Keywords.GENERATOR_SHORTEST_NON_OPTIMIZED: - generator = new NonOptimizedShortestPath(); - break; - - default: - throw new GeneratorException("Unsupported generator selected."); - } - - Util.logger.debug("Added generator: " + generator + " " + generatorType); - - return generator; - } - - public Util() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * Load MBT settings from a xml file - * - * @param file - * @return - * @throws StopConditionException - * @throws GeneratorException - * @throws IOException - * @throws JDOMException - * @throws InterruptedException - */ - public static ModelBasedTesting loadMbtAsWSFromXml(final File file) throws StopConditionException, GeneratorException, IOException, - JDOMException, InterruptedException { - return loadXml(file, true, false, false); - } - - /** - * Load MBT settings from a xml file - * - * @param file - * @param dryRun - * Is mbt to be run in a dry run mode? - * @return - * @throws StopConditionException - * @throws GeneratorException - * @throws IOException - * @throws JDOMException - * @throws InterruptedException - */ - protected static ModelBasedTesting loadMbtFromXml(final File file, final boolean dryRun) throws StopConditionException, - GeneratorException, IOException, JDOMException, InterruptedException { - return loadXml(file, false, dryRun, false); - } - - /** - * Load MBT settings from a xml file - * - * @param file - * The XML settings file - * @return - * @throws StopConditionException - * @throws GeneratorException - * @throws IOException - * @throws JDOMException - * @throws InterruptedException - */ - public static ModelBasedTesting loadMbtFromXml(final File file) throws StopConditionException, GeneratorException, IOException, - JDOMException, InterruptedException { - return loadXml(file, false, false, false); - } - - /** - * Creates a new instance of MBT and loads the settings from a xml file - * - * @param file - * The XML settings file - * @return - * @throws StopConditionException - * @throws GeneratorException - * @throws IOException - * @throws JDOMException - * @throws InterruptedException - */ - public static ModelBasedTesting getNewMbtFromXml(final File file) throws StopConditionException, GeneratorException, IOException, - JDOMException, InterruptedException { - return loadXml(file, false, false, true); - } - - /** - * Load MBT settings from a xml file - * - * @param file - * The XML settings file - * @return - * @throws StopConditionException - * @throws GeneratorException - * @throws IOException - * @throws JDOMException - * @throws InterruptedException - */ - public ModelBasedTesting loadMbtFromXmlNonStatic(final File file) throws StopConditionException, GeneratorException, IOException, - JDOMException, InterruptedException { - return loadXmlNonStatic(file, false, false); - } - - /** - * Load MBT settings from a xml file - * - * @param file - * The XML settings file - * @param runningSoapServices - * Is mbt to run in Web Services mode? - * @param dryRun - * Is mbt to be run in a dry run mode? - * @param generateNewModel - * @return - * @throws StopConditionException - * @throws GeneratorException - * @throws IOException - * @throws JDOMException - * @throws InterruptedException - */ - @SuppressWarnings("unchecked") - private static ModelBasedTesting loadXml(final File file, final boolean runningSoapServices, final boolean dryRun, - final boolean generateNewModel) throws StopConditionException, GeneratorException, IOException, JDOMException, InterruptedException { - - final ModelBasedTesting mbt = new ModelBasedTesting(); - mbt.setDryRun(dryRun); - - SAXBuilder parser = new SAXBuilder(); - Document doc; - doc = parser.build(file); - Element root = doc.getRootElement(); - List models = root.getChildren("MODEL"); - - if (models.size() == 0) { - throw new RuntimeException("Model is missing from XML"); - } - - for (Element element : models) { - mbt.readGraph((element).getAttributeValue("PATH")); - } - - List classPath = root.getChildren("CLASS"); - for (Element element : classPath) { - String classPaths[] = element.getAttributeValue("PATH").split(":"); - for (String classPath2 : classPaths) { - try { - ClassPathHack.addFile(getFile(classPath2)); - Util.logger.debug("Added to classpath: " + classPath2); - } catch (Exception e) { - throw new RuntimeException(e.getMessage() + "\nCould not add: '" + classPath2 + "' to CLASSPATH\n" - + "Please review your xml file: '" + file + "' at CLASS PATH", e); - } - } - } - - if (root.getAttributeValue("SCRIPT_ENGINE") != null && root.getAttributeValue("SCRIPT_ENGINE").equalsIgnoreCase("js")) { - Util.logger.debug("Enabling JavaScript engine"); - mbt.enableJsScriptEngine(true); - } else { - Util.logger.debug("Using BeanShell script engine, if EFSM is enabled."); - mbt.enableJsScriptEngine(false); - } - - if (root.getAttributeValue("EXTENDED") != null && root.getAttributeValue("EXTENDED").equalsIgnoreCase("true")) { - Util.logger.debug("Enabling extended FSM"); - mbt.enableExtended(true); - mbt.setStartupScript(getScriptContent(root.getChildren("SCRIPT"))); - } else { - Util.logger.debug("Disabling extended FSM"); - mbt.enableExtended(false); - } - - if (root.getAttributeValue("WEIGHT") != null && root.getAttributeValue("WEIGHT").equalsIgnoreCase("true")) { - Util.logger.debug("Using weighted edges"); - mbt.setWeighted(true); - } else { - Util.logger.debug("Will not use weighted edges"); - mbt.setWeighted(false); - } - - List generators = root.getChildren("GENERATOR"); - - if (generators.size() == 0) { - throw new RuntimeException("Generator is missing from XML"); - } - - PathGenerator generator; - if (generators.size() > 1) { - generator = new CombinedPathGenerator(); - for (Element element : generators) { - ((CombinedPathGenerator) generator).addPathGenerator(getGenerator(mbt.getMachine(), element)); - } - } else { - generator = getGenerator(mbt.getMachine(), generators.get(0)); - } - if (generator == null) { - throw new RuntimeException("Failed to set generator"); - } - mbt.setGenerator(generator); - mbt.populateMachineRequirementHashTable(); - final String reportName = root.getAttributeValue("REPORT"); - String reportTemplate = root.getAttributeValue("REPORT-TEMPLATE"); - - if (reportName != null && reportTemplate != null) { - Util.logger.debug("Will use report template: " + reportTemplate); - mbt.getStatisticsManager().setReportTemplate(new FileInputStream(new File(reportTemplate))); - } - - String logInterval = root.getAttributeValue("LOG-INTERVAL"); - - if (logInterval != null) { - long seconds = Integer.valueOf(logInterval).longValue(); - TimerTask logTask; - if (reportName != null && reportTemplate != null) { - logTask = new TimerTask() { - @Override - public void run() { - try { - mbt.getStatisticsManager().writeFullReport(new PrintStream(reportName)); - } catch (FileNotFoundException e) { - throw new RuntimeException("Could not open or write report file '" + reportName + "'", e); - } - } - }; - } else { - logTask = new TimerTask() { - @Override - public void run() { - Util.logger.info(mbt.getStatisticsCompact()); - } - }; - } - Util.timer = new Timer(); - Util.timer.schedule(logTask, 500, seconds * 1000); - } - - if (!runningSoapServices) { - try { - - String executor = root.getAttributeValue("EXECUTOR"); - Util.logger.debug("Executor is: " + executor); - String executorParam = null; - if (executor.contains(":")) { - executorParam = executor.substring(executor.indexOf(':') + 1); - executor = executor.substring(0, executor.indexOf(':')); - } - - if (executor.equalsIgnoreCase("offline")) { - PrintStream out = System.out; - if (executorParam != null && !executorParam.equals("")) { - try { - out = new PrintStream(executorParam); - } catch (FileNotFoundException e) { - throw new RuntimeException("file '" + executorParam + "' could not be created or is writeprotected.", e); - } - } - if (!mbt.isUseGUI()) { - mbt.writePath(out); - if (out != System.out) { - out.close(); - } - } - } else if (executor.equalsIgnoreCase("manual")) { - PrintStream out = System.out; - if (executorParam != null && !executorParam.equals("")) { - try { - out = new PrintStream(executorParam); - } catch (FileNotFoundException e) { - throw new RuntimeException("file '" + executorParam + "' could not be created or is writeprotected.", e); - } - } - if (!mbt.isUseGUI()) { - Vector testSequence = new Vector(); - mbt.writePath(testSequence); - - new PrintHTMLTestSequence(testSequence, out); - if (out != System.out) { - out.close(); - } - } - } else if (executor.equalsIgnoreCase("java")) { - if (executorParam == null || executorParam.equals("")) { - throw new RuntimeException("No java class specified for execution"); - } - - if (!mbt.isUseGUI()) { - mbt.executePath(executorParam); - } else { - mbt.setJavaExecutorClass(executorParam); - } - } else if (executor.equalsIgnoreCase("online")) { - if (mbt.isDryRun()) { - Util.logger.debug("Executing a dry run"); - mbt.executePath(null, null); - } - if (!mbt.isUseGUI()) { - mbt.interractivePath(); - } - - } else if (executor.equalsIgnoreCase("none") || executor.equals("")) { - // no execution (for debug purpose) - } else { - throw new RuntimeException("Unknown executor '" + executor + "'"); - } - - } finally { - if (Util.timer != null) { - Util.timer.cancel(); - } - if (reportName != null && reportTemplate != null && !mbt.isUseGUI()) { - mbt.getStatisticsManager().writeFullReport(reportName); - } - } - } - return mbt; - } - - @SuppressWarnings("unchecked") - private ModelBasedTesting loadXmlNonStatic(final File file, final boolean runningSoapServices, final boolean dryRun) - throws StopConditionException, GeneratorException, IOException, JDOMException, InterruptedException { - final ModelBasedTesting mbt = new ModelBasedTesting(); - mbt.setDryRun(dryRun); - - SAXBuilder parser = new SAXBuilder(); - Document doc; - doc = parser.build(file); - Element root = doc.getRootElement(); - List models = root.getChildren("MODEL"); - - if (models.size() == 0) { - throw new RuntimeException("Model is missing from XML"); - } - - for (Element element : models) { - mbt.readGraph((element).getAttributeValue("PATH")); - } - - List classPath = root.getChildren("CLASS"); - for (Element element : classPath) { - String classPaths[] = element.getAttributeValue("PATH").split(":"); - for (String classPath2 : classPaths) { - try { - ClassPathHack.addFile(getFile(classPath2)); - Util.logger.debug("Added to classpath: " + classPath2); - } catch (Exception e) { - throw new RuntimeException(e.getMessage() + "\nCould not add: '" + classPath2 + "' to CLASSPATH\n" - + "Please review your xml file: '" + file + "' at CLASS PATH", e); - } - } - } - - if (root.getAttributeValue("SCRIPT_ENGINE") != null && root.getAttributeValue("SCRIPT_ENGINE").equalsIgnoreCase("js")) { - Util.logger.debug("Enabling JavaScript engine"); - mbt.enableJsScriptEngine(true); - } else { - Util.logger.debug("Using BeanShell script engine, if EFSM is enabled."); - mbt.enableJsScriptEngine(false); - } - - if (root.getAttributeValue("EXTENDED") != null && root.getAttributeValue("EXTENDED").equalsIgnoreCase("true")) { - Util.logger.debug("Enabling extended FSM"); - mbt.enableExtended(true); - mbt.setStartupScript(getScriptContent(root.getChildren("SCRIPT"))); - } else { - Util.logger.debug("Disabling extended FSM"); - mbt.enableExtended(false); - } - - if (root.getAttributeValue("WEIGHT") != null && root.getAttributeValue("WEIGHT").equalsIgnoreCase("true")) { - Util.logger.debug("Using weighted edges"); - mbt.setWeighted(true); - } else { - Util.logger.debug("Will not use weighted edges"); - mbt.setWeighted(false); - } - - List generators = root.getChildren("GENERATOR"); - - if (generators.size() == 0) { - throw new RuntimeException("Generator is missing from XML"); - } - - PathGenerator generator; - if (generators.size() > 1) { - generator = new CombinedPathGenerator(); - for (Element element : generators) { - ((CombinedPathGenerator) generator).addPathGenerator(getGenerator(mbt.getMachine(), element)); - } - } else { - generator = getGenerator(mbt.getMachine(), generators.get(0)); - } - if (generator == null) { - throw new RuntimeException("Failed to set generator"); - } - mbt.setGenerator(generator); - - final String reportName = root.getAttributeValue("REPORT"); - String reportTemplate = root.getAttributeValue("REPORT-TEMPLATE"); - - if (reportName != null && reportTemplate != null) { - Util.logger.debug("Will use report template: " + reportTemplate); - mbt.getStatisticsManager().setReportTemplate(new FileInputStream(new File(reportTemplate))); - } - - String logInterval = root.getAttributeValue("LOG-INTERVAL"); - - if (logInterval != null) { - long seconds = Integer.valueOf(logInterval).longValue(); - TimerTask logTask; - if (reportName != null && reportTemplate != null) { - logTask = new TimerTask() { - @Override - public void run() { - try { - mbt.getStatisticsManager().writeFullReport(new PrintStream(reportName)); - } catch (FileNotFoundException e) { - throw new RuntimeException("Could not open or write report file '" + reportName + "'", e); - } - } - }; - } else { - logTask = new TimerTask() { - @Override - public void run() { - Util.logger.info(mbt.getStatisticsCompact()); - } - }; - } - Util.timer = new Timer(); - Util.timer.schedule(logTask, 500, seconds * 1000); - } - - if (!runningSoapServices) { - try { - - String executor = root.getAttributeValue("EXECUTOR"); - Util.logger.debug("Executor is: " + executor); - String executorParam = null; - if (executor.contains(":")) { - executorParam = executor.substring(executor.indexOf(':') + 1); - executor = executor.substring(0, executor.indexOf(':')); - } - - if (executor.equalsIgnoreCase("offline")) { - PrintStream out = System.out; - if (executorParam != null && !executorParam.equals("")) { - try { - out = new PrintStream(executorParam); - } catch (FileNotFoundException e) { - throw new RuntimeException("file '" + executorParam + "' could not be created or is writeprotected.", e); - } - } - if (!mbt.isUseGUI()) { - mbt.writePath(out); - if (out != System.out) { - out.close(); - } - } - } else if (executor.equalsIgnoreCase("manual")) { - PrintStream out = System.out; - if (executorParam != null && !executorParam.equals("")) { - try { - out = new PrintStream(executorParam); - } catch (FileNotFoundException e) { - throw new RuntimeException("file '" + executorParam + "' could not be created or is writeprotected.", e); - } - } - if (!mbt.isUseGUI()) { - Vector testSequence = new Vector(); - mbt.writePath(testSequence); - - new PrintHTMLTestSequence(testSequence, out); - if (out != System.out) { - out.close(); - } - } - } else if (executor.equalsIgnoreCase("java")) { - if (executorParam == null || executorParam.equals("")) { - throw new RuntimeException("No java class specified for execution"); - } - - if (!mbt.isUseGUI()) { - mbt.executePath(executorParam); - } else { - mbt.setJavaExecutorClass(executorParam); - } - } else if (executor.equalsIgnoreCase("online")) { - if (mbt.isDryRun()) { - Util.logger.debug("Executing a dry run"); - mbt.executePath(null, null); - } - if (!mbt.isUseGUI()) { - mbt.interractivePath(); - } - - // } else if (executor.equalsIgnoreCase("none") || - // executor.equals("")) { - // no execution (for debug purpose) - } else { - throw new RuntimeException("Unknown executor '" + executor + "'"); - } - - } finally { - if (Util.timer != null) { - Util.timer.cancel(); - } - if (reportName != null && reportTemplate != null && !mbt.isUseGUI()) { - mbt.getStatisticsManager().writeFullReport(reportName); - } - } - } - return mbt; - } - - private static String getScriptContent(final List scripts) throws IOException { - StringBuilder stringBuilder = new StringBuilder(); - for (Element element : scripts) { - String internal = element.getTextTrim(); - if (internal != null && !internal.equals("")) { - stringBuilder.append(internal); - stringBuilder.append(System.getProperty("line.separator")); - } - String external = element.getAttributeValue("PATH"); - if (external != null && !external.equals("")) { - stringBuilder.append(readFile(Util.getFile(external))); - stringBuilder.append(System.getProperty("line.separator")); - } - } - return stringBuilder.toString(); - } - - @SuppressWarnings("unchecked") - private static PathGenerator getGenerator(final FiniteStateMachine machine, final Element generator) throws StopConditionException, - GeneratorException, IOException { - int generatorType = Keywords.getGenerator(generator.getAttributeValue("TYPE")); - PathGenerator generatorObject = getGenerator(generatorType); - if (generatorObject instanceof CodeGenerator) { - String[] template = { "", "", "" }; - String templateFile = generator.getAttributeValue("VALUE"); - if (templateFile != null) { - template[1] = readFile(Util.getFile(templateFile.trim())); - } else { - Element templateElement = generator.getChild("TEMPLATE"); - if (templateElement != null) { - template[0] = templateElement.getChildTextTrim("HEADER"); - template[1] = templateElement.getChildTextTrim("BODY"); - template[2] = templateElement.getChildTextTrim("FOOTER"); - } else { - throw new RuntimeException("No Template is specified for the stub generator."); - } - } - ((CodeGenerator) generatorObject).setTemplate(template); - } else { - StopCondition stopCondition = getCondition(machine, generator.getChildren()); - if (stopCondition != null) { - generatorObject.setStopCondition(stopCondition); - } - } - return generatorObject; - } - - private static StopCondition getCondition(final FiniteStateMachine machine, final List conditions) throws StopConditionException { - StopCondition condition = null; - if (conditions.size() > 1) { - condition = new CombinationalCondition(); - for (Element element : conditions) { - ((CombinationalCondition) condition).add(getCondition(machine, element)); - } - } else if (conditions.size() == 1) { - condition = getCondition(machine, conditions.get(0)); - } - return condition; - } - - @SuppressWarnings("unchecked") - private static StopCondition getCondition(final FiniteStateMachine machine, final Element condition) throws StopConditionException { - StopCondition stopCondition = null; - if (condition.getName().equalsIgnoreCase("AND")) { - stopCondition = new CombinationalCondition(); - for (Element element : (Iterable) condition.getChildren()) { - ((CombinationalCondition) stopCondition).add(getCondition(machine, element)); - } - } else if (condition.getName().equalsIgnoreCase("OR")) { - stopCondition = new AlternativeCondition(); - for (Element element : (Iterable) condition.getChildren()) { - ((AlternativeCondition) stopCondition).add(getCondition(machine, element)); - } - } else if (condition.getName().equalsIgnoreCase("CONDITION")) { - int type = Keywords.getStopCondition(condition.getAttributeValue("TYPE")); - String value = condition.getAttributeValue("VALUE"); - stopCondition = getCondition(machine, type, value); - } - return stopCondition; - } - - protected static String readFile(final File file) throws IOException { - StringBuilder stringBuilder = new StringBuilder(); - FileReader reader = null; - try { - reader = new FileReader(file); - BufferedReader bufferedReader = new BufferedReader(reader); - while (bufferedReader.ready()) { - stringBuilder.append(bufferedReader.readLine()); - stringBuilder.append(System.getProperty("line.separator")); - } - bufferedReader.close(); - } catch (IOException e) { - throw e; // TODO: remove the IOE from method signature and throw a new - // exception extending runtime - } finally { - closeQuietly(reader); - } - return stringBuilder.toString(); - } - - protected static char getInput() { - char c = 0; - try { - while (c != '0' && c != '1' && c != '2') { - int tmp = System.in.read(); - c = (char) tmp; - } - } catch (IOException e) { - // - } - return c; - } - - /** - * This functions shuffle the array, and returns the shuffled array - * - * @param array - * @return - */ - public static Object[] shuffle(final Object[] array) { - for (int i = 0; i < array.length; i++) { - Object leftObject = array[i]; - int index = Util.random.nextInt(array.length); - Object rightObject = array[index]; - - array[i] = rightObject; - array[index] = leftObject; - } - return array; - } - - protected static InetAddress getInternetAddr(final String nic) { - // Find the real network interface - NetworkInterface iface = null; - InetAddress ia = null; - boolean foundNIC = false; - try { - for (Enumeration ifaces = NetworkInterface.getNetworkInterfaces(); ifaces.hasMoreElements() && foundNIC == false;) { - iface = ifaces.nextElement(); - Util.logger.debug("Interface: " + iface.getDisplayName()); - for (Enumeration ips = iface.getInetAddresses(); ips.hasMoreElements() && foundNIC == false;) { - ia = ips.nextElement(); - Util.logger.debug(ia.getCanonicalHostName() + " " + ia.getHostAddress()); - if (!ia.isLoopbackAddress()) { - Util.logger.debug(" Not a loopback address..."); - if (!ia.getHostAddress().contains(":") && nic.equals(iface.getDisplayName())) { - Util.logger.debug(" Host address does not contain ':'"); - Util.logger.debug(" Interface: " + iface.getName() + " seems to be InternetInterface. I'll take it..."); - foundNIC = true; - } - } - } - } - } catch (SocketException e) { - Util.logger.error(e.getMessage()); - } finally { - if (!foundNIC && nic != null) { - Util.logger.error("Could not bind to network interface: " + nic); - throw new RuntimeException("Could not bind to network interface: " + nic); - } else if (!foundNIC) { - Util.logger.error("Could not bind to any network interface"); - throw new RuntimeException("Could not bind to any network interface: "); - } - } - return ia; - } - - public static String readWSPort() { - PropertiesConfiguration conf = null; - if (new File("graphwalker.properties").canRead()) { - try { - conf = new PropertiesConfiguration("graphwalker.properties"); - } catch (ConfigurationException e) { - Util.logger.error(e.getMessage()); - } - } else { - conf = new PropertiesConfiguration(); - try { - conf.load(Util.class.getResourceAsStream("/org/graphwalker/resources/graphwalker.properties")); - } catch (ConfigurationException e) { - Util.logger.error(e.getMessage()); - } - } - String port = conf.getString("graphwalker.ws.port"); - Util.logger.debug("Read graphwalker.ws.port from graphwalker.properties: " + port); - if (port == null) { - port = "9090"; - Util.logger.debug("Setting port to: 9090"); - } - return port; - } - - public static Boolean readSoapGuiStartupState() { - PropertiesConfiguration conf = null; - if (new File("graphwalker.properties").canRead()) { - try { - conf = new PropertiesConfiguration("graphwalker.properties"); - } catch (ConfigurationException e) { - Util.logger.error(e.getMessage()); - } - } else { - conf = new PropertiesConfiguration(); - try { - conf.load(Util.class.getResourceAsStream("/org/graphwalker/resources/graphwalker.properties")); - } catch (ConfigurationException e) { - Util.logger.error(e.getMessage()); - } - } - Boolean soapGuiState = false; - try { - soapGuiState = conf.getBoolean("org.graphwalker.GUI.startSOAP"); - } catch (NoSuchElementException e) { - Util.logger.debug("org.graphwalker.GUI.startSOAP not found in graphwalker.properties"); - soapGuiState = false; - } - Util.logger.debug("Read org.graphwalker.GUI.startSOAP from graphwalker.properties: " + soapGuiState); - return soapGuiState; - } - - public static void logStackTraceToError(final Exception e) { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - e.printStackTrace(pw); - pw.close(); - Util.logger.error(sw.toString()); - } - - protected static void logStackTraceToError(final Throwable t) { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - t.printStackTrace(pw); - pw.close(); - Util.logger.error(sw.toString()); - } - - public static File getFile(final String resourceName) { - Util.logger.debug("Try to get file: " + resourceName); - File file = new File(resourceName); - if (file.exists()) { - Util.logger.debug("File exists on file system."); - return file; - } - ClassLoader cloader = Thread.currentThread().getContextClassLoader(); - Util.logger.debug("Class loader class name: " + cloader.getClass().getName()); - URL resource = cloader.getResource(resourceName); - - if (resource == null) { - throw new IllegalArgumentException("Could not get resource: " + resourceName); - } - - return new File(resource.getPath()); - } - - public static void closeQuietly(Reader reader) { - if (null != reader) { - try { - reader.close(); - } catch (Exception e) { - // ignore all exceptions - } - } - } - - public static void closeQuietly(InputStream inputStream) { - if (null != inputStream) { - try { - inputStream.close(); - } catch (Exception e) { - // ignore all exceptions - } - } - } -} diff --git a/src/main/java/org/graphwalker/conditions/AlternativeCondition.java b/src/main/java/org/graphwalker/conditions/AlternativeCondition.java deleted file mode 100644 index d62cffac..00000000 --- a/src/main/java/org/graphwalker/conditions/AlternativeCondition.java +++ /dev/null @@ -1,84 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import java.util.Iterator; -import java.util.Vector; - -import org.graphwalker.machines.FiniteStateMachine; - -public class AlternativeCondition extends StopCondition { - - private Vector conditions; - - @Override - public boolean isFulfilled() { - for (StopCondition condition : conditions) { - if (condition.isFulfilled()) - return true; - } - return false; - } - - public AlternativeCondition() { - this.conditions = new Vector(); - } - - public void add(StopCondition condition) { - this.conditions.add(condition); - } - - @Override - public void setMachine(FiniteStateMachine machine) { - super.setMachine(machine); - for (StopCondition condition : conditions) { - condition.setMachine(machine); - } - } - - @Override - public double getFulfilment() { - double retur = 0; - for (StopCondition condition : conditions) { - double newFullfillment = condition.getFulfilment(); - if (newFullfillment > retur) { - retur = newFullfillment; - } - } - return retur; - } - - @Override - public String toString() { - StringBuilder stringBuilder = new StringBuilder("("); - for (Iterator i = conditions.iterator(); i.hasNext();) { - stringBuilder.append(i.next().toString()); - if (i.hasNext()) { - stringBuilder.append(" OR "); - } - } - stringBuilder.append(")"); - return stringBuilder.toString(); - } -} diff --git a/src/main/java/org/graphwalker/conditions/CombinationalCondition.java b/src/main/java/org/graphwalker/conditions/CombinationalCondition.java deleted file mode 100644 index d382dc2f..00000000 --- a/src/main/java/org/graphwalker/conditions/CombinationalCondition.java +++ /dev/null @@ -1,83 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import java.util.Iterator; -import java.util.Vector; - -import org.graphwalker.machines.FiniteStateMachine; - -public class CombinationalCondition extends StopCondition { - - private Vector conditions; - - @Override - public boolean isFulfilled() { - for (StopCondition condition : conditions) { - if (!condition.isFulfilled()) { - return false; - } - } - return true; - } - - public CombinationalCondition() { - this.conditions = new Vector(); - } - - public void add(StopCondition condition) { - this.conditions.add(condition); - } - - @Override - public void setMachine(FiniteStateMachine machine) { - super.setMachine(machine); - for (StopCondition condition : conditions) { - condition.setMachine(machine); - } - } - - @Override - public double getFulfilment() { - double retur = 0; - for (StopCondition condition : conditions) { - retur += condition.getFulfilment(); - } - return retur / conditions.size(); - } - - @Override - public String toString() { - StringBuilder stringBuilder = new StringBuilder("("); - for (Iterator i = conditions.iterator(); i.hasNext();) { - stringBuilder.append(i.next().toString()); - if (i.hasNext()) { - stringBuilder.append(" AND "); - } - } - stringBuilder.append(")"); - return stringBuilder.toString(); - } - -} diff --git a/src/main/java/org/graphwalker/conditions/EdgeCoverage.java b/src/main/java/org/graphwalker/conditions/EdgeCoverage.java deleted file mode 100644 index 31c67f1e..00000000 --- a/src/main/java/org/graphwalker/conditions/EdgeCoverage.java +++ /dev/null @@ -1,65 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import org.apache.log4j.Logger; -import org.graphwalker.Util; -import org.graphwalker.exceptions.StopConditionException; - -public class EdgeCoverage extends StopCondition { - - private double limit; - static Logger logger = Util.setupLogger(EdgeCoverage.class); - - public EdgeCoverage() throws StopConditionException { - this(1); - } - - public EdgeCoverage(double limit) throws StopConditionException { - if (limit > 1 || limit < 0) - throw new StopConditionException("Excpeted an edge coverage between 0 and 100. Actual: " + limit * 100); - this.limit = limit; - } - - @Override - public boolean isFulfilled() { - double edges = machine.getAllEdges().size(); - double covered = machine.getNumOfCoveredEdges(); - logger.debug("Edges/covered (limit): " + edges + "/" + covered + " (" + limit + ")"); - return (covered / edges) >= limit; - } - - @Override - public double getFulfilment() { - double edges = machine.getAllEdges().size(); - double covered = machine.getNumOfCoveredEdges(); - return (covered / edges) / limit; - } - - @Override - public String toString() { - return "EC>=" + (int) (100 * limit); - } - -} diff --git a/src/main/java/org/graphwalker/conditions/NeverCondition.java b/src/main/java/org/graphwalker/conditions/NeverCondition.java deleted file mode 100644 index eff644fc..00000000 --- a/src/main/java/org/graphwalker/conditions/NeverCondition.java +++ /dev/null @@ -1,45 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -public class NeverCondition extends StopCondition { - public NeverCondition() { - } - - @Override - public boolean isFulfilled() { - return false; - } - - @Override - public double getFulfilment() { - return 0; - } - - @Override - public String toString() { - return "FALSE"; - } - -} diff --git a/src/main/java/org/graphwalker/conditions/ReachedEdge.java b/src/main/java/org/graphwalker/conditions/ReachedEdge.java deleted file mode 100644 index b685c28e..00000000 --- a/src/main/java/org/graphwalker/conditions/ReachedEdge.java +++ /dev/null @@ -1,120 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import java.util.ArrayList; - -import org.graphwalker.graph.Edge; -import org.graphwalker.machines.FiniteStateMachine; - -public class ReachedEdge extends StopCondition { - - private ArrayList allEdges; - private Edge endEdge; - private int[] proximity; - private int maxDistance; - private String edgeName; - - @Override - public boolean isFulfilled() { - return getFulfilment() >= 0.99999; - } - - @Override - public void setMachine(FiniteStateMachine machine) { - super.setMachine(machine); - if (this.endEdge == null) { - this.endEdge = machine.findEdge(edgeName); - } - if (this.endEdge == null) { - throw new RuntimeException("Vertex '" + edgeName + "' not found in model"); - } - this.proximity = getFloydWarshall(); - this.maxDistance = max(this.proximity); - } - - public ReachedEdge(String edgeName) { - String[] vertex = edgeName.split("/", 2); - this.edgeName = vertex[0]; - } - - @Override - public double getFulfilment() { - int distance = this.maxDistance; - if (getMachine().getLastEdge() != null) { - distance = proximity[allEdges.indexOf(getMachine().getLastEdge())]; - } - return (1) - ((double) distance / (double) maxDistance); - } - - private int max(int[] t) { - int maximum = t[0]; - for (int i = 1; i < t.length; i++) { - if (t[i] > maximum) { - maximum = t[i]; - } - } - return maximum; - } - - private int[][] getFloydWarshallMatrix() { - allEdges = new ArrayList(getMachine().getAllEdges()); - int n = allEdges.size(); - int[][] retur = new int[n][n]; - for (int i = 0; i < n; i++) { - for (int j = 0; j < n; j++) { - int x = 99999; - if (i == j) { - x = 0; - } else if (getMachine().getModel().isSource(getMachine().getModel().getDest(allEdges.get(j)), allEdges.get(i))) { - x = 1; - } - retur[i][j] = x; - } - } - return retur; - } - - private int[] getFloydWarshall() { - int path[][] = getFloydWarshallMatrix(); - int n = path.length; - for (int k = 0; k < n; k++) { - for (int i = 0; i < n; i++) { - for (int j = 0; j < n; j++) { - path[i][j] = Math.min(path[i][j], path[i][k] + path[k][j]); - } - } - } - int startIndex = allEdges.indexOf(endEdge); - if (startIndex >= 0) { - return path[startIndex]; - } - throw new RuntimeException("edge no longer in Graph!"); - } - - @Override - public String toString() { - return "EDGE='" + endEdge + "'"; - } -} diff --git a/src/main/java/org/graphwalker/conditions/ReachedRequirement.java b/src/main/java/org/graphwalker/conditions/ReachedRequirement.java deleted file mode 100644 index 47b9535b..00000000 --- a/src/main/java/org/graphwalker/conditions/ReachedRequirement.java +++ /dev/null @@ -1,63 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; - -public class ReachedRequirement extends StopCondition { - - private Collection requirements; - - public ReachedRequirement(String requirements) { - String[] list = requirements.split(","); - for (int i = 0; i < list.length; i++) { - list[i] = list[i].trim(); - } - this.requirements = new HashSet(Arrays.asList(list)); - } - - @Override - public boolean isFulfilled() { - return machine.getCoveredRequirements().containsAll(requirements); - } - - @Override - public double getFulfilment() { - Collection covered = machine.getCoveredRequirements(); - covered.retainAll(requirements); - return covered.size() / (double) requirements.size(); - } - - @Override - public String toString() { - return "RC=" + Arrays.deepToString(requirements.toArray()); - } - - public Collection getRequirements() { - return requirements; - } - -} diff --git a/src/main/java/org/graphwalker/conditions/ReachedVertex.java b/src/main/java/org/graphwalker/conditions/ReachedVertex.java deleted file mode 100644 index 1251c016..00000000 --- a/src/main/java/org/graphwalker/conditions/ReachedVertex.java +++ /dev/null @@ -1,143 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import java.util.ArrayList; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.log4j.Logger; -import org.graphwalker.Util; -import org.graphwalker.graph.Vertex; -import org.graphwalker.machines.ExtendedFiniteStateMachine; -import org.graphwalker.machines.FiniteStateMachine; - -public class ReachedVertex extends StopCondition { - - private static Logger logger = Util.setupLogger(ReachedVertex.class); - private ArrayList allVertices; - private Vertex endVertex; - private int[] proximity; - private int maxDistance; - private String vertexName; - private String subState; - - @Override - public boolean isFulfilled() { - return getFulfilment() >= 0.99999; - } - - @Override - public void setMachine(FiniteStateMachine machine) { - super.setMachine(machine); - if (this.endVertex == null) { - this.endVertex = machine.getModel().findVertex(vertexName); - } - if (this.endVertex == null) { - throw new RuntimeException("Vertex '" + vertexName + "' not found in model"); - } - this.proximity = getFloydWarshall(); - this.maxDistance = max(this.proximity); - } - - public ReachedVertex(String vertexName) { - String[] vertex = vertexName.split("/", 2); - this.vertexName = vertex[0]; - this.subState = (vertex.length > 1 ? vertex[1] : ""); - } - - @Override - public double getFulfilment() { - logger.debug("Machine: " + getMachine()); - int distance = proximity[allVertices.indexOf(getMachine().getCurrentVertex())]; - if (getMachine() instanceof ExtendedFiniteStateMachine) { - String currentVertex = getMachine().getCurrentVertexName(); - String currentSubState = ""; - if (vertexName.equals(Vertex.getLabel(currentVertex))) { - if (currentVertex.contains("/")) { - currentSubState = currentVertex.split("/", 2)[1]; - Pattern actionPattern = Pattern.compile(this.subState); - Matcher actionMatcher = actionPattern.matcher(currentSubState); - if (actionMatcher.find()) { - return 1; - } - } - } - return 0; - } - - return (1) - ((double) distance / (double) maxDistance); - } - - private int max(int[] t) { - int maximum = t[0]; - for (int i = 1; i < t.length; i++) { - if (t[i] > maximum) { - maximum = t[i]; - } - } - return maximum; - } - - private int[][] getFloydWarshallMatrix() { - allVertices = new ArrayList(getMachine().getAllVertices()); - int n = allVertices.size(); - int[][] retur = new int[n][n]; - for (int i = 0; i < n; i++) { - for (int j = 0; j < n; j++) { - int x = 99999; - if (i == j) { - x = 0; - } else if (getMachine().getModel().isPredecessor(allVertices.get(i), allVertices.get(j))) { - x = 1; - } - retur[i][j] = x; - } - } - return retur; - } - - private int[] getFloydWarshall() { - int path[][] = getFloydWarshallMatrix(); - int n = path.length; - for (int k = 0; k < n; k++) { - for (int i = 0; i < n; i++) { - for (int j = 0; j < n; j++) { - path[i][j] = Math.min(path[i][j], path[i][k] + path[k][j]); - } - } - } - int startIndex = allVertices.indexOf(endVertex); - if (startIndex >= 0) { - return path[startIndex]; - } - throw new RuntimeException("vertex no longer in Graph!"); - } - - @Override - public String toString() { - return "VERTEX='" + endVertex + "'"; - } - -} diff --git a/src/main/java/org/graphwalker/conditions/RequirementCoverage.java b/src/main/java/org/graphwalker/conditions/RequirementCoverage.java deleted file mode 100644 index 80e64e0d..00000000 --- a/src/main/java/org/graphwalker/conditions/RequirementCoverage.java +++ /dev/null @@ -1,62 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import org.graphwalker.Util; - -public class RequirementCoverage extends StopCondition { - - private double limit; - - public RequirementCoverage() { - this(1); - } - - public RequirementCoverage(double limit) { - Util.AbortIf((limit > 1 || limit < 0), "Requirement coverage must be between 0 and 100"); - this.limit = limit; - } - - @Override - public boolean isFulfilled() { - int stats[] = machine.getStatistics(); - double requirements = stats[5]; - double covered = stats[6]; - return (covered / requirements) >= limit; - } - - @Override - public double getFulfilment() { - int stats[] = machine.getStatistics(); - double requirements = stats[5]; - double covered = stats[6]; - return (covered / requirements) / limit; - } - - @Override - public String toString() { - return "RC>=" + (int) (100 * limit); - } - -} diff --git a/src/main/java/org/graphwalker/conditions/StopCondition.java b/src/main/java/org/graphwalker/conditions/StopCondition.java deleted file mode 100644 index affa2982..00000000 --- a/src/main/java/org/graphwalker/conditions/StopCondition.java +++ /dev/null @@ -1,48 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import org.graphwalker.machines.FiniteStateMachine; - -public abstract class StopCondition { - protected FiniteStateMachine machine; - - public FiniteStateMachine getMachine() { - return machine; - } - - public void setMachine(FiniteStateMachine machine) { - this.machine = machine; - } - - /** - * @return true if the condition is fulfilled - */ - public abstract boolean isFulfilled(); - - /** - * @return the condition fulfilment - */ - public abstract double getFulfilment(); -} diff --git a/src/main/java/org/graphwalker/conditions/TestCaseLength.java b/src/main/java/org/graphwalker/conditions/TestCaseLength.java deleted file mode 100644 index ee3b86ee..00000000 --- a/src/main/java/org/graphwalker/conditions/TestCaseLength.java +++ /dev/null @@ -1,49 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -public class TestCaseLength extends StopCondition { - - private int numberOfEdges; - - @Override - public boolean isFulfilled() { - return machine.getNumberOfEdgesTravesed() >= numberOfEdges; - } - - public TestCaseLength(int numberOfEdges) { - this.numberOfEdges = numberOfEdges; - } - - @Override - public double getFulfilment() { - return machine.getNumberOfEdgesTravesed() / (double) numberOfEdges; - } - - @Override - public String toString() { - return "L=" + numberOfEdges; - } - -} diff --git a/src/main/java/org/graphwalker/conditions/TimeDuration.java b/src/main/java/org/graphwalker/conditions/TimeDuration.java deleted file mode 100644 index 3d92875b..00000000 --- a/src/main/java/org/graphwalker/conditions/TimeDuration.java +++ /dev/null @@ -1,61 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -/** - * Stops test execution after a certain amount of time has passed. - * - * @author Johan Tejle - * - */ -public class TimeDuration extends StopCondition { - - private double duration; - private double start_time; - - @Override - public boolean isFulfilled() { - return getFulfilment() >= 0.99999; - } - - public TimeDuration(long seconds) { - this.start_time = System.currentTimeMillis(); - this.duration = seconds * 1000; - } - - @Override - public double getFulfilment() { - return (System.currentTimeMillis() - this.start_time) / this.duration; - } - - @Override - public String toString() { - return "DURATION=" + (duration / 1000) + "s"; - } - - public void restartTime() { - start_time = System.currentTimeMillis(); - } - -} diff --git a/src/main/java/org/graphwalker/conditions/VertexCoverage.java b/src/main/java/org/graphwalker/conditions/VertexCoverage.java deleted file mode 100644 index a69ecae8..00000000 --- a/src/main/java/org/graphwalker/conditions/VertexCoverage.java +++ /dev/null @@ -1,62 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import org.graphwalker.exceptions.StopConditionException; - -public class VertexCoverage extends StopCondition { - - private double limit; - - public VertexCoverage() throws StopConditionException { - this(1); - } - - public VertexCoverage(double limit) throws StopConditionException { - if (limit > 1 || limit < 0) { - throw new StopConditionException("Excpeted a vertex coverage between 0 and 100. Actual: " + limit * 100); - } - this.limit = limit; - } - - @Override - public boolean isFulfilled() { - double vertices = machine.getAllVertices().size(); - double covered = machine.getNumOfCoveredVertices(); - return (covered / vertices) >= limit; - } - - @Override - public double getFulfilment() { - double vertices = machine.getAllVertices().size(); - double covered = machine.getNumOfCoveredVertices(); - return (covered / vertices) / limit; - } - - @Override - public String toString() { - return "SC>=" + (int) (100 * limit); - } - -} diff --git a/src/main/java/org/graphwalker/events/AppEvent.java b/src/main/java/org/graphwalker/events/AppEvent.java deleted file mode 100644 index 544f5e54..00000000 --- a/src/main/java/org/graphwalker/events/AppEvent.java +++ /dev/null @@ -1,29 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.events; - -public interface AppEvent { - - public void getLoadEvent(); -} diff --git a/src/main/java/org/graphwalker/events/MbtEvent.java b/src/main/java/org/graphwalker/events/MbtEvent.java deleted file mode 100644 index 4ca50907..00000000 --- a/src/main/java/org/graphwalker/events/MbtEvent.java +++ /dev/null @@ -1,30 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.events; - -public interface MbtEvent { - - public void getNextEvent(); - -} diff --git a/src/main/java/org/graphwalker/exceptions/FoundNoEdgeException.java b/src/main/java/org/graphwalker/exceptions/FoundNoEdgeException.java deleted file mode 100644 index 3a319593..00000000 --- a/src/main/java/org/graphwalker/exceptions/FoundNoEdgeException.java +++ /dev/null @@ -1,41 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.exceptions; - -/** - * This exception is thrown during test sequence generation, when no out edge is - * found from a given vertex. This could be due to a cul-de-sac, which may or - * may not be perfectly all right. - * - */ -public class FoundNoEdgeException extends Exception { - /** - * @param string - */ - public FoundNoEdgeException(String string) { - super(string); - } - - private static final long serialVersionUID = -2597269122921601356L; -} diff --git a/src/main/java/org/graphwalker/exceptions/GeneratorException.java b/src/main/java/org/graphwalker/exceptions/GeneratorException.java deleted file mode 100644 index 81e70026..00000000 --- a/src/main/java/org/graphwalker/exceptions/GeneratorException.java +++ /dev/null @@ -1,32 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.exceptions; - -public class GeneratorException extends Exception { - private static final long serialVersionUID = -6355062559015580205L; - - public GeneratorException(String message) { - super(message); - } -} diff --git a/src/main/java/org/graphwalker/exceptions/GuiStoppedExecution.java b/src/main/java/org/graphwalker/exceptions/GuiStoppedExecution.java deleted file mode 100644 index fdd976b8..00000000 --- a/src/main/java/org/graphwalker/exceptions/GuiStoppedExecution.java +++ /dev/null @@ -1,33 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.exceptions; - -/** - * This exception indicats to MBT that GUI wants to stop execution of MBT - * - */ -public class GuiStoppedExecution extends RuntimeException { - - private static final long serialVersionUID = -2445201301297201999L; -} diff --git a/src/main/java/org/graphwalker/exceptions/InvalidDataException.java b/src/main/java/org/graphwalker/exceptions/InvalidDataException.java deleted file mode 100644 index d641fce7..00000000 --- a/src/main/java/org/graphwalker/exceptions/InvalidDataException.java +++ /dev/null @@ -1,42 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.exceptions; - -/** - * This exception should be used whenever data extraction from the data space - * from a EFSM machine fails. - * - */ -public class InvalidDataException extends Exception { - - /** - * @param message - * A string containing a message describing the failure in detail. - */ - public InvalidDataException(String message) { - super(message); - } - - private static final long serialVersionUID = -2445201301297201999L; -} diff --git a/src/main/java/org/graphwalker/exceptions/StopConditionException.java b/src/main/java/org/graphwalker/exceptions/StopConditionException.java deleted file mode 100644 index 0e816324..00000000 --- a/src/main/java/org/graphwalker/exceptions/StopConditionException.java +++ /dev/null @@ -1,41 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.exceptions; - -/** - * This exception should be used whenever there is something wrong with the stop - * condition. - */ -public class StopConditionException extends Exception { - - /** - * @param message - * A string containing a message describing the failure in detail. - */ - public StopConditionException(String message) { - super(message); - } - - private static final long serialVersionUID = -5843521571692420560L; -} diff --git a/src/main/java/org/graphwalker/filters/AccessableEdgeFilter.java b/src/main/java/org/graphwalker/filters/AccessableEdgeFilter.java deleted file mode 100644 index 1a53fdca..00000000 --- a/src/main/java/org/graphwalker/filters/AccessableEdgeFilter.java +++ /dev/null @@ -1,78 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.filters; - -import javax.script.ScriptEngine; -import javax.script.ScriptException; - -import org.graphwalker.graph.Edge; - -import bsh.EvalError; -import bsh.Interpreter; - -/** - * @author Johan Tejle - * - */ -public class AccessableEdgeFilter { - - private ScriptEngine jsEngine = null; - private Interpreter beanShellEngine = null; - - public AccessableEdgeFilter(ScriptEngine sciptEngine) { - this.jsEngine = sciptEngine; - } - - public AccessableEdgeFilter(Interpreter beanShellEngine) { - this.beanShellEngine = beanShellEngine; - } - - public boolean acceptEdge(org.graphwalker.graph.Graph graph, Edge edge) { - if (edge.getGuardKey().isEmpty()) { - return true; - } - - if (jsEngine != null) { - try { - return (Boolean) jsEngine.eval(edge.getGuardKey()); - } catch (ScriptException e) { - throw new RuntimeException("Malformed Edge guard\n\t" + edge + "\n\tGuard: " + edge.getGuardKey() - + "\n\tBeanShell error message: '" + e.getMessage() + "'"); - } - } else if (beanShellEngine != null) { - try { - return (Boolean) beanShellEngine.eval(edge.getGuardKey()); - } catch (EvalError e) { - throw new RuntimeException("Malformed Edge guard\n\t" + edge + "\n\tGuard: " + edge.getGuardKey() - + "\n\tBeanShell error message: '" + e.getMessage() + "'"); - } - } - return false; - } - - public String getName() { - return "AccessableEdgeFilter"; - } - -} diff --git a/src/main/java/org/graphwalker/generators/A_StarPathGenerator.java b/src/main/java/org/graphwalker/generators/A_StarPathGenerator.java deleted file mode 100755 index 433a56c8..00000000 --- a/src/main/java/org/graphwalker/generators/A_StarPathGenerator.java +++ /dev/null @@ -1,227 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.generators; - -import java.util.Comparator; -import java.util.PriorityQueue; -import java.util.Set; -import java.util.Stack; -import java.util.Vector; - -import org.graphwalker.Util; -import org.graphwalker.conditions.StopCondition; -import org.graphwalker.exceptions.FoundNoEdgeException; -import org.graphwalker.generators.PathGenerator; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Vertex; -import org.graphwalker.machines.FiniteStateMachine; - -public class A_StarPathGenerator extends PathGenerator { - - public A_StarPathGenerator(StopCondition stopCondition) { - super(stopCondition); - } - - private Stack preCalculatedPath = null; - private Vertex lastVertex; - - @Override - public void setMachine(FiniteStateMachine machine) { - super.setMachine(machine); - } - - public A_StarPathGenerator() { - super(); - } - - @Override - public String[] getNext() throws InterruptedException { - Util.AbortIf(!hasNext(), "Finished"); - if (lastVertex == null || lastVertex != getMachine().getCurrentVertex() || preCalculatedPath == null || preCalculatedPath.size() == 0) { - boolean oldCalculatingPathValue = getMachine().isCalculatingPath(); - getMachine().setCalculatingPath(true); - - preCalculatedPath = a_star(); - - getMachine().setCalculatingPath(oldCalculatingPathValue); - - if (preCalculatedPath == null) { - throw new RuntimeException("No path found to " + this.getStopCondition()); - } - - // reverse path - Stack temp = new Stack(); - while (preCalculatedPath.size() > 0) { - temp.push(preCalculatedPath.pop()); - } - preCalculatedPath = temp; - } - - Edge edge = preCalculatedPath.pop(); - getMachine().walkEdge(edge); - lastVertex = getMachine().getCurrentVertex(); - String[] retur = { getMachine().getEdgeName(edge), getMachine().getCurrentVertexName() }; - return retur; - } - - @SuppressWarnings("unchecked") - private Stack a_star() throws InterruptedException { - Vector closed = new Vector(); - - PriorityQueue a_starPath = new PriorityQueue(10, new Comparator() { - @Override - public int compare(WeightedPath arg0, WeightedPath arg1) { - int retur = Double.compare(arg0.getWeight(), arg1.getWeight()); - if (retur == 0) - retur = arg0.getPath().size() - arg1.getPath().size(); - return retur; - } - }); - - Set availableOutEdges; - try { - availableOutEdges = getMachine().getCurrentOutEdges(); - } catch (FoundNoEdgeException e) { - throw new RuntimeException("No available edges found at " + getMachine().getCurrentVertexName(), e); - } - for (Edge edge : availableOutEdges) { - Stack path = new Stack(); - path.push(edge); - a_starPath.add(getWeightedPath(path)); - } - double maxWeight = 0; - while (a_starPath.size() > 0) { - if (Thread.interrupted()) { - throw new InterruptedException(); - } - - WeightedPath path = a_starPath.poll(); - if (path.getWeight() > maxWeight) - maxWeight = path.getWeight(); - if (path.getWeight() > 0.99999) // are we done yet? - return path.getPath(); - - Edge possibleDuplicate = path.getPath().peek(); - - // have we been here before? - if (closed.contains(possibleDuplicate.hashCode() + "." + path.getSubState().hashCode() + "." + path.getWeight())) - continue; // ignore this and move on - - // We don't want to use this edge again as this path is - // the fastest, and if we come here again we have used more - // steps to get here than we used this time. - closed.add(possibleDuplicate.hashCode() + "." + path.getSubState().hashCode() + "." + path.getWeight()); - - availableOutEdges = getPathOutEdges(path.getPath()); - if (availableOutEdges != null && availableOutEdges.size() > 0) { - for (Edge edge : availableOutEdges) { - Stack newStack = (Stack) path.getPath().clone(); - newStack.push(edge); - a_starPath.add(getWeightedPath(newStack)); - } - } - } - throw new RuntimeException("No path found to satisfy stop condition " + getStopCondition() + ", best path satified only " - + (int) (maxWeight * 100) + "% of condition."); - } - - private WeightedPath getWeightedPath(Stack path) { - double weight = 0; - String subState = ""; - - getMachine().storeVertex(); - getMachine().walkPath(path); - weight = getConditionFulfilment(); - String currentState = getMachine().getCurrentVertexName(); - if (currentState.contains("/")) { - subState = currentState.split("/", 2)[1]; - } - getMachine().restoreVertex(); - - return new WeightedPath(path, weight, subState); - } - - private Set getPathOutEdges(Stack path) { - Set retur = null; - getMachine().storeVertex(); - getMachine().walkPath(path); - try { - retur = getMachine().getCurrentOutEdges(); - } catch (FoundNoEdgeException e) { - // no edges found? degrade gracefully and return the default value of - // null. - } - getMachine().restoreVertex(); - return retur; - } - - /** - * Will reset the generator to its initial vertex. - */ - @Override - public void reset() { - preCalculatedPath = null; - } - - @Override - public String toString() { - return "A_STAR{" + super.toString() + "}"; - } - - private static class WeightedPath { - private double weight; - private Stack path; - private String subState; - - public String getSubState() { - return subState; - } - - public void setSubState(String subState) { - this.subState = subState; - } - - public Stack getPath() { - return path; - } - - public void setPath(Stack path) { - this.path = path; - } - - public double getWeight() { - return weight; - } - - public void setWeight(double weight) { - this.weight = weight; - } - - public WeightedPath(Stack path, double weight, String subState) { - setPath(path); - setWeight(weight); - setSubState(subState); - } - } -} \ No newline at end of file diff --git a/src/main/java/org/graphwalker/generators/AllPathPermutationsGenerator.java b/src/main/java/org/graphwalker/generators/AllPathPermutationsGenerator.java deleted file mode 100644 index 2884d122..00000000 --- a/src/main/java/org/graphwalker/generators/AllPathPermutationsGenerator.java +++ /dev/null @@ -1,202 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.generators; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Random; -import java.util.Set; - -import org.apache.log4j.Logger; -import org.graphwalker.Util; -import org.graphwalker.conditions.StopCondition; -import org.graphwalker.exceptions.FoundNoEdgeException; -import org.graphwalker.graph.Edge; - -/** - * The generator generates paths through the model in a way that makes sure all - * path permutations of ever increasing depth is tested. - * - * The first pass through the model finishes when a cycle in the model is found. - * The second pass traverses the model until all edges have been visited twice - * or more. The third pass traverses the model until all available combinations - * of 2 edges have been visited twice or more . . . The n:th pass traverses the - * model until all available combinations of n edges have been visited twice or - * more - * - * The algorithm always tries the "path less traveled" where a path is a list of - * n edges. If several paths are available with the same number of traversals on - * is chosen by random. - */ -public class AllPathPermutationsGenerator extends PathGenerator { - - private static Logger logger = Util.setupLogger(AllPathPermutationsGenerator.class); - - private final Random random = new Random(); - - /* Contains all walked paths for a specific depth */ - private final HashMap pathWalked = new HashMap(); - - /* List of edges comprising the current path */ - private final List savedEdges = new ArrayList(); - - private int currentDepth; - - public AllPathPermutationsGenerator(final StopCondition stopCondition) { - super(stopCondition); - currentDepth = 0; - } - - public AllPathPermutationsGenerator() { - super(); - currentDepth = 0; - } - - @Override - public String[] getNext() throws InterruptedException { - Set availableEdges; - - try { - availableEdges = getMachine().getCurrentOutEdges(); - } catch (FoundNoEdgeException e) { - throw new RuntimeException("No possible edges available for path", e); - } - - Set selectedEdges = new HashSet(); - int fewestVisits = -1; - - // Loop through available edges and pick the one which results in a path - // least traversed. - for (Edge edge : availableEdges) { - - // Add available edge to the current path - savedEdges.add(edge); - - // Has it been traversed before and if so how many times - Integer hashValue = pathWalked.get(savedEdges.hashCode()); - - // Never walked path - if (hashValue == null) { - fewestVisits = 0; - selectedEdges.add(edge); - - // Has been traversed but fewer times - } else if (hashValue < fewestVisits || fewestVisits == -1) { - fewestVisits = hashValue; - selectedEdges.clear(); - selectedEdges.add(edge); - - // Has been traversed but equal times - } else if (hashValue == fewestVisits) { - selectedEdges.add(edge); - } - - // Remove the edge from the current path - savedEdges.remove(edge); - } - Edge selectedEdge = getRandomEdge(selectedEdges); - - // Add the selected edge to the current path - savedEdges.add(selectedEdge); - - // Update number of traversals of this path - pathWalked.put(savedEdges.hashCode(), fewestVisits + 1); - - // Check if all paths have been traversed twice or more - // If so, increase the length of the path by 1 and clear the hash - if (checkCompletion()) { - currentDepth++; - AllPathPermutationsGenerator.logger.debug("All combinations done, changing look back depth to: " + currentDepth); - pathWalked.clear(); - } else if (currentDepth == 0 && checkCompletionFirst()) { - currentDepth++; - AllPathPermutationsGenerator.logger.debug("Cycle detected, starting algorithm with depth: " + currentDepth); - pathWalked.clear(); - savedEdges.remove(0); - - // If not, remove the first edge in the path - } else { - savedEdges.remove(0); - } - - getMachine().walkEdge(selectedEdge); - AllPathPermutationsGenerator.logger.debug(selectedEdge.getFullLabelKey()); - AllPathPermutationsGenerator.logger.debug(selectedEdge); - AllPathPermutationsGenerator.logger.trace("Current Path: " + printPath()); - AllPathPermutationsGenerator.logger.debug("Hash size: " + pathWalked.size()); - AllPathPermutationsGenerator.logger.trace("Hash: " + printHash()); - return new String[] { getMachine().getEdgeName(selectedEdge), getMachine().getCurrentVertexName() }; - } - - private boolean checkCompletionFirst() { - for (Integer value : pathWalked.values()) { - if (value == 2) { - return true; - } - } - return false; - } - - private boolean checkCompletion() { - for (Integer value : pathWalked.values()) { - if (value == 1) { - return false; - } - } - return true; - } - - private String printPath() { - StringBuilder stringBuilder = new StringBuilder(); - for (Edge edge : savedEdges) { - stringBuilder.append(edge.getFullLabelKey()); - } - return stringBuilder.toString(); - } - - private String printHash() { - StringBuilder stringBuilder = new StringBuilder(); - for (Integer value : pathWalked.values()) { - stringBuilder.append(value); - stringBuilder.append(" "); - } - return stringBuilder.toString(); - - } - - private Edge getRandomEdge(final Set availableEdges) { - return (Edge) availableEdges.toArray()[random.nextInt(availableEdges.size())]; - } - - @Override - public String toString() { - return "COMBINATIONS{" + super.toString() + "}"; - } - - public int getDepth() { - return currentDepth; - } -} diff --git a/src/main/java/org/graphwalker/generators/CodeGenerator.java b/src/main/java/org/graphwalker/generators/CodeGenerator.java deleted file mode 100644 index dbc96b19..00000000 --- a/src/main/java/org/graphwalker/generators/CodeGenerator.java +++ /dev/null @@ -1,92 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.generators; - -import org.graphwalker.conditions.StopCondition; - -/** - * Will generate code using a template. The code generated will contain all - * lables/names defined by the vertices and edges. This enables the user to - * write templates for a multitude of scripting or programming languages.
- *
- * There is 2 variables in the template that will be replaced as follows:
- * {LABEL} Will be replace by the actual name of the edge or - * vertex.
- * {EDGE_VERTEX} Will be replace by the word 'Edge' or - * 'Vertex'.
- *
- * Below is an example of a template. - * - *
- * /**
- * * This method implements the {EDGE_VERTEX} '{LABEL}'
- * * /
- * public void {LABEL}()
- * {
- *    log.info( "{EDGE_VERTEX}: {LABEL}" );
- *    throw new RuntimeException( "Not implemented" );
- * }
- * 
- */ -public class CodeGenerator extends ListGenerator { - - public CodeGenerator(StopCondition stopCondition) { - super(stopCondition); - } - - public CodeGenerator() { - super(); - } - - private String[] template; // {HEADER, BODY, FOOTER} - private boolean first = true; - - public void setTemplate(String[] template) { - this.template = template.clone(); - } - - @Override - public String[] getNext() { - String[] retur = super.getNext(); - if (retur[0].isEmpty()) { - retur[1] = ""; - return retur; - } - retur[0] = (first && template[0].length() > 0 ? template[0] + "\n" : "") - + // HEADER - template[1] - // BODY - .replaceAll("\\{LABEL\\}", retur[0]).replaceAll("\\{EDGE_VERTEX\\}", retur[1]) - .replaceAll("\\{DESCRIPTION\\}", retur[2].replaceAll("\n", "\n * ")) - + (!hasNext() && template[2].length() > 0 ? "\n" + template[2] : ""); // FOOTER - retur[1] = ""; - first = false; - return retur; - } - - @Override - public String toString() { - return "CODE"; - } -} diff --git a/src/main/java/org/graphwalker/generators/CombinedPathGenerator.java b/src/main/java/org/graphwalker/generators/CombinedPathGenerator.java deleted file mode 100644 index 29b36d14..00000000 --- a/src/main/java/org/graphwalker/generators/CombinedPathGenerator.java +++ /dev/null @@ -1,115 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.generators; - -import java.util.Vector; - -import org.apache.log4j.Logger; -import org.graphwalker.conditions.StopCondition; -import org.graphwalker.machines.FiniteStateMachine; - -public class CombinedPathGenerator extends PathGenerator { - - private static Logger logger = Logger.getLogger(CombinedPathGenerator.class); - - private Vector generatorList = new Vector(); - private int currentGenerator = 0; - - public CombinedPathGenerator() { - super(); - } - - public CombinedPathGenerator(StopCondition stopCondition) { - super(stopCondition); - } - - public void addPathGenerator(PathGenerator generator) { - logger.debug("Adding PathGenerator: " + generator); - generatorList.add(generator); - } - - @Override - public void setMachine(FiniteStateMachine machine) { - for (PathGenerator aGeneratorList : generatorList) { - aGeneratorList.setMachine(machine); - } - } - - @Override - public void setStopCondition(StopCondition stopCondition) { - for (PathGenerator aGeneratorList : generatorList) { - aGeneratorList.setStopCondition(stopCondition); - } - } - - private PathGenerator getActivePathGenerator() { - return generatorList.get(currentGenerator); - } - - private boolean hasPath() { - return generatorList.size() > currentGenerator; - } - - private void scrapActivePathGenerator() { - logger.debug("Removing PathGenerator: " + getActivePathGenerator()); - currentGenerator++; - } - - @Override - public boolean hasNext() { - boolean nextIsAvailable = false; - while (hasPath() && !nextIsAvailable) { - nextIsAvailable = getActivePathGenerator().hasNext(); - if (!nextIsAvailable) - scrapActivePathGenerator(); - } - return nextIsAvailable; - } - - @Override - public String[] getNext() throws InterruptedException { - String[] retur = { "", "" }; - - boolean nextIsAvailable = false; - while (hasPath() && !nextIsAvailable) { - nextIsAvailable = getActivePathGenerator().hasNext(); - if (!nextIsAvailable) - scrapActivePathGenerator(); - } - if (!nextIsAvailable) - return retur; - return getActivePathGenerator().getNext(); - } - - @Override - public String toString() { - StringBuilder stringBuilder = new StringBuilder(); - for (PathGenerator aGeneratorList : generatorList) { - stringBuilder.append(aGeneratorList.toString()); - stringBuilder.append(System.getProperty("line.separator")); - } - return stringBuilder.toString().trim(); - } - -} diff --git a/src/main/java/org/graphwalker/generators/ListGenerator.java b/src/main/java/org/graphwalker/generators/ListGenerator.java deleted file mode 100644 index 7bf409bc..00000000 --- a/src/main/java/org/graphwalker/generators/ListGenerator.java +++ /dev/null @@ -1,88 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.generators; - -import java.util.Comparator; -import java.util.Stack; -import java.util.TreeSet; -import java.util.Vector; - -import org.graphwalker.Keywords; -import org.graphwalker.conditions.StopCondition; -import org.graphwalker.graph.AbstractElement; -import org.graphwalker.graph.Edge; - -public class ListGenerator extends PathGenerator { - - private Stack list = null; - - public ListGenerator(StopCondition stopCondition) { - super(stopCondition); - } - - public ListGenerator() { - super(); - } - - @Override - public boolean hasNext() { - if (list == null) - generateList(); - return !list.isEmpty(); - } - - @Override - public String[] getNext() { - if (list == null) - generateList(); - return list.pop(); - } - - private void generateList() { - list = new Stack(); - TreeSet tempList = new TreeSet(new Comparator() { - @Override - public int compare(String[] arg0, String[] arg1) { - return (arg1)[0].compareTo((arg0)[0]); - } - }); - - Vector abstractElements = new Vector(); - abstractElements.addAll(getMachine().getAllVertices()); - abstractElements.addAll(getMachine().getAllEdges()); - - for (AbstractElement ae : abstractElements) { - if (!ae.getLabelKey().equalsIgnoreCase(Keywords.START_NODE)) { - String[] value = { ae.getLabelKey(), (ae instanceof Edge ? "Edge" : "Vertex"), ae.getDescriptionKey() }; - tempList.add(value); - } - } - list.addAll(tempList); - } - - @Override - public String toString() { - return "LIST"; - } -} diff --git a/src/main/java/org/graphwalker/generators/NonOptimizedShortestPath.java b/src/main/java/org/graphwalker/generators/NonOptimizedShortestPath.java deleted file mode 100644 index 901c87c8..00000000 --- a/src/main/java/org/graphwalker/generators/NonOptimizedShortestPath.java +++ /dev/null @@ -1,138 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.generators; - -import java.util.List; -import java.util.Vector; - -import org.apache.log4j.Logger; -import org.graphwalker.Util; -import org.graphwalker.conditions.StopCondition; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Vertex; - -import edu.uci.ics.jung.algorithms.shortestpath.DijkstraShortestPath; - -public class NonOptimizedShortestPath extends RandomPathGenerator { - - private boolean toggleAllOrUnvisited = true; - - public NonOptimizedShortestPath(StopCondition stopCondition) { - super(stopCondition); - } - - private static Logger logger = Util.setupLogger(NonOptimizedShortestPath.class); - private List dijkstraShortestPath; - - public NonOptimizedShortestPath() { - super(); - } - - @Override - public String[] getNext() throws InterruptedException { - Util.AbortIf(!hasNext(), "Finished"); - - if (Thread.interrupted()) { - throw new InterruptedException(); - } - Edge edge = null; - do { - if (!setDijkstraPath()) { - return super.getNext(); - } - edge = dijkstraShortestPath.remove(0); - } while (!isEdgeAvailable(edge)); - - getMachine().walkEdge(edge); - return new String[] { getMachine().getEdgeName(edge), getMachine().getCurrentVertexName() }; - } - - private boolean setDijkstraPath() { - // Is there a path to walk, given from DijkstraShortestPath? - if (dijkstraShortestPath == null || dijkstraShortestPath.size() == 0) { - Vector unvisitedEdges = getMachine().getUncoveredEdges(); - logger.debug("Number of unvisited edges: " + unvisitedEdges.size()); - - Edge e = null; - if (unvisitedEdges.size() == 0) { - return false; - } else { - Object[] shuffledList = null; - if (toggleAllOrUnvisited) { - shuffledList = Util.shuffle(unvisitedEdges.toArray()); - } else { - shuffledList = Util.shuffle(getMachine().getAllEdgesExceptStartEdge().toArray()); - } - toggleAllOrUnvisited = !toggleAllOrUnvisited; - - e = (Edge) shuffledList[0]; - } - - logger.debug("Current vertex: " + getMachine().getCurrentVertex()); - logger.debug("Will try to reach unvisited edge: " + e); - - dijkstraShortestPath = new DijkstraShortestPath(getMachine().getModel()).getPath(getMachine().getCurrentVertex(), - getMachine().getModel().getSource(e)); - - // DijkstraShortestPath.getPath returns 0 if there is no way to reach the - // destination. But, - // DijkstraShortestPath.getPath also returns 0 paths if the the source and - // destination vertex are the same, even if there is - // an edge there (self-loop). So we have to check for that. - if (dijkstraShortestPath.size() == 0) { - if (!getMachine().getCurrentVertex().getIndexKey().equals(getMachine().getModel().getSource(e).getIndexKey())) { - if (!toggleAllOrUnvisited) { - String msg = "There is no way to reach: " + e + ", from: " + getMachine().getCurrentVertex(); - logger.error(msg); - throw new RuntimeException(msg); - } - } - } - - dijkstraShortestPath.add(e); - logger.debug("Dijkstra path length to that edge: " + dijkstraShortestPath.size()); - logger.debug("Dijksta path:"); - for (Edge object : dijkstraShortestPath) { - logger.debug(" " + object); - } - } - return true; - } - - public void emptyCurrentPath() { - if (dijkstraShortestPath == null || dijkstraShortestPath.size() == 0) { - return; - } - dijkstraShortestPath = null; - } - - @Override - public String toString() { - if (getStopCondition() == null) { - return "SHORTESTNONOPT"; - } else { - return "SHORTESTNONOPT{" + getStopCondition().toString() + "}"; - } - } -} diff --git a/src/main/java/org/graphwalker/generators/PathGenerator.java b/src/main/java/org/graphwalker/generators/PathGenerator.java deleted file mode 100644 index 07569eb8..00000000 --- a/src/main/java/org/graphwalker/generators/PathGenerator.java +++ /dev/null @@ -1,102 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.generators; - -import java.util.Set; - -import org.graphwalker.conditions.StopCondition; -import org.graphwalker.exceptions.FoundNoEdgeException; -import org.graphwalker.graph.Edge; -import org.graphwalker.machines.FiniteStateMachine; - -public abstract class PathGenerator { - private FiniteStateMachine machine; - private StopCondition stopCondition; - - public abstract String[] getNext() throws InterruptedException; - - public PathGenerator(StopCondition stopCondition) { - this.stopCondition = stopCondition; - } - - public boolean hasNext() { - return !stopCondition.isFulfilled(); - } - - public FiniteStateMachine getMachine() { - return machine; - } - - public void setMachine(FiniteStateMachine machine) { - this.machine = machine; - if (this.stopCondition != null) { - this.stopCondition.setMachine(machine); - } - } - - public void setStopCondition(StopCondition stopCondition) { - this.stopCondition = stopCondition; - if (this.machine != null) { - this.stopCondition.setMachine(this.machine); - } - } - - public StopCondition getStopCondition() { - return stopCondition; - } - - /** - * @return the condition fulfilment - */ - public double getConditionFulfilment() { - return stopCondition.getFulfilment(); - } - - /** - * Will reset the generator to its initial vertex. - */ - public void reset() { - } - - PathGenerator() { - } - - @Override - public String toString() { - if (getStopCondition() != null) - return getStopCondition().toString(); - return ""; - } - - protected boolean isEdgeAvailable(Edge edge) { - Set availableEdges; - try { - availableEdges = getMachine().getCurrentOutEdges(); - } catch (FoundNoEdgeException e) { - throw new RuntimeException("No possible edges available for path", e); - } - return availableEdges.contains(edge); - - } -} diff --git a/src/main/java/org/graphwalker/generators/RandomPathGenerator.java b/src/main/java/org/graphwalker/generators/RandomPathGenerator.java deleted file mode 100644 index 18671237..00000000 --- a/src/main/java/org/graphwalker/generators/RandomPathGenerator.java +++ /dev/null @@ -1,119 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.generators; - -import java.util.*; - -import org.apache.log4j.Logger; -import org.graphwalker.Util; -import org.graphwalker.conditions.StopCondition; -import org.graphwalker.exceptions.FoundNoEdgeException; -import org.graphwalker.graph.Edge; - -public class RandomPathGenerator extends PathGenerator { - - private static Logger logger = Util.setupLogger(RandomPathGenerator.class); - - private Random random = new Random(); - - public RandomPathGenerator(StopCondition stopCondition) { - super(stopCondition); - } - - public RandomPathGenerator() { - super(); - } - - @Override - public String[] getNext() throws InterruptedException { - Set availableEdges; - try { - availableEdges = getMachine().getCurrentOutEdges(); - } catch (FoundNoEdgeException e) { - throw new RuntimeException("No possible edges available for path", e); - } - if (Thread.interrupted()) { - throw new InterruptedException(); - } - Edge edge = (getMachine().isWeighted() ? getWeightedEdge(availableEdges) : getRandomEdge(availableEdges)); - getMachine().walkEdge(edge); - logger.debug(edge.getFullLabelKey()); - logger.debug(edge); - return new String[] { getMachine().getEdgeName(edge), getMachine().getCurrentVertexName() }; - } - - private Edge getWeightedEdge(Set availableEdges) { - - Map probabilities = new HashMap(); - int numberOfZeros = 0; - double sum = 0; - - for (Edge edge : availableEdges) { - if (edge.getWeightKey() > 0) { - probabilities.put(edge, (double) edge.getWeightKey()); - sum += edge.getWeightKey(); - if (sum > 1) { - throw new RuntimeException("The sum of all weights in edges from vertex: '" - + getMachine().getModel().getSource(edge).getLabelKey() + "', adds up to more than 1.00"); - } - } else { - numberOfZeros++; - probabilities.put(edge, 0d); - } - } - - double rest = (1 - sum) / numberOfZeros; - int index = random.nextInt(100); - logger.debug("Randomized integer index = " + index); - - double weight = 0; - - for (Edge edge : availableEdges) { - - if (probabilities.get(edge) == 0) { - probabilities.put(edge, rest); - } - - logger.debug("The edge: '" + edge.getLabelKey() + "' is given the probability of " + probabilities.get(edge) * 100 + "%"); - - weight = weight + probabilities.get(edge) * 100; - logger.debug("Current weight is: " + weight); - if (index < weight) { - logger.debug("Selected edge is: " + edge); - return edge; - } - } - - throw new RuntimeException("No edge found"); - } - - private Edge getRandomEdge(Set availableEdges) { - return (Edge) availableEdges.toArray()[random.nextInt(availableEdges.size())]; - } - - @Override - public String toString() { - return "RANDOM{" + super.toString() + "}"; - } -} diff --git a/src/main/java/org/graphwalker/generators/RequirementsGenerator.java b/src/main/java/org/graphwalker/generators/RequirementsGenerator.java deleted file mode 100644 index a1a38ad4..00000000 --- a/src/main/java/org/graphwalker/generators/RequirementsGenerator.java +++ /dev/null @@ -1,95 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.generators; - -import java.util.Comparator; -import java.util.Iterator; -import java.util.Stack; -import java.util.TreeSet; -import java.util.Vector; - -import org.graphwalker.conditions.StopCondition; -import org.graphwalker.graph.AbstractElement; - -public class RequirementsGenerator extends PathGenerator { - - private Stack list = null; - - public RequirementsGenerator(StopCondition stopCondition) { - super(stopCondition); - } - - public RequirementsGenerator() { - super(); - } - - @Override - public boolean hasNext() { - if (list == null) { - generateList(); - } - return !list.isEmpty(); - } - - @Override - public String[] getNext() { - if (list == null) { - generateList(); - } - return list.pop(); - } - - private void generateList() { - list = new Stack(); - TreeSet tempList = new TreeSet(new Comparator() { - @Override - public int compare(String[] arg0, String[] arg1) { - return arg1[0].compareTo(arg0[0]); - } - }); - - Vector abstractElements = new Vector(); - abstractElements.addAll(getMachine().getAllVertices()); - abstractElements.addAll(getMachine().getAllEdges()); - - for (Iterator i = abstractElements.iterator(); i.hasNext();) { - AbstractElement ae = i.next(); - String reqtags = ae.getReqTagKey(); - if (!reqtags.isEmpty()) { - String[] tags = reqtags.split(","); - for (int j = 0; j < tags.length; j++) { - String[] value = { tags[j], "" }; - tempList.add(value); - } - } - } - list.addAll(tempList); - } - - @Override - public String toString() { - return "REQUIREMENTS"; - } - -} diff --git a/src/main/java/org/graphwalker/graph/AbstractElement.java b/src/main/java/org/graphwalker/graph/AbstractElement.java deleted file mode 100644 index 619b6b7b..00000000 --- a/src/main/java/org/graphwalker/graph/AbstractElement.java +++ /dev/null @@ -1,396 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.graph; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.log4j.Logger; -import org.graphwalker.Keywords; -import org.graphwalker.Util; - -public class AbstractElement { - - static Logger logger = Util.setupLogger(AbstractElement.class); - private String labelKey = ""; - private String fullLabelKey = ""; - private String reqTagKey = ""; - private Integer reqTagResult = 0; - private String parameterKey = ""; - private Integer visitedKey = 0; - private String actionsKey = ""; - private Integer indexKey = 0; - private String idKey = ""; - private String fileKey = ""; - private boolean mergeKey = false; - private boolean noMergeKey = false; - private boolean blockedKey = false; - private String imageKey = ""; - private boolean mergedMbtKey = false; - private String manualInstructions = ""; - private String descriptionKey = ""; - - public AbstractElement() { - } - - protected AbstractElement(AbstractElement ae) { - this.labelKey = ae.labelKey; - this.fullLabelKey = ae.fullLabelKey; - this.reqTagKey = ae.reqTagKey; - this.reqTagResult = ae.reqTagResult; - this.parameterKey = ae.parameterKey; - this.visitedKey = ae.visitedKey; - this.actionsKey = ae.actionsKey; - this.indexKey = ae.indexKey; - this.idKey = ae.idKey; - this.fileKey = ae.fileKey; - this.mergeKey = ae.mergeKey; - this.noMergeKey = ae.noMergeKey; - this.blockedKey = ae.blockedKey; - this.imageKey = ae.imageKey; - this.mergedMbtKey = ae.mergedMbtKey; - this.manualInstructions = ae.manualInstructions; - this.descriptionKey = ae.descriptionKey; - } - - protected AbstractElement(AbstractElement A, AbstractElement B) { - if (A.fullLabelKey.length() > B.fullLabelKey.length()) { - this.labelKey = A.labelKey; - this.fullLabelKey = A.fullLabelKey; - this.reqTagKey = A.reqTagKey; - this.reqTagResult = A.reqTagResult; - this.parameterKey = A.parameterKey; - this.visitedKey = A.visitedKey; - this.actionsKey = A.actionsKey; - this.indexKey = A.indexKey; - this.idKey = A.idKey; - this.fileKey = A.fileKey; - this.mergeKey = A.mergeKey; - this.noMergeKey = A.noMergeKey; - this.blockedKey = A.blockedKey; - this.imageKey = A.imageKey; - this.mergedMbtKey = A.mergedMbtKey; - this.manualInstructions = A.manualInstructions; - this.descriptionKey = A.descriptionKey; - } else { - this.labelKey = B.labelKey; - this.fullLabelKey = B.fullLabelKey; - this.reqTagKey = B.reqTagKey; - this.reqTagResult = B.reqTagResult; - this.parameterKey = B.parameterKey; - this.visitedKey = B.visitedKey; - this.actionsKey = B.actionsKey; - this.indexKey = B.indexKey; - this.idKey = B.idKey; - this.fileKey = B.fileKey; - this.mergeKey = B.mergeKey; - this.noMergeKey = B.noMergeKey; - this.blockedKey = B.blockedKey; - this.imageKey = B.imageKey; - this.mergedMbtKey = B.mergedMbtKey; - this.manualInstructions = B.manualInstructions; - this.descriptionKey = B.descriptionKey; - } - } - - public boolean isMergedMbtKey() { - return mergedMbtKey; - } - - public void setMergedMbtKey(boolean mergedMbtKey) { - this.mergedMbtKey = mergedMbtKey; - } - - public String getImageKey() { - return imageKey; - } - - public void setImageKey(String imageKey) { - this.imageKey = imageKey; - } - - public boolean isBlockedKey() { - return blockedKey; - } - - public void setBlockedKey(boolean blockedKey) { - this.blockedKey = blockedKey; - } - - public boolean isNoMergeKey() { - return noMergeKey; - } - - public void setNoMergeKey(boolean noMergeKey) { - this.noMergeKey = noMergeKey; - } - - public boolean isMergeKey() { - return mergeKey; - } - - public void setMergeKey(boolean mergeKey) { - this.mergeKey = mergeKey; - } - - public String getFileKey() { - return fileKey; - } - - public void setFileKey(String fileKey) { - this.fileKey = fileKey; - } - - public String getIdKey() { - return idKey; - } - - public void setIdKey(String idKey) { - this.idKey = idKey; - } - - public Integer getIndexKey() { - return indexKey; - } - - public void setIndexKey(Integer indexKey) { - this.indexKey = indexKey; - } - - public String getActionsKey() { - return actionsKey; - } - - public void setActionsKey(String actionsKey) { - this.actionsKey = actionsKey; - } - - public Integer getVisitedKey() { - return visitedKey; - } - - public void setVisitedKey(Integer visitedKey) { - this.visitedKey = visitedKey; - } - - public String getParameterKey() { - return parameterKey; - } - - public void setParameterKey(String parameterKey) { - this.parameterKey = parameterKey; - } - - public String getReqTagKey() { - return reqTagKey; - } - - /** - * Associates a requirement to the edge/vertex. - * - * @param reqTagKey - * The requirement. It can be one or many, if many that are comma - * separated. - */ - public void setReqTagKey(String reqTagKey) { - this.reqTagKey = reqTagKey; - } - - /** - * @return 0 is the requirement is untested.
- * 1 if requirement tested ok
- * 2 if the requirement has failed the test. - */ - public Integer getReqTagResult() { - return reqTagResult; - } - - public void setReqTagResult(Integer reqTagResult) { - this.reqTagResult = reqTagResult; - } - - public String getFullLabelKey() { - return fullLabelKey; - } - - public void setFullLabelKey(String fullLabelKey) { - this.fullLabelKey = fullLabelKey; - } - - public String getLabelKey() { - return labelKey; - } - - public void setLabelKey(String labelKey) { - this.labelKey = labelKey; - } - - @Override - public String toString() { - return Util.getCompleteName(this); - } - - public String getManualInstructions() { - return manualInstructions; - } - - public void setManualInstructions(String attributeValue) { - this.manualInstructions = attributeValue; - } - - /** - * Parses for the MERGE keyword. If merge is defined, find it... If defined, - * it means that the node will be merged with all other nodes wit the same - * name, but not replaced by any subgraphs - * - * @param str - * @return - */ - static public Boolean isMerged(String str) { - Pattern p = Pattern.compile("\\n(MERGE)", Pattern.MULTILINE); - Matcher m = p.matcher(str); - if (m.find()) { - logger.debug("Found keyword MERGE"); - return true; - } - return false; - } - - /** - * If no merge is defined, find it... If defined, it means that when merging - * graphs, this specific vertex will not be merged or replaced by any - * subgraphs - * - * @param str - * @return - */ - static public Boolean isNoMerge(String str) { - Pattern p = Pattern.compile("\\n(NO_MERGE)", Pattern.MULTILINE); - Matcher m = p.matcher(str); - if (m.find()) { - logger.debug("Found keyword NO_MERGE"); - return true; - } - return false; - } - - /** - * If BLOCKED is defined, find it... If defined, it means that this vertex - * will not be added to the graph. Sometimes it can be useful during testing - * to mark vertices as BLOCKED due to bugs in the system you test. When the - * bug is removed, the BLOCKED tag can be removed. - * - * @param str - * @return - */ - static public Boolean isBlocked(String str) { - Pattern p = Pattern.compile("\\n(BLOCKED)", Pattern.MULTILINE); - Matcher m = p.matcher(str); - if (m.find()) { - logger.debug("Found keyword BLOCKED"); - return true; - } - return false; - } - - /** - * If INDEX is defined, find it... If defined, it means that this vertex has - * already a unique id generated by mbt before, so we use this instead.. - * - * @param str - * @return - */ - static public Integer getIndex(String str) { - Pattern p = Pattern.compile("\\n(INDEX=(.*))", Pattern.MULTILINE); - Matcher m = p.matcher(str); - if (m.find()) { - String index_key = m.group(2); - logger.debug("Found INDEX: " + index_key); - return Integer.valueOf(index_key); - } - return 0; - } - - /** - * If the REQTAG is defined, find it... - * - * @param str - * @return - */ - static public String getReqTags(String str) { - Pattern p = Pattern.compile("\\n(REQTAG=(.*))", Pattern.MULTILINE); - Matcher m = p.matcher(str); - if (m.find()) { - String value = m.group(2); - p = Pattern.compile("([^,]+)", Pattern.MULTILINE); - m = p.matcher(value); - String reqtags = ""; - while (m.find()) { - String reqtag = m.group(1); - reqtag = reqtag.trim(); - if (reqtags.length() == 0) { - reqtags = reqtag; - } else { - reqtags += "," + reqtag; - } - } - logger.debug("Found REQTAG: " + reqtags); - return reqtags; - } - return ""; - } - - public void setDesctiptionKey(String str) { - this.descriptionKey = str; - } - - public String getDescriptionKey() { - return this.descriptionKey; - } - - public String getDescription(String str) { - Pattern p; - Matcher m; - String label = ""; - p = Pattern.compile("\\<\\!\\[CDATA\\[.*\\]\\]\\>\\", Pattern.MULTILINE); - { - m = p.matcher(str); - if (m.find()) { - label = m.group(1); - if (label.length() <= 0) { - throw new RuntimeException("Vertex is missing mandatory label"); - } - if (label.matches(".*[\\s].*")) { - throw new RuntimeException("Label of vertex: '" + label + "', containing whitespaces"); - } - if (Keywords.isKeyWord(label)) { - throw new RuntimeException("The label of vertex: '" + label + "', is a reserved keyword"); - } - } else { - throw new RuntimeException("Label must be defined for vertex"); - } - return label; - } - } -} diff --git a/src/main/java/org/graphwalker/graph/Edge.java b/src/main/java/org/graphwalker/graph/Edge.java deleted file mode 100644 index 78d5012e..00000000 --- a/src/main/java/org/graphwalker/graph/Edge.java +++ /dev/null @@ -1,177 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.graph; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.graphwalker.Keywords; - -public class Edge extends AbstractElement { - - private String guardKey = ""; - private Float weightKey = 0f; - - public Edge() { - super(); - } - - public Edge(Edge edge) { - super(edge); - this.guardKey = edge.guardKey; - this.weightKey = edge.weightKey; - } - - public Edge(Edge A, Edge B) { - super(A, B); - if (A.getFullLabelKey().length() > B.getFullLabelKey().length()) { - this.guardKey = A.guardKey; - this.weightKey = A.weightKey; - } else { - this.guardKey = B.guardKey; - this.weightKey = B.weightKey; - } - } - - public float getWeightKey() { - return weightKey; - } - - public void setWeightKey(float weightKey) { - if (weightKey < 0 || weightKey > 1) - throw new RuntimeException("The value of weight, must be between 0 <= weight <= 1"); - this.weightKey = weightKey; - } - - public String getGuardKey() { - return guardKey; - } - - public void setGuardKey(String guardKey) { - this.guardKey = guardKey; - } - - /** - * The label of an edge has the following format: Label Parameter [Guard] / - * Action1;Action2;ActionN; Keyword Where the Label, Parameter. Guard, Actions - * and Keyword are optional. - * - * @param str - * @return - */ - static public String[] getGuardAndActions(String str) { - Pattern p = Pattern.compile("(.*)", Pattern.MULTILINE); - Matcher m = p.matcher(str); - String label = null; - String[] guardAndAction = { "", "" }; - if (m.find()) { - label = m.group(1); - - // Look for a Guard - Pattern firstLinePattern = Pattern.compile("\\[(.*)\\]\\s*/|\\[(.*)\\]\\s*$", Pattern.MULTILINE); - Matcher firstLineMatcher = firstLinePattern.matcher(label); - if (firstLineMatcher.find()) { - // Since we have 2 groups in the pattern, we have to check which - // one is valid. - String guard = firstLineMatcher.group(1); - if (guard == null) { - guard = firstLineMatcher.group(2); - } - guardAndAction[0] = guard; - } - - // Look for Actions - // To simplify this we wash the string by removing the guard - // from a temporary string and make the search. - String washedLabel = label.replace(guardAndAction[0], ""); - Pattern actionPattern = Pattern.compile("/\\s*(.*)\\s*$", Pattern.MULTILINE); - Matcher actionMatcher = actionPattern.matcher(washedLabel); - if (actionMatcher.find()) { - guardAndAction[1] = actionMatcher.group(1); - } - } - return guardAndAction; - } - - /** - * The label of an edge has the following format: Label Parameter [Guard] / - * Action1;Action2;ActionN; Keyword Where the Label, Parameter. Guard, Actions - * and Keyword are optional. - * - * @param str - * @return - */ - static public String[] getLabelAndParameter(String str) { - Pattern p = Pattern.compile("(.*)", Pattern.MULTILINE); - Matcher m = p.matcher(str); - String label = null; - String[] labelAndParameter = { "", "" }; - if (m.find()) { - label = m.group(1); - - // Look for the Label and Parameter - Pattern firstLinePattern = Pattern.compile("^([\\w\\.]+)\\s?([^/^\\[]+)?", Pattern.MULTILINE); - Matcher firstLineMatcher = firstLinePattern.matcher(label); - if (firstLineMatcher.find()) { - String label_key = firstLineMatcher.group(1); - if (Keywords.isKeyWord(label_key)) { - throw new RuntimeException("Edge has a label '" + label + "', which is a reserved keyword"); - } - labelAndParameter[0] = label_key; - - String parameter = firstLineMatcher.group(2); - if (parameter != null) { - parameter = parameter.trim(); - labelAndParameter[1] = parameter; - } - } - } else { - throw new RuntimeException("Label for edge must be defined"); - } - return labelAndParameter; - } - - /** - * If weight is defined, find it... weight must be associated with a value, - * which depicts the probability for the edge to be executed. A value of 0.05 - * is the same as 5% chance of going down this road. - * - * @param str - * @return - */ - static public float getWeight(String str) { - Pattern p = Pattern.compile("\\n(weight\\s*=\\s*(.*))", Pattern.MULTILINE); - Matcher m = p.matcher(str); - Float weight = 0f; - if (m.find()) { - String value = m.group(2); - try { - weight = Float.valueOf(value.trim()); - } catch (NumberFormatException error) { - throw new RuntimeException("For label: " + str + ", weight is not a correct float value: " + error.toString()); - } - } - return weight; - } -} diff --git a/src/main/java/org/graphwalker/graph/Graph.java b/src/main/java/org/graphwalker/graph/Graph.java deleted file mode 100644 index 533c118d..00000000 --- a/src/main/java/org/graphwalker/graph/Graph.java +++ /dev/null @@ -1,95 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.graph; - -import edu.uci.ics.jung.graph.SparseMultigraph; -import edu.uci.ics.jung.graph.util.EdgeType; -import org.apache.log4j.Logger; -import org.graphwalker.Util; - -public class Graph extends SparseMultigraph { - - private static final long serialVersionUID = 4744840850614032582L; - private static Logger logger = Util.setupLogger(Graph.class); - - private String fileKey = ""; - private String labelKey = ""; - - public String getLabelKey() { - return labelKey; - } - - public void setLabelKey(String labelKey) { - this.labelKey = labelKey; - } - - public String getFileKey() { - return fileKey; - } - - public void setFileKey(String fileKey) { - this.fileKey = fileKey; - } - - @Override - public String toString() { - String str = ""; - if (!getFileKey().isEmpty()) - str += "File: " + getFileKey() + ", "; - if (!getLabelKey().isEmpty()) - str += "Label: " + getLabelKey() + ", "; - str += "Num of vertices: " + getVertexCount() + ", "; - str += "Num of edges: " + getEdgeCount(); - return str; - } - - @Override - public boolean addEdge(Edge e, Vertex source, Vertex dest) { - return super.addEdge(e, source, dest, EdgeType.DIRECTED); - } - - public Vertex findVertex(String vertexName) { - logger.debug("Looking for vertex: " + vertexName + ", in model: " + this.toString()); - for (Vertex vertex : getVertices()) { - logger.debug(" " + vertex.getLabelKey()); - if ((vertex.getLabelKey()).equals(vertexName)) { - logger.debug(" Found it: " + vertex); - return vertex; - } - } - return null; - } - - public Edge findEdge(String edgeName) { - logger.debug("Looking for edge: " + edgeName + ", in model: " + this.toString()); - for (Edge edge : getEdges()) { - logger.debug(" " + edge.getLabelKey()); - if ((edge.getLabelKey()).equals(edgeName)) { - logger.debug(" Found it: " + edge); - return edge; - } - } - return null; - } -} diff --git a/src/main/java/org/graphwalker/graph/Vertex.java b/src/main/java/org/graphwalker/graph/Vertex.java deleted file mode 100644 index 58b9e72c..00000000 --- a/src/main/java/org/graphwalker/graph/Vertex.java +++ /dev/null @@ -1,175 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.graph; - -import java.awt.Color; -import java.awt.geom.Point2D; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.log4j.Logger; -import org.graphwalker.Keywords; -import org.graphwalker.Util; - -public class Vertex extends AbstractElement { - - static Logger logger = Util.setupLogger(Vertex.class); - private String motherStartVertexKey = ""; - private String subGraphStartVertexKey = ""; - private Color fillColor = new Color(0); - private Point2D location = new Point2D.Float(); - private float width = 0; - private float height = 0; - private boolean switchModelKey = false; - private boolean graphVertex = false; - - public float getWidth() { - return width; - } - - public void setWidth(float width) { - this.width = width; - } - - public float getHeight() { - return height; - } - - public void setHeight(float height) { - this.height = height; - } - - public void setLocation(Point2D location) { - this.location = location; - } - - public Point2D getLocation() { - return location; - } - - public Color getFillColor() { - return fillColor; - } - - public void setFillColor(Color fillColor) { - this.fillColor = fillColor; - } - - public Vertex() { - super(); - } - - public Vertex(Vertex vertex) { - super(vertex); - this.motherStartVertexKey = vertex.motherStartVertexKey; - this.subGraphStartVertexKey = vertex.subGraphStartVertexKey; - this.fillColor = vertex.fillColor; - this.location = vertex.location; - this.width = vertex.width; - this.height = vertex.height; - this.switchModelKey = vertex.switchModelKey; - this.graphVertex = vertex.graphVertex; - } - - /** - * If SWITCH_MODEL is defined, find it... If defined, it means that the vertex - * can be a point for switching to another model using the same label, see - * org.graphwalker.graph.Graph.getLabelKey(). - * - * @param str - * @return - */ - static public Boolean isSwitchModel(String str) { - Pattern p = Pattern.compile("\\n(SWITCH_MODEL)", Pattern.MULTILINE); - Matcher m = p.matcher(str); - if (m.find()) { - logger.debug("Found keyword SWITCH_MODEL"); - return true; - } - return false; - } - - public String getSubGraphStartVertexKey() { - return subGraphStartVertexKey; - } - - public void setSubGraphStartVertexKey(String subGraphStartVertexKey) { - this.subGraphStartVertexKey = subGraphStartVertexKey; - } - - public String getMotherStartVertexKey() { - return motherStartVertexKey; - } - - public void setMotherStartVertexKey(String motherStartVertexKey) { - this.motherStartVertexKey = motherStartVertexKey; - } - - /** - * @param str - * @return - */ - static public String getLabel(String str) { - Pattern p; - Matcher m; - String label = ""; - if (str.split("/").length > 1 || str.split("\\[").length > 1) { - p = Pattern.compile("^([\\w\\.]+)\\s?([^/^\\[]+)?", Pattern.MULTILINE); - } else { - p = Pattern.compile("(.*)", Pattern.MULTILINE); - } - m = p.matcher(str); - if (m.find()) { - label = m.group(1); - if (label.length() <= 0) { - throw new RuntimeException("Vertex is missing mandatory label"); - } - if (label.matches(".*[\\s].*")) { - throw new RuntimeException("Label of vertex: '" + label + "', containing whitespaces"); - } - if (Keywords.isKeyWord(label)) { - throw new RuntimeException("The label of vertex: '" + label + "', is a reserved keyword"); - } - } else { - throw new RuntimeException("Label must be defined for vertex"); - } - return label; - } - - public boolean isSwitchModelKey() { - return switchModelKey; - } - - public void setSwitchModelKey(Boolean switchModel) { - this.switchModelKey = switchModel; - } - - public boolean isGraphVertex() { - return graphVertex; - } - - public void setGraphVertex(boolean graphVertex) { - this.graphVertex = graphVertex; - } -} diff --git a/src/main/java/org/graphwalker/io/AbstractModelHandler.java b/src/main/java/org/graphwalker/io/AbstractModelHandler.java deleted file mode 100644 index 5ec44715..00000000 --- a/src/main/java/org/graphwalker/io/AbstractModelHandler.java +++ /dev/null @@ -1,45 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.io; - -import java.io.PrintStream; - -import org.graphwalker.graph.Graph; - -public abstract class AbstractModelHandler { - - protected Graph graph; - - public abstract void load(String fileName); - - public abstract void save(PrintStream ps, boolean printIndex); - - public Graph getModel() { - return graph; - } - - public void setModel(Graph graph) { - this.graph = graph; - } -} diff --git a/src/main/java/org/graphwalker/io/GraphML.java b/src/main/java/org/graphwalker/io/GraphML.java deleted file mode 100644 index d4bb71f6..00000000 --- a/src/main/java/org/graphwalker/io/GraphML.java +++ /dev/null @@ -1,1085 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.io; - -import java.awt.Color; -import java.awt.geom.Point2D; -import java.io.File; -import java.io.FilenameFilter; -import java.io.IOException; -import java.io.PrintStream; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Vector; - -import org.apache.log4j.Logger; -import org.graphwalker.Keywords; -import org.graphwalker.Util; -import org.graphwalker.graph.AbstractElement; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; -import org.jdom.Document; -import org.jdom.JDOMException; -import org.jdom.input.SAXBuilder; - -import edu.uci.ics.jung.graph.util.Pair; - -/** - * A file reader for GraphML files. The reader can read one single graphml file - * or several in a single folder. When several files are read, they will be - * merged. Regardless if one or several files are read, they all end up into one - * single Graph object.
- *
- * Example: Single graphml file
- * GraphML graphML = new GraphML();
- * Graph graph = graphML.load( "graph.graphml" );
- *
- * Example: Folder containing several graphml files
- * GraphML graphML = new GraphML();
- * Graph graph = graphML.load( "/home/user/graphml_folder/" );
- * - */ -public class GraphML extends AbstractModelHandler { - /** - * Indicator if the graph list needs to be merged - */ - private boolean merged; - - /** - * List of parsed graphs - */ - private Vector parsedGraphList; - - /** - * A counter for creating unique indexes for edges and vertices. - */ - private int vertexAndEdgeIndex; - - /** - * The logger - */ - private Logger logger; - - /** - * Default constructor. Initializes the default logger. - */ - public GraphML() { - logger = Util.setupLogger(GraphML.class); - - parsedGraphList = new Vector(); - vertexAndEdgeIndex = 0; - } - - /** - * Reads one single graph, or a folder containing several graphs to be merged - * into one graph. - * - * @see org.graphwalker.io.AbstractModelHandler#load(java.lang.String) - * @param fileOrfolder - * The gramphml file or folder. - */ - @Override - public void load(String fileOrfolder) { - if (!"".equals(fileOrfolder)) { - File file = Util.getFile(fileOrfolder); - if (file.isFile()) { - parsedGraphList.add(parseFile(fileOrfolder)); - setMerged(false); - } else if (file.isDirectory()) { - // Only accepts files which suffix is .graphml - FilenameFilter graphmlFilter = new FilenameFilter() { - @Override - public boolean accept(File dir, String name) { - return name.endsWith(".graphml"); - } - }; - - File[] allChildren = file.listFiles(graphmlFilter); - for (File anAllChildren : allChildren) { - parsedGraphList.add(parseFile(anAllChildren.getAbsolutePath())); - setMerged(false); - } - } else { - throw new RuntimeException("'" + fileOrfolder - + "' is not a file or a directory. Please specify a valid .graphml file or a directory containing .graphml files"); - } - } - mergeAllGraphs(); - } - - /** - * Parses the graphml file, and returns the model as a - * edu.uci.ics.jung.graph.impl.Graph - * - * @param fileName - * The graphml file - * @return The graph - */ - @SuppressWarnings("unchecked") - private Graph parseFile(String fileName) { - Graph graph = new Graph(); - graph.setFileKey(fileName); - SAXBuilder parser = new SAXBuilder(); - - try { - logger.debug("Parsing file: " + fileName); - Document doc = parser.build(Util.getFile(fileName)); - - // Parse all vertices (nodes) - Iterator iter_node = doc.getDescendants(new org.jdom.filter.ElementFilter("node")); - while (iter_node.hasNext()) { - Object o = iter_node.next(); - if (o instanceof org.jdom.Element) { - org.jdom.Element element = (org.jdom.Element) o; - if (element.getAttributeValue("yfiles.foldertype") != null) { - logger.debug(" Excluded node: " + element.getAttributeValue("yfiles.foldertype")); - continue; - } - Iterator iterUMLNoteIter = element.getDescendants(new org.jdom.filter.ElementFilter("UMLNoteNode")); - if (iterUMLNoteIter.hasNext()) { - logger.debug(" Excluded node: UMLNoteNode"); - continue; - } - logger.debug(" id: " + element.getAttributeValue("id")); - - // Used to remember which vertex to store the image location. - Vertex currentVertex = null; - - Iterator iterNodeLabel = element.getDescendants(new org.jdom.filter.ElementFilter("NodeLabel")); - while (iterNodeLabel.hasNext()) { - Object o2 = iterNodeLabel.next(); - if (o2 instanceof org.jdom.Element) { - org.jdom.Element nodeLabel = (org.jdom.Element) o2; - logger.debug(" Full name: '" + nodeLabel.getQualifiedName() + "'"); - logger.debug(" Name: '" + nodeLabel.getTextTrim() + "'"); - String str = nodeLabel.getTextTrim(); - - Vertex v = new Vertex(); - graph.addVertex(v); - currentVertex = v; - - // Parse description - Iterator iter_data = element.getDescendants(new org.jdom.filter.ElementFilter("data")); - while (iter_data.hasNext()) { - Object o3 = iter_data.next(); - if (o instanceof org.jdom.Element) { - org.jdom.Element data = (org.jdom.Element) o3; - if (!data.getAttributeValue("key").equals("d5")) - continue; - v.setDesctiptionKey(data.getText()); - break; - } - } - - v.setIdKey(element.getAttributeValue("id")); - v.setVisitedKey(0); - v.setFileKey(fileName); - v.setFullLabelKey(str); - v.setIndexKey(getNewVertexAndEdgeIndex()); - v.setLabelKey(Vertex.getLabel(str)); - v.setMergeKey(AbstractElement.isMerged(str)); - v.setNoMergeKey(AbstractElement.isNoMerge(str)); - v.setBlockedKey(AbstractElement.isBlocked(str)); - v.setSwitchModelKey(Vertex.isSwitchModel(str)); - - Integer index = AbstractElement.getIndex(str); - if (index != 0) { - v.setIndexKey(index); - } - - v.setReqTagKey(AbstractElement.getReqTags(str)); - } - } - - // Extract any manual test instructions - Iterator iterData = element.getDescendants(new org.jdom.filter.ElementFilter("data")); - while (iterData.hasNext() && currentVertex != null) { - Object o2 = iterData.next(); - if (o2 instanceof org.jdom.Element) { - org.jdom.Element data = (org.jdom.Element) o2; - if (!data.getContent().isEmpty() && data.getContent(0) != null) { - String text = data.getContent(0).getValue().trim(); - if (!text.isEmpty()) { - logger.debug(" Data: '" + text + "'"); - currentVertex.setManualInstructions(text); - } - } - } - } - - // Using the yEd editor, an image can be used to depict the vertex. - // When merging multiple - // graphs into one, the code below, stores the image location, which - // will be used when - // writing that merged graphml file. - Iterator iterImage = element.getDescendants(new org.jdom.filter.ElementFilter("Image")); - while (iterImage.hasNext() && currentVertex != null) { - Object o2 = iterImage.next(); - if (o2 instanceof org.jdom.Element) { - org.jdom.Element image = (org.jdom.Element) o2; - if (image.getAttributeValue("href") != null) { - logger.debug(" Image: '" + image.getAttributeValue("href") + "'"); - currentVertex.setImageKey(image.getAttributeValue("href")); - } - } - } - Iterator iterGeometry = element.getDescendants(new org.jdom.filter.ElementFilter("Geometry")); - while (iterGeometry.hasNext() && currentVertex != null) { - Object o2 = iterGeometry.next(); - if (o2 instanceof org.jdom.Element) { - org.jdom.Element geometry = (org.jdom.Element) o2; - logger.debug(" width: '" + geometry.getAttributeValue("width") + "'"); - logger.debug(" height: '" + geometry.getAttributeValue("height") + "'"); - logger.debug(" x position: '" + geometry.getAttributeValue("x") + "'"); - logger.debug(" y position: '" + geometry.getAttributeValue("y") + "'"); - currentVertex.setWidth(Float.parseFloat(geometry.getAttributeValue("width"))); - currentVertex.setHeight(Float.parseFloat(geometry.getAttributeValue("height"))); - currentVertex.setLocation(new Point2D.Float(Float.parseFloat(geometry.getAttributeValue("x")), Float.parseFloat(geometry - .getAttributeValue("y")))); - } - } - Iterator iterFill = element.getDescendants(new org.jdom.filter.ElementFilter("Fill")); - while (iterFill.hasNext() && currentVertex != null) { - Object o2 = iterFill.next(); - if (o2 instanceof org.jdom.Element) { - org.jdom.Element fill = (org.jdom.Element) o2; - logger.debug(" fill color: '" + fill.getAttributeValue("color") + "'"); - currentVertex.setFillColor(new Color(Integer.parseInt(fill.getAttributeValue("color").replace("#", ""), 16))); - } - } - } - } - - Object[] vertices = graph.getVertices().toArray(); - - // Parse all edges (arrows or transitions) - Iterator iter_edge = doc.getDescendants(new org.jdom.filter.ElementFilter("edge")); - while (iter_edge.hasNext()) { - Object o = iter_edge.next(); - if (o instanceof org.jdom.Element) { - org.jdom.Element element = (org.jdom.Element) o; - logger.debug(" id: " + element.getAttributeValue("id")); - - Iterator iter2 = element.getDescendants(new org.jdom.filter.ElementFilter("EdgeLabel")); - org.jdom.Element edgeLabel = null; - if (iter2.hasNext()) { - Object o2 = iter2.next(); - if (o2 instanceof org.jdom.Element) { - edgeLabel = (org.jdom.Element) o2; - logger.debug(" Full name: '" + edgeLabel.getQualifiedName() + "'"); - logger.debug(" Name: '" + edgeLabel.getTextTrim() + "'"); - } - } - logger.debug(" source: " + element.getAttributeValue("source")); - logger.debug(" target: " + element.getAttributeValue("target")); - - Vertex source = null; - Vertex dest = null; - - for (Object vertice : vertices) { - Vertex vertex = (Vertex) vertice; - - // Find source vertex - if (vertex.getIdKey().equals(element.getAttributeValue("source")) && vertex.getFileKey().equals(fileName)) { - source = vertex; - } - if (vertex.getIdKey().equals(element.getAttributeValue("target")) && vertex.getFileKey().equals(fileName)) { - dest = vertex; - } - } - if (source == null) { - String msg = "Could not find starting node for edge. Name: '" + element.getAttributeValue("source") + "' In file '" + fileName - + "'"; - logger.error(msg); - throw new RuntimeException(msg); - } - if (dest == null) { - String msg = "Could not find end node for edge. Name: '" + element.getAttributeValue("target") + "' In file '" + fileName + "'"; - logger.error(msg); - throw new RuntimeException(msg); - } - - Edge e = new Edge(); - e.setIdKey(element.getAttributeValue("id")); - e.setFileKey(fileName); - e.setIndexKey(getNewVertexAndEdgeIndex()); - - // Parse description - Iterator iter_data = element.getDescendants(new org.jdom.filter.ElementFilter("data")); - while (iter_data.hasNext()) { - Object o3 = iter_data.next(); - if (o instanceof org.jdom.Element) { - org.jdom.Element data = (org.jdom.Element) o3; - if (!data.getAttributeValue("key").equals("d9")) - continue; - e.setDesctiptionKey(data.getText()); - break; - } - } - - if (!graph.addEdge(e, source, dest)) { - String msg = "Failed adding edge: " + e + ", to graph: " + graph; - logger.error(msg); - throw new RuntimeException(msg); - } - - if (edgeLabel != null) { - // The label of an edge has the following format: - // Label Parameter [Guard] / Action1;Action2;ActionN; - // Keyword - // Where the Label, Parameter. Guard, Actions and Keyword are - // optional. - - String str = edgeLabel.getText(); - - e.setFullLabelKey(str); - String[] guardAndAction = Edge.getGuardAndActions(str); - String[] labelAndParameter = Edge.getLabelAndParameter(str); - e.setGuardKey(guardAndAction[0]); - e.setActionsKey(guardAndAction[1]); - e.setLabelKey(labelAndParameter[0]); - e.setParameterKey(labelAndParameter[1]); - e.setWeightKey(Edge.getWeight(str)); - e.setBlockedKey(AbstractElement.isBlocked(str)); - - Integer index = AbstractElement.getIndex(str); - if (index != 0) { - e.setIndexKey(index); - } - - e.setReqTagKey(AbstractElement.getReqTags(str)); - } - e.setVisitedKey(0); - logger.debug(" Added edge: '" + e.getLabelKey() + "', with id: " + e.getIndexKey()); - - // Extract any manual test instructions - Iterator iterData = element.getDescendants(new org.jdom.filter.ElementFilter("data")); - while (iterData.hasNext() && e != null) { - Object o2 = iterData.next(); - if (o2 instanceof org.jdom.Element) { - org.jdom.Element data = (org.jdom.Element) o2; - if (!data.getContent().isEmpty() && data.getContent(0) != null) { - String text = data.getContent(0).getValue().trim(); - if (!text.isEmpty()) { - logger.debug(" Data: '" + text + "'"); - e.setManualInstructions(text); - } - } - } - } - } - } - } catch (RuntimeException e) { - throw new RuntimeException("Could not parse file: '" + fileName + "'. " + e.getMessage()); - } catch (JDOMException e) { - throw new RuntimeException("Could not parse file: '" + fileName + "'. " + e.getMessage()); - } catch (IOException e) { - throw new RuntimeException("Could not parse file: '" + fileName + "'. " + e.getMessage()); - } - - logger.debug("Finished parsing graph: " + graph); - removeBlockedEntities(graph); - logger.debug("Graph after removing BLOCKED entities: " + graph); - - return graph; - } - - /** - * Increment and return the unique index for a vertex or edge. - * - * @return - */ - private int getNewVertexAndEdgeIndex() { - return ++vertexAndEdgeIndex; - } - - /** - * Removes any edges, and any vertices that contains the key word BLOCKED - * - * @param graph - */ - private void removeBlockedEntities(Graph graph) { - Object[] vertices = graph.getVertices().toArray(); - for (Object vertice : vertices) { - Vertex v = (Vertex) vertice; - if (v.isBlockedKey()) { - logger.debug("Removing this vertex because it is BLOCKED: '" + v.getLabelKey() + "'"); - graph.removeVertex(v); - } - } - Object[] edges = graph.getEdges().toArray(); - for (Object edge : edges) { - Edge e = (Edge) edge; - if (e.isBlockedKey()) { - logger.debug("Removing this edge because it is BLOCKED: '" + e.getLabelKey() + "'"); - graph.removeEdge(e); - } - } - } - - /** - * Merge all file graphs into one graph. - */ - private void mergeAllGraphs() { - if (!isMerged()) { - findMotherAndSubgraphs(); - checkForDuplicateVerticesInSubgraphs(); - mergeSubgraphs(); - mergeVerticesMarked_MERGE(); - checkForVerticesWithZeroInEdges(); - - logger.info("Done merging"); - setMerged(true); - } - setGraphName(); - } - - private void setGraphName() { - for (Vertex v : graph.getVertices()) { - if (v.getLabelKey().equalsIgnoreCase(Keywords.START_NODE)) { - Edge e = (Edge) graph.getOutEdges(v).toArray()[0]; - graph.setLabelKey(graph.getDest(e).getLabelKey()); - graph.getDest(e).setGraphVertex(true); - } - } - } - - private void setMerged(boolean merged) { - this.merged = merged; - } - - private boolean isMerged() { - return this.merged; - } - - /** - * Search for the mother graph, and all subgraphs - */ - private void findMotherAndSubgraphs() { - boolean foundMotherStartGraph = false; - boolean foundSubStartGraph = false; - graph = null; - - for (Iterator iter = parsedGraphList.iterator(); iter.hasNext();) { - Graph g = iter.next(); - foundSubStartGraph = false; - - logger.debug("Analyzing graph: " + g.getFileKey()); - - Object[] vertices = g.getVertices().toArray(); - for (Object vertice : vertices) { - Vertex v = (Vertex) vertice; - - // Find all vertices that are start nodes (START_NODE) - if (v.getLabelKey().equalsIgnoreCase(Keywords.START_NODE)) { - if (g.getOutEdges(v).size() != 1) { - throw new RuntimeException("A Start vertex can only have one out edge, look in file: " + g.getFileKey()); - } - Edge edge = (Edge) g.getOutEdges(v).toArray()[0]; - if (!edge.getLabelKey().isEmpty()) { - if (foundMotherStartGraph) { - if (graph.getFileKey().equals(g.getFileKey())) { - throw new RuntimeException("Only one Start vertex can exist in one file, see file '" + graph.getFileKey() + "'"); - } else { - throw new RuntimeException("Only one Start vertex can exist in one file, see files " + graph.getFileKey() + ", and " - + g.getFileKey()); - } - } - if (foundSubStartGraph) { - throw new RuntimeException("Only one Start vertex can exist in one file, see file '" + g.getFileKey() + "'"); - } - - foundMotherStartGraph = true; - graph = g; - g.getDest(edge).setMotherStartVertexKey(Keywords.MOTHER_GRAPH_START_VERTEX); - logger.debug("Found the mother graph in the file: " + graph.getFileKey()); - } else { - if (foundSubStartGraph) { - throw new RuntimeException("Only one Start vertex can exist in one file, see file '" + g.getFileKey() + "'"); - } - - // Verify that current subgraph is not already defined - for (Iterator iter_g = parsedGraphList.iterator(); iter_g.hasNext();) { - if (iter.hashCode() == iter_g.hashCode()) { - continue; - } - - Graph tmp_graph = iter_g.next(); - if (!tmp_graph.getLabelKey().isEmpty()) { - String name = tmp_graph.getLabelKey(); - if (name.equals(g.getDest(edge).getLabelKey())) { - throw new RuntimeException("Found 2 subgraphs using the same name: '" + g.getDest(edge).getLabelKey() - + "', they are defined in files: '" + g.getFileKey() + "', and :'" + tmp_graph.getFileKey() + "'"); - } - } - } - - if (foundMotherStartGraph) { - if (graph.getFileKey().equals(g.getFileKey())) { - throw new RuntimeException("Only one Start vertex can exist in one file, see file '" + graph.getFileKey() + "'"); - } - } - - // Since the edge does not contain a label, this is a subgraph - // Mark the destination node of the edge to a subgraph starting node - foundSubStartGraph = true; - g.getDest(edge).setSubGraphStartVertexKey(Keywords.SUBGRAPH_START_VERTEX); - g.setLabelKey(g.getDest(edge).getLabelKey()); - logger.debug("Found sub-graph: '" + g.getLabelKey() + "', in file '" + g.getFileKey() + "'"); - logger.debug("Added SUBGRAPH_START_VERTEX to vertex: " + g.getDest(edge).getIndexKey()); - } - } - } - } - - if (graph == null) { - throw new RuntimeException("Did not find a Start vertex with an out edge with a label."); - } - } - - /** - * Look for duplicated vertices in each sub-graph. If a vertex is found, which - * represents the name of the sub-graph (the vertex which the Start vertex - * points to) is duplicated in the same sub-graph, this will lead to an - * infinite recursive loop. - */ - private void checkForDuplicateVerticesInSubgraphs() { - for (int i = 0; i < parsedGraphList.size(); i++) { - Graph g = parsedGraphList.elementAt(i); - - // Exclude the mother graph - if (graph.hashCode() == g.hashCode()) { - continue; - } - - logger.debug("Looking for infinit recursive loop in file: " + g.getFileKey()); - - String subgraph_label = g.getLabelKey(); - Object[] vertices = g.getVertices().toArray(); - for (Object vertice : vertices) { - Vertex v = (Vertex) vertice; - String label = v.getLabelKey(); - if (label.equals(subgraph_label)) { - if (!v.getSubGraphStartVertexKey().isEmpty()) { - continue; - } - if (v.isNoMergeKey()) { - continue; - } - - logger.error("Vertex: " + label + ", with id: " + v.getIndexKey() + ", is a duplicate in a subgraph"); - throw new RuntimeException("Found a subgraph containing a duplicate vertex with name: '" + v.getLabelKey() + "', in file: '" - + g.getFileKey() + "'"); - - } - } - logger.debug("Nope! Did not find any infinit recursive loops."); - } - } - - private void mergeSubgraphs() { - for (int i = 0; i < parsedGraphList.size(); i++) { - Graph g = parsedGraphList.elementAt(i); - - if (graph.hashCode() == g.hashCode()) { - continue; - } - logger.debug("Analysing graph in file: " + g.getFileKey()); - - Object[] vertices = graph.getVertices().toArray(); - for (int j = 0; j < vertices.length; j++) { - Vertex v1 = (Vertex) vertices[j]; - logger.debug("Investigating vertex(" + v1.getIndexKey() + "): '" + v1.getLabelKey() + "'"); - - if (v1.getLabelKey().equals(g.getLabelKey())) { - if (v1.isMergeKey()) { - logger.debug("The vertex is marked MERGE, and will not be replaced by a subgraph."); - continue; - } - if (v1.isNoMergeKey()) { - logger.debug("The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); - continue; - } - if (v1.isMergedMbtKey()) { - logger.debug("The vertex is marked MERGED_BY_MBT, and will not be replaced by a subgraph."); - continue; - } - - logger.debug("A subgraph'ed vertex: '" + v1.getLabelKey() + "' in graph: " + g.getFileKey() - + ", equals a node in the graph in file: '" + graph.getFileKey() + "'"); - - appendGraph(graph, g); - copySubGraphs(graph, g, v1); - - vertices = graph.getVertices().toArray(); - i = -1; - j = -1; - } - } - } - } - - /** - * Merge all vertices marked MERGE - */ - private void mergeVerticesMarked_MERGE() { - Object[] list1 = graph.getVertices().toArray(); - for (Object aList1 : list1) { - Vertex v1 = (Vertex) aList1; - - if (!v1.isMergeKey()) { - continue; - } - - Object[] list2 = graph.getVertices().toArray(); - Vector mergedVertices = new Vector(); - for (Object aList2 : list2) { - Vertex v2 = (Vertex) aList2; - - if (!v1.getLabelKey().equals(v2.getLabelKey())) { - continue; - } - if (v2.isNoMergeKey()) { - continue; - } - if (v1.getIndexKey().equals(v2.getIndexKey())) { - continue; - } - if (mergedVertices.contains(v1)) { - continue; - } - - logger.debug("Merging vertex(" + v1.getIndexKey() + "): '" + v1.getLabelKey() + "' with vertex (" + v2.getIndexKey() + ")"); - - Object[] inEdges = graph.getInEdges(v1).toArray(); - for (Object inEdge : inEdges) { - Edge edge = (Edge) inEdge; - Edge new_edge = new Edge(edge); - new_edge.setIndexKey(getNewVertexAndEdgeIndex()); - graph.addEdge(new_edge, graph.getSource(edge), v2); - } - Object[] outEdges = graph.getOutEdges(v1).toArray(); - for (Object outEdge : outEdges) { - Edge edge = (Edge) outEdge; - Edge new_edge = new Edge(edge); - new_edge.setIndexKey(getNewVertexAndEdgeIndex()); - graph.addEdge(new_edge, v2, graph.getDest(edge)); - } - mergedVertices.add(v1); - } - - if (!mergedVertices.isEmpty()) { - logger.debug("Remvoing merged vertex(" + v1.getIndexKey() + ")"); - graph.removeVertex(v1); - } - } - } - - /** - * Search for any vertices with no in edges - * - * @throws RuntimeException - */ - private void checkForVerticesWithZeroInEdges() throws RuntimeException { - Object[] vs = graph.getVertices().toArray(); - for (Object v1 : vs) { - Vertex v = (Vertex) v1; - if (!v.getLabelKey().equalsIgnoreCase(Keywords.START_NODE)) { - if (graph.getInEdges(v).toArray().length == 0) { - String msg = "No in-edges! " + v + " is not reachable," + " from file: '" + v.getFileKey() + "'"; - logger.error(msg); - throw new RuntimeException(msg); - } - } - } - } - - /** - * Copies the graph src, into the graph dst - * - * @param dst - * @param src - */ - private void appendGraph(Graph dst, Graph src) { - HashMap map = new HashMap(); - Object[] vertices = src.getVertices().toArray(); - for (Object vertice : vertices) { - Vertex v = (Vertex) vertice; - if (v.getLabelKey().equalsIgnoreCase(Keywords.START_NODE)) { - continue; - } - Vertex new_v = new Vertex(v); - new_v.setIndexKey(getNewVertexAndEdgeIndex()); - dst.addVertex(new_v); - logger.debug("Associated vertex: " + v + " to new vertex: " + new_v); - map.put(v.getIndexKey(), new_v); - } - Object[] edges = src.getEdges().toArray(); - for (Object edge : edges) { - Edge e = (Edge) edge; - Vertex v1 = map.get(src.getSource(e).getIndexKey()); - Vertex v2 = map.get(src.getDest(e).getIndexKey()); - if (v1 == null || v2 == null) { - continue; - } - Edge new_e = new Edge(e); - dst.addEdge(new_e, v1, v2); - new_e.setIndexKey(getNewVertexAndEdgeIndex()); - } - } - - /** - * Replaces the vertex targetVertex and all its in and out edges, in the graph - * g, with all other vertices with the same name. - * - * @param mainGraph - * @param subGraph - * @param targetVertex - */ - private void copySubGraphs(Graph mainGraph, Graph subGraph, Vertex targetVertex) { - // Save the target vertex out-edge list - Vector targetVertexOutEdgeList = new Vector(); - logger.debug("Target vertex (" + targetVertex + ") out-edge list"); - for (Edge element : mainGraph.getOutEdges(targetVertex)) { - logger.debug(" " + element); - targetVertexOutEdgeList.add(element); - } - - Vertex sourceVertex = null; - Object[] vertices = mainGraph.getVertices().toArray(); - for (Object vertice : vertices) { - Vertex v = (Vertex) vertice; - if (v.getLabelKey().equals(targetVertex.getLabelKey())) { - if (v.getSubGraphStartVertexKey().isEmpty()) { - continue; - } - if (v.isMergeKey()) { - continue; - } - if (v.isNoMergeKey()) { - continue; - } - if (v.isMergedMbtKey()) { - continue; - } - if (v.getIndexKey().equals(targetVertex.getIndexKey())) { - continue; - } - - sourceVertex = v; - break; - } - } - - if (sourceVertex == null) { - return; - } - - logger.debug("Start merging target vertex: " + targetVertex + " with source vertex: " + sourceVertex); - - Object[] inEdges = mainGraph.getInEdges(sourceVertex).toArray(); - for (Object inEdge : inEdges) { - Edge edge = (Edge) inEdge; - Edge new_edge = new Edge(edge); - mainGraph.addEdge(new_edge, mainGraph.getSource(edge), targetVertex); - new_edge.setIndexKey(getNewVertexAndEdgeIndex()); - } - Object[] outEdges = mainGraph.getOutEdges(sourceVertex).toArray(); - for (Object outEdge : outEdges) { - Edge edge = (Edge) outEdge; - Edge new_edge = new Edge(edge); - mainGraph.addEdge(new_edge, targetVertex, mainGraph.getDest(edge)); - new_edge.setIndexKey(getNewVertexAndEdgeIndex()); - } - logger.debug("Remvoing source vertex: " + sourceVertex); - mainGraph.removeVertex(sourceVertex); - targetVertex.setMergedMbtKey(true); - - // Check if there exists a Stop vertex. - // Also check if there is only one. - Vertex stopVertex = null; - vertices = mainGraph.getVertices().toArray(); - for (Object vertice : vertices) { - Vertex v = (Vertex) vertice; - if (v.getLabelKey().equalsIgnoreCase(Keywords.STOP_NODE)) { - if (stopVertex != null) { - throw new RuntimeException("Found more than 1 Stop vertex in file (Only one Stop vertex per file is allowed): '" - + mainGraph.getFileKey() + "'"); - } - stopVertex = v; - } - } - - // All edges going to the Stop vertex, needs to be merged to the destination - // vertex. - // The destination vertex, is pointed to by the vertex which is expanded by - // the sub graph. - if (stopVertex != null) { - Vector edgesToBeRemoved = new Vector(); - inEdges = mainGraph.getInEdges(stopVertex).toArray(); - - logger.debug("Stop vertex in-edge list"); - for (Edge element : mainGraph.getInEdges(stopVertex)) { - logger.debug(" " + element); - } - logger.debug("Target vertex (" + targetVertex + ") out-edge list"); - for (Edge element : targetVertexOutEdgeList) { - logger.debug(" " + element); - } - - Vector> mergeList = MergeList(targetVertexOutEdgeList.toArray(), inEdges); - for (Pair pair : mergeList) { - MergeOutEdgeAndInEdge(pair.getFirst(), pair.getSecond(), edgesToBeRemoved, mainGraph); - } - - // Now remove the edges that has been copied. - Object[] list = edgesToBeRemoved.toArray(); - for (Object aList : list) { - Edge element = (Edge) aList; - if (mainGraph.containsEdge(element)) { - try { - logger.debug("Removing edge: " + element); - logger.debug(element + ", was found and removed from graph,: '" + mainGraph.getFileKey() + "'"); - mainGraph.removeEdge(element); - } catch (IllegalArgumentException e) { - logger.debug(element + ", was not found in graph: '" + mainGraph.getFileKey() - + "', this is ok, since it probably been removed before. (I know, not ver good progamming practice here)"); - } - } - } - logger.debug("Removing the Stop vertex: " + stopVertex.getIndexKey()); - mainGraph.removeVertex(stopVertex); - } - } - - private Vector> MergeList(Object[] array_A, Object[] array_B) { - logger.debug("Vector twoLists( Object[] array_A, Object[] array_B )"); - Vector> matches = new Vector>(); - logger.debug(" Looking for exact matches"); - for (Object anArray_A : array_A) { - Edge a = (Edge) anArray_A; - String aLabel = a.getLabelKey(); - for (Object anArray_B : array_B) { - Edge b = (Edge) anArray_B; - String bLabel = b.getLabelKey(); - if (aLabel != null && aLabel.length() == 0) { - aLabel = null; - } - if (bLabel != null && bLabel.length() == 0) { - bLabel = null; - } - if (aLabel == null && bLabel == null) { - logger.debug(" adding: " + a + " and " + b); - matches.add(new Pair(a, b)); - } else if (aLabel != null && bLabel != null) { - if (aLabel.equals(bLabel)) { - logger.debug(" adding: " + a + " and " + b); - matches.add(new Pair(a, b)); - } - } - } - } - - Vector> null_matches_from_A_list = new Vector>(); - logger.debug(" Matching nulls from the A list with non-matched items in the second list"); - for (Object anArray_A : array_A) { - Edge a = (Edge) anArray_A; - String aLabel = a.getLabelKey(); - if (aLabel == null || aLabel.length() == 0) { - for (Object anArray_B : array_B) { - Edge b = (Edge) anArray_B; - String bLabel = b.getLabelKey(); - if (bLabel != null) { - boolean alreadyMatched = false; - for (Pair element : matches) { - if (b.equals(element.getSecond())) { - alreadyMatched = true; - break; - } - } - - if (!alreadyMatched) { - logger.debug(" adding: " + a + " and " + b); - null_matches_from_A_list.add(new Pair(a, b)); - } - } - } - } - } - - Vector> null_matches_from_B_list = new Vector>(); - logger.debug(" Matching nulls from the B list with non-matched items in the first list"); - for (Object anArray_B : array_B) { - Edge b = (Edge) anArray_B; - String bLabel = b.getLabelKey(); - if (bLabel == null || bLabel.length() == 0) { - for (Object anArray_A : array_A) { - Edge a = (Edge) anArray_A; - String aLabel = a.getLabelKey(); - if (aLabel != null) { - boolean alreadyMatched = false; - for (Pair element : matches) { - if (a.equals(element.getFirst())) { - alreadyMatched = true; - break; - } - } - - if (!alreadyMatched) { - logger.debug(" adding: " + a + " and " + b); - null_matches_from_B_list.add(new Pair(a, b)); - } - } - } - } - } - matches.addAll(null_matches_from_A_list); - matches.addAll(null_matches_from_B_list); - return matches; - } - - private void MergeOutEdgeAndInEdge(Edge outEdge, Edge inEdge, Vector edgesToBeRemoved, Graph graph) { - logger.debug("MergeOutEdgeAndInEdge"); - - if (outEdge == null) { - throw new RuntimeException("Internal progamming error"); - } - if (inEdge == null) { - throw new RuntimeException("Internal progamming error"); - } - - logger.debug(" outEdge: " + outEdge); - logger.debug(" inEdge: " + inEdge); - - Edge new_edge = new Edge(inEdge, outEdge); - graph.addEdge(new_edge, graph.getSource(inEdge), graph.getDest(outEdge)); - - new_edge.setIndexKey(getNewVertexAndEdgeIndex()); - logger.debug(" Replacing the target vertex out-edge: " + outEdge + " (old) with: " + new_edge + "(new), using: " + inEdge); - - edgesToBeRemoved.add(inEdge); - edgesToBeRemoved.add(outEdge); - } - - /** - * Writes the graph to a PrintStream, using GraphML format. - */ - @Override - public void save(PrintStream ps, boolean printIndex) { - Graph g = getModel(); - - ps.println(""); - ps.println(""); - ps.println(" "); - ps.println(" "); - ps.println(" "); - - for (Vertex v : g.getVertices()) { - ps.println(" "); - ps.println(" "); - - if (!v.getImageKey().isEmpty()) { - ps.println(" "); - ps.println(" "); - } else { - ps.println(" "); - ps.println(" "); - } - - ps.println(" "); - ps.println(" "); - ps.print(" " - + v.getFullLabelKey()); - if (printIndex) { - ps.print(" INDEX=" + v.getIndexKey()); - } - - ps.println(""); - - if (!v.getImageKey().isEmpty()) { - ps.println(" "); - ps.println(" "); - } else { - ps.println(" "); - ps.println(" "); - } - - ps.println(" "); - ps.println(" "); - } - - for (Edge e : g.getEdges()) { - Pair p = graph.getEndpoints(e); - Vertex src = p.getFirst(); - Vertex dest = p.getSecond(); - - ps.println(" "); - ps.println(" "); - ps.println(" "); - ps.println(" "); - ps.println(" "); - ps.println(" "); - ps.println(" "); - ps.println(" "); - ps.println(" "); - ps.println(" "); - ps.println(" "); - - if (!e.getFullLabelKey().isEmpty()) { - String label = e.getFullLabelKey(); - label = label.replaceAll("&", "&"); - label = label.replaceAll("<", "<"); - label = label.replaceAll(">", ">"); - label = label.replaceAll("'", "'"); - label = label.replaceAll("\"", """); - - ps.println(" " + label); - if (printIndex) { - ps.print(" INDEX=" + e.getIndexKey()); - } - ps.println(""); - } - - ps.println(" "); - ps.println(" "); - ps.println(" "); - ps.println(" "); - - } - - ps.println(" "); - ps.println(""); - - } -} diff --git a/src/main/java/org/graphwalker/io/ParseLog.java b/src/main/java/org/graphwalker/io/ParseLog.java deleted file mode 100644 index 56de88be..00000000 --- a/src/main/java/org/graphwalker/io/ParseLog.java +++ /dev/null @@ -1,74 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.io; - -import org.graphwalker.Util; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.Vector; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class ParseLog { - - public static class LoggedItem { - public Integer index = null; - public String data = null; - } - - public static Vector readLog(File logFile) throws IOException { - Vector list = new Vector(); - FileReader reader = null; - try { - reader = new FileReader(logFile); - BufferedReader file = new BufferedReader(reader); - String line; - while ((line = file.readLine()) != null) { - Pattern p = Pattern.compile("INFO - (Vertex|Edge): '(\\S*)', INDEX=(\\d+) "); - Matcher m = p.matcher(line); - if (m.find()) { - LoggedItem item = new LoggedItem(); - item.index = Integer.valueOf(m.group(3)); - if (m.group(1).equals("Vertex")) { - p = Pattern.compile("DATA: (.*)"); - m = p.matcher(line); - if (m.find()) { - item.data = m.group(1); - } - } - list.add(item); - } - } - file.close(); - } catch (IOException e) { - throw e; // TODO: - } finally { - Util.closeQuietly(reader); - } - return list; - } -} diff --git a/src/main/java/org/graphwalker/io/PrintHTMLTestSequence.java b/src/main/java/org/graphwalker/io/PrintHTMLTestSequence.java deleted file mode 100644 index e833a414..00000000 --- a/src/main/java/org/graphwalker/io/PrintHTMLTestSequence.java +++ /dev/null @@ -1,91 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.io; - -import java.io.PrintStream; -import java.util.Vector; - -public class PrintHTMLTestSequence { - - public PrintHTMLTestSequence(Vector testSequence, PrintStream out) { - writeHTML(testSequence, out); - } - - private void writeHTML(Vector testSequence, PrintStream out) { - - header(out); - - int index = 1; - for (String[] string : testSequence) { - - out.println("

"); - out.println(""); - out.println("
"); - out.println("

" + string[0] + "

"); - out.println(""); - - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println("
StepActionExpected Result
" + index++ + "" + string[1] + "" + string[2] + "
"); - out.println("
"); - out.println("

"); - } - - footer(out); - } - - private void header(PrintStream out) { - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println("Test Sequence made by MBT"); - out.println(""); - out.println(""); - out.println(""); - - out.println(""); - } - - private void footer(PrintStream out) { - out.println(""); - out.println(""); - } -} diff --git a/src/main/java/org/graphwalker/machines/ExtendedFiniteStateMachine.java b/src/main/java/org/graphwalker/machines/ExtendedFiniteStateMachine.java deleted file mode 100644 index 3e4b4808..00000000 --- a/src/main/java/org/graphwalker/machines/ExtendedFiniteStateMachine.java +++ /dev/null @@ -1,371 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.machines; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.PrintStream; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Set; -import java.util.Stack; -import java.util.Map.Entry; - -import javax.script.Bindings; -import javax.script.ScriptContext; -import javax.script.ScriptEngine; -import javax.script.ScriptEngineManager; -import javax.script.ScriptException; - -import org.apache.log4j.Logger; -import org.graphwalker.Util; -import org.graphwalker.exceptions.FoundNoEdgeException; -import org.graphwalker.exceptions.InvalidDataException; -import org.graphwalker.filters.AccessableEdgeFilter; -import org.graphwalker.graph.Edge; - -import bsh.EvalError; -import bsh.Interpreter; -import bsh.NameSpace; -import bsh.Primitive; -import bsh.UtilEvalError; - -public class ExtendedFiniteStateMachine extends FiniteStateMachine { - - private PrintStream Void; - - private static Logger logger = Util.setupLogger(ExtendedFiniteStateMachine.class); - - private Interpreter beanShellEngine = null; - private AccessableEdgeFilter accessableFilter; - - private ScriptEngineManager mgr = null; - private ScriptEngine jsEngine = null; - - private Stack namespaceStack; - - private PrintStream oldPrintStream; - - public ExtendedFiniteStateMachine(boolean usingJsEngine) { - super(); - namespaceStack = new Stack(); - if (usingJsEngine) { - mgr = new ScriptEngineManager(); - jsEngine = mgr.getEngineByExtension("js"); - accessableFilter = new AccessableEdgeFilter(jsEngine); - } else { - beanShellEngine = new Interpreter(); - accessableFilter = new AccessableEdgeFilter(beanShellEngine); - } - Void = new VoidPrintStream(); - } - - public void eval(String script) { - if (jsEngine != null) { - try { - jsEngine.eval(script); - } catch (ScriptException e) { - logger.error("Problem when running: '" + script + "' in BeanShell"); - logger.error("EvalError: " + e); - logger.error(e.getCause()); - throw new RuntimeException("Execution of startup script generated an error.", e); - } - } else if (beanShellEngine != null) { - try { - beanShellEngine.eval(script); - } catch (EvalError e) { - logger.error("Problem when running: '" + script + "' in BeanShell"); - logger.error("EvalError: " + e); - logger.error(e.getCause()); - throw new RuntimeException("Execution of startup script generated an error.", e); - } - } - } - - @Override - public String getCurrentVertexName() { - return super.getCurrentVertexName() + (hasInternalVariables() ? "/" + getCurrentDataString() : ""); - } - - @Override - public Set getCurrentOutEdges() throws FoundNoEdgeException { - Set retur = super.getCurrentOutEdges(); - for (Iterator i = retur.iterator(); i.hasNext();) { - Edge e = i.next(); - if (!accessableFilter.acceptEdge(getModel(), e)) { - logger.debug("Not accessable: " + e + " from " + getCurrentVertexName()); - i.remove(); - } else { - logger.debug("Accessable: " + e + " from " + getCurrentVertexName()); - } - } - if (retur.size() == 0) { - throw new FoundNoEdgeException("Cul-De-Sac, dead end found in '" + getCurrentVertex() + "'"); - } - return retur; - } - - @Override - public boolean hasInternalVariables() { - if (jsEngine != null) { - return !jsEngine.getBindings(ScriptContext.ENGINE_SCOPE).isEmpty(); - } else if (beanShellEngine != null) { - return beanShellEngine.getNameSpace().getVariableNames().length > 1; - } - return false; - } - - public Set> getCurrentJsEngineData() { - Bindings bindings = jsEngine.getBindings(ScriptContext.ENGINE_SCOPE); - return bindings.entrySet(); - } - - public Hashtable getCurrentBeanShellData() { - Hashtable retur = new Hashtable(); - if (!hasInternalVariables()) - return retur; - - int i = 0; - NameSpace ns = beanShellEngine.getNameSpace(); - String[] variableNames = beanShellEngine.getNameSpace().getVariableNames(); - try { - for (; i < variableNames.length; i++) { - if (!variableNames[i].equals("bsh")) { - retur.put(variableNames[i], Primitive.unwrap(ns.getVariable(variableNames[i]))); - } - } - } catch (UtilEvalError e) { - throw new RuntimeException("Malformed model data: " + variableNames[i] + "\nBeanShell error message: '" + e.getMessage() + "'"); - } catch (NullPointerException e) { - logger.warn("Did not get data/value for: " + variableNames[i]); - return retur; - } - return retur; - } - - /** - * Walks the data space, and return the value of the data, if found. - * - * @param dataName - * @return - * @throws InvalidDataException - * is thrown if the data is not found in the data space - */ - public String getDataValue(String dataName) { - if (jsEngine != null) { - return jsEngine.get(dataName).toString(); - } else if (beanShellEngine != null) { - Hashtable dataTable = getCurrentBeanShellData(); - if (dataTable.containsKey(dataName)) { - if (dataTable.get(dataName) instanceof Object[]) { - return Arrays.deepToString((Object[]) dataTable.get(dataName)); - } else { - return dataTable.get(dataName).toString(); - } - } - } - return ""; - } - - /** - * Executes an action, and returns any outcome as a string. - * - * @param action - * @return - * @throws InvalidDataException - * is thrown if the data is not found in the data space - */ - public String execAction(String action) throws InvalidDataException { - logger.debug("Will try to execute: " + action); - Object res = null; - if (jsEngine != null) { - try { - res = jsEngine.eval(action); - } catch (ScriptException e) { - throw new InvalidDataException("The action: '" + action + "', does not evaluate correctly. Detail: " + e.getMessage()); - } - } else if (beanShellEngine != null) { - try { - res = beanShellEngine.eval(action); - } catch (EvalError e) { - throw new InvalidDataException("The action: '" + action + "', does not evaluate correctly. Detail: " + e.getMessage()); - } - } - return res.toString(); - } - - @Override - public String getCurrentDataString() { - String retur = ""; - - if (jsEngine != null) { - Set> dataTable = getCurrentJsEngineData(); - for (Entry entry : dataTable) { - if (!entry.getKey().equals("println") && !entry.getKey().equals("print") && !entry.getKey().equals("context")) - retur += entry.getKey() + "=" + entry.getValue() + ";"; - } - } else if (beanShellEngine != null) { - Hashtable dataTable = getCurrentBeanShellData(); - Enumeration e = dataTable.keys(); - while (e.hasMoreElements()) { - String key = e.nextElement(); - String data = ""; - if (dataTable.get(key) instanceof Object[]) { - data = Arrays.deepToString((Object[]) dataTable.get(key)); - } else { - data = dataTable.get(key).toString(); - } - retur += key + "=" + data + ";"; - } - } - return retur; - } - - @Override - public boolean walkEdge(Edge edge) { - boolean hasWalkedEdge = super.walkEdge(edge); - if (hasWalkedEdge) { - if (hasAction(edge)) { - PrintStream ps = System.out; - System.setOut(Void); - - if (jsEngine != null) { - try { - jsEngine.eval(getAction(edge)); - } catch (ScriptException e) { - logger.error("Problem when running: '" + getAction(edge) + "' in Java Script engine"); - logger.error("EvalError: " + e); - logger.error(e.getCause()); - throw new RuntimeException("Malformed action sequence\n\t" + edge + "\n\tAction sequence: " + edge.getActionsKey() - + "\n\tJava Script error message: '" + e.getMessage() + "'\nDetails: " + e.getCause()); - } finally { - System.setOut(ps); - } - } else if (beanShellEngine != null) { - try { - beanShellEngine.eval(getAction(edge)); - } catch (EvalError e) { - logger.error("Problem when running: '" + getAction(edge) + "' in BeanShell"); - logger.error("EvalError: " + e); - logger.error(e.getCause()); - throw new RuntimeException("Malformed action sequence\n\t" + edge + "\n\tAction sequence: " + edge.getActionsKey() - + "\n\tBeanShell error message: '" + e.getMessage() + "'\nDetails: " + e.getCause()); - } finally { - System.setOut(ps); - } - } - } - } - return hasWalkedEdge; - } - - private String getAction(Edge edge) { - return (edge == null ? "" : edge.getActionsKey()); - } - - private boolean hasAction(Edge edge) { - return (edge == null ? false : !edge.getActionsKey().isEmpty()); - } - - @Override - protected void track() { - super.track(); - if (jsEngine != null) { - } else if (beanShellEngine != null) { - namespaceStack.push(new CannedNameSpace(beanShellEngine.getNameSpace())); - } - } - - @Override - protected void popVertex() { - super.popVertex(); - if (jsEngine != null) { - } else if (beanShellEngine != null) { - beanShellEngine.setNameSpace((namespaceStack.pop()).unpack()); - } - } - - private class CannedNameSpace { - byte[] store; - - public CannedNameSpace(NameSpace objNameSpace) { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos; - try { - oos = new ObjectOutputStream(baos); - oos.writeObject(objNameSpace); - } catch (IOException e) { - throw new RuntimeException("Unable to store backtrack information due to a IOException.", e); - } - store = baos.toByteArray(); - } - - public NameSpace unpack() { - ByteArrayInputStream bais = new ByteArrayInputStream(store); - ObjectInputStream ois; - try { - ois = new ObjectInputStream(bais); - return (NameSpace) ois.readObject(); - } catch (IOException e) { - throw new RuntimeException("Unable to restore backtrack information due to a IOException.", e); - } catch (ClassNotFoundException e) { - throw new RuntimeException("Unable to restore backtrack information as the NameSpace Class could not be found.", e); - } - } - } - - @Override - public void setCalculatingPath(boolean calculatingPath) { - super.setCalculatingPath(calculatingPath); - if (calculatingPath && this.oldPrintStream != System.out) { - this.oldPrintStream = System.out; - System.setOut(new VoidPrintStream()); - } else if (!calculatingPath && this.oldPrintStream != System.out) { - System.setOut(this.oldPrintStream); - } - } - - private class VoidPrintStream extends PrintStream { - public VoidPrintStream() { - super(System.out); - } - - @Override - public void write(byte[] buf, int off, int len) { - } - } - - public boolean isJsEnabled() { - return jsEngine != null; - } - - public boolean isBeanShellEnabled() { - return beanShellEngine != null; - } -} \ No newline at end of file diff --git a/src/main/java/org/graphwalker/machines/FiniteStateMachine.java b/src/main/java/org/graphwalker/machines/FiniteStateMachine.java deleted file mode 100644 index 5841db7a..00000000 --- a/src/main/java/org/graphwalker/machines/FiniteStateMachine.java +++ /dev/null @@ -1,686 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.machines; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Map.Entry; -import java.util.Set; -import java.util.Stack; -import java.util.Vector; - -import org.apache.log4j.Logger; -import org.graphwalker.Keywords; -import org.graphwalker.Util; -import org.graphwalker.exceptions.FoundNoEdgeException; -import org.graphwalker.graph.AbstractElement; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; - -/** - * @author Johan Tejle - * - */ -public class FiniteStateMachine { - - private static Logger logger = Util.setupLogger(FiniteStateMachine.class); - - private Graph model = null; - private Vertex currentVertex = null; - private boolean weighted = false; - private Edge lastEdge = null; - private Stack edgeStack; - private Stack vertexStore; - private int numberOfEdgesTravesed = 0; - private HashMap reqs = new HashMap(); - private boolean calculatingPath = false; - private int numOfCoveredEdges = 0; - private int numOfCoveredVertices = 0; - - private long start_time; - - private Hashtable associatedRequirements; - - public int getNumOfCoveredEdges() { - return numOfCoveredEdges; - } - - public int getNumOfCoveredVertices() { - return numOfCoveredVertices; - } - - public void setVertex(String vertexName) { - logger.debug("Setting vertex to: '" + vertexName + "'"); - Vertex e = model.findVertex(vertexName); - Util.AbortIf(e == null, "Vertex not Found: '" + vertexName + "'"); - - currentVertex = e; - setAsVisited(e); - } - - public AbstractElement findElement(Integer index) { - for (Vertex vertex : model.getVertices()) { - if (vertex.getIndexKey().equals(index)) { - return vertex; - } - } - for (Edge edge : model.getEdges()) { - if (edge.getIndexKey().equals(index)) { - return edge; - } - } - return null; - } - - public boolean hasVertex(String vertexName) { - return model.findVertex(vertexName) != null; - } - - public Edge findEdge(String edgeName) { - for (Edge edge : model.getEdges()) { - if ((edge.getLabelKey()).equals(edgeName)) { - return edge; - } - } - return null; - } - - public FiniteStateMachine() { - logger.debug("Initializing"); - edgeStack = new Stack(); - start_time = System.currentTimeMillis(); - } - - public void setModel(Graph model) { - reset(); - this.model = model; - setVertex(Keywords.START_NODE); - } - - public Vertex getCurrentVertex() { - return currentVertex; - } - - public Vertex getStartVertex() { - for (Vertex vertex : model.getVertices()) { - if (vertex.getLabelKey().equals(Keywords.START_NODE)) { - return vertex; - } - } - return null; - } - - public String getLastEdgeName() { - return lastEdge.getLabelKey(); - } - - public String getCurrentVertexName() { - return currentVertex.getLabelKey(); - } - - public Collection getAllVertices() { - return model.getVertices(); - } - - public Collection getAllEdges() { - return model.getEdges(); - } - - public Collection getAllEdgesExceptStartEdge() { - Vector list = new Vector(model.getEdges()); - Edge e = (Edge) model.getOutEdges(getStartVertex()).toArray()[0]; - list.remove(e); - return list; - } - - public Set getCurrentOutEdges() throws FoundNoEdgeException { - Set retur = new HashSet(model.getOutEdges(currentVertex)); - if (retur.size() == 0) { - throw new FoundNoEdgeException("Cul-De-Sac, dead end found in '" + getCurrentVertex() + "'"); - } - return retur; - } - - public void setAsVisited(AbstractElement e) { - if (e instanceof Edge) { - if (e.getVisitedKey() < 1) { - numOfCoveredEdges++; - } - } else if (e instanceof Vertex) { - if (e.getVisitedKey() < 1) { - numOfCoveredVertices++; - } - } - - e.setVisitedKey(e.getVisitedKey() + 1); - - if (!e.getReqTagKey().isEmpty()) { - Hashtable reqs = getAllRequirements(); - String[] tags = e.getReqTagKey().split(","); - for (String tag : tags) { - reqs.put(tag, reqs.get(tag) + 1); - } - } - } - - public void setAsUnvisited(AbstractElement e) { - Integer visits = e.getVisitedKey(); - e.setVisitedKey(e.getVisitedKey() - 1); - if (e instanceof Edge) { - if (e.getVisitedKey() < 1) { - numOfCoveredEdges--; - } - } else if (e instanceof Vertex) { - if (e.getVisitedKey() < 1) { - numOfCoveredVertices--; - } - } - - if (visits <= 0) - logger.error(e + ", has a negative number in VISITED_KEY"); - - if (!e.getReqTagKey().isEmpty()) { - Hashtable reqs = getAllRequirements(); - String[] tags = e.getReqTagKey().split(","); - for (String tag : tags) { - reqs.put(tag, reqs.get(tag) - 1); - } - } - } - - public void walkPath(Stack path) { - for (Edge edge : path) { - walkEdge(edge); - } - } - - public boolean walkEdge(Edge edge) { - if (model.isSource(currentVertex, edge)) { - lastEdge = edge; - if (isBacktrackPossible()) { - track(); - } - - currentVertex = model.getDest(edge); - setAsVisited(lastEdge); - setAsVisited(currentVertex); - numberOfEdgesTravesed++; - logger.debug("No. of walked edges: " + numberOfEdgesTravesed); - return true; - } else { - logger.error(edge + ", is not the source of: " + currentVertex); - } - return false; - } - - public Edge getLastEdge() { - return lastEdge; - } - - public void setLastEdge(Edge e) { - lastEdge = e; - } - - public String getStatisticsStringCompact() { - int stats[] = getStatistics(); - int e = stats[0]; - int ec = stats[1]; - int v = stats[2]; - int vc = stats[3]; - int len = stats[4]; - int req = stats[5]; - int reqc = stats[6]; - - return (req > 0 ? "RC: " + reqc + "/" + req + " => " + (100 * reqc) / req + "% " : "") + "EC: " + ec + "/" + e + " => " + (100 * ec) - / e + "% " + "SC: " + vc + "/" + v + " => " + (100 * vc) / v + "% " + "L: " + len; - } - - public String getStatisticsString() { - int stats[] = getStatistics(); - int e = stats[0]; - int ec = stats[1]; - int v = stats[2]; - int vc = stats[3]; - int len = stats[4]; - int req = stats[5]; - int reqc = stats[6]; - - String str = ""; - if (e > 0 && v > 0) { - str = "Coverage Edges: " + ec + "/" + e + " => " + (100 * ec) / e + "%\n" + "Coverage Vertices: " + vc + "/" + v + " => " - + (100 * vc) / v + "%\n" + "Unvisited Edges: " + (e - ec) + "\n" + "Unvisited Vertices: " + (v - vc) + "\n" - + "Test sequence length: " + len; - } else if (req > 0) { - str = "Coverage Requirements: " + reqc + "/" + req + " => " + (100 * reqc) / req + "%\n"; - } else { - str = "No statistics available. Probably no run made?"; - } - return str; - } - - public int[] getStatistics() { - Collection e = model.getEdges(); - Collection v = model.getVertices(); - - int[] retur = { e.size(), getEdgeCoverage(e), v.size(), getVertexCoverage(v), numberOfEdgesTravesed, getAllRequirements().size(), - getCoveredRequirements().size() }; - return retur; - } - - public Boolean getValueFromReqs(String key) { - return reqs.get(key); - } - - public void setValueForReq(String key, Boolean b) { - reqs.put(key, b); - } - - /** - * This method returns all requirements and its values as a hashmap - * - * @return reqs hashmap containing requirement name as the key, and - * requirement status as the value - */ - public HashMap getReqs() { - return reqs; - } - - /** - * This method initiates and populates the hashmap reqs, with all requirements - * in the graph. There are two types of requirements: Ordinary and Variable. - * All of them are fetched by calling getReqTagKey for all the edges and - * vertexes in the graph The Ordinary requirements are directly put into the - * reqs hashmap. The Variable requirements are used as a lookup in the list of - * all the variable values returned by getAllVariableValues and the value - * matching the the Variable requirement are splitted with colon and put as - * keys into the reqs hashmap. The value for each entity in the reqs hashmap - * will be set to null, since no requirement are tested yet. Its never needed - * to call this method more than once. - */ - public void populateReqHashMap() { - reqs = new HashMap(); - Hashtable reqsVariables = getAllVariableValues(); - - for (Edge edge : model.getEdges()) { - String reqTag = edge.getReqTagKey(); - if (reqTag.length() == 0) - continue; - String[] tmp = reqTag.split(","); - for (int i = 0; i < tmp.length; i++) { - if (tmp[i].matches("[$][{].*[}]")) { - String[] reqNames = reqsVariables.get(tmp[i].substring(2, tmp[i].length() - 1)).split(":"); - for (String reqVar : reqNames) - this.reqs.put(reqVar, null); - } else - this.reqs.put(tmp[i], null); - } - } - for (Vertex vertex : model.getVertices()) { - String reqTag = vertex.getReqTagKey(); - if (reqTag.length() == 0) - continue; - String[] tmp = reqTag.split(","); - for (int i = 0; i < tmp.length; i++) { - if (tmp[i].matches("[$][{].*[}]")) { - String savedReq = reqsVariables.get(tmp[i].substring(2, tmp[i].length() - 1)); - if (savedReq == null) - continue; - String[] reqNames = savedReq.split(":"); - for (String reqVar : reqNames) - this.reqs.put(reqVar, null); - } else - this.reqs.put(tmp[i], null); - } - } - } - - public String getStatisticsVerbose() { - String retur = ""; - String newLine = "\n"; - Vector notCovered = new Vector(); - - for (Edge edge : model.getEdges()) { - if (edge.getVisitedKey() <= 0) { - notCovered.add("Edge not reached: " + edge + newLine); - } - } - for (Vertex vertex : model.getVertices()) { - if (vertex.getVisitedKey() <= 0) { - notCovered.add("Vertex not reached: " + vertex + newLine); - } - } - if (notCovered.size() > 0) { - Collections.sort(notCovered); - for (String string : notCovered) { - retur += string; - } - } - - Iterator> it = reqs.entrySet().iterator(); - while (it.hasNext()) { - Entry pairs = it.next(); - - if (pairs.getValue() == null) { - retur += "Requirement: " + pairs.getKey() + " is not tested." + newLine; - continue; - } - if (pairs.getValue().booleanValue() == true) { - retur += "Requirement: " + pairs.getKey() + " has passed." + newLine; - continue; - } - if (pairs.getValue().booleanValue() == false) { - retur += "Requirement: " + pairs.getKey() + " has failed." + newLine; - continue; - } - } - - retur += getStatisticsString() + newLine; - retur += "Execution time: " + ((System.currentTimeMillis() - start_time) / 1000) + " seconds"; - return retur; - } - - /** - * This method finds and returns all the strings found in the graph used to - * give a variable its value. Each found string will be splitted with comma - * and the results will be treated as unique values. For example In graph: - * reqtag1 = "REQ1" + ",REQ2," reqtag1 = reqtag1 + "REQ3" reqtag2 = - * "REQ3,REQ4" reqtag3 = "RE" + "Q5," reqtag4 = - * getValueFromExternalFunction("REQ6"); - * - * @return Hashmap with the variable name as key, and a string containing 1 to - * many colon separated values, as the value For example In HashMap - * ({key,value} { reqtag1,"REQ1:REQ2:REQ3" reqtag2,"REQ3:REQ4" - * reqtag3,"RE:Q5" reqtag4,"REQ6" - */ - public Hashtable getAllVariableValues() { - - Hashtable varVal = new Hashtable(); - - Vector abstractElements = new Vector(); - abstractElements.addAll(getAllVertices()); - abstractElements.addAll(getAllEdges()); - - for (AbstractElement abstractElement : abstractElements) { - String actionkey = abstractElement.getActionsKey(); - if (!actionkey.isEmpty()) { - String[] tags = actionkey.split(";"); - for (int j = 0; j < tags.length; j++) { - if (!tags[j].contains("=")) - continue; - String[] variableAndValue = tags[j].split("="); - variableAndValue[0] = variableAndValue[0].replaceAll("[ ]*", ""); - while (variableAndValue[1].contains("\"")) { - - String[] splittedValue = variableAndValue[1].split("\"", 3); - String[] reqs = splittedValue[1].split(","); - for (String s : reqs) { - - if (s.length() == 0) - continue; - // fetching previously stored values for this variable - String tmpVal = varVal.get(variableAndValue[0]); - String newValue; - if (tmpVal == null) { - newValue = s; - } else - newValue = tmpVal + ":" + s; - - varVal.put(variableAndValue[0], newValue); - } - variableAndValue[1] = splittedValue[2]; - } - } - } - } - return varVal; - } - - public boolean isCurrentVertex(Vertex vertex) { - if (getCurrentVertex() != null) - return getCurrentVertex().equals(vertex); - return false; - } - - private int getVertexCoverage(Collection modelItems) { - int unique = 0; - - for (Vertex vertex : modelItems) { - if (vertex.getVisitedKey() > 0) { - unique++; - } - } - return unique; - } - - private int getEdgeCoverage(Collection modelItems) { - int unique = 0; - - for (Edge edge : modelItems) { - if (edge.getVisitedKey() > 0) { - unique++; - } - } - return unique; - } - - public Hashtable getAllRequirements() { - if (associatedRequirements == null) { - associatedRequirements = new Hashtable(); - - Vector abstractElements = new Vector(); - abstractElements.addAll(getAllVertices()); - abstractElements.addAll(getAllEdges()); - - for (AbstractElement abstractElement : abstractElements) { - String reqtags = abstractElement.getReqTagKey(); - if (!reqtags.isEmpty()) { - String[] tags = reqtags.split(","); - for (String tag : tags) { - associatedRequirements.put(tag, 0); - } - } - } - } - return associatedRequirements; - } - - @SuppressWarnings("unchecked") - public Set getCoveredRequirements() { - Vector notCoveredValues = new Vector(); - notCoveredValues.add(0); - Hashtable allRequirements = (Hashtable) getAllRequirements().clone(); - allRequirements.values().removeAll(notCoveredValues); - return allRequirements.keySet(); - } - - public String getEdgeName(Edge edge) { - if (edge.getParameterKey().isEmpty()) { - return edge.getLabelKey(); - } - - return edge.getLabelKey() + " " + edge.getParameterKey(); - } - - public void storeVertex() { - if (this.vertexStore == null) - this.vertexStore = new Stack(); - this.vertexStore.push(edgeStack.size()); - } - - public void restoreVertex() { - if (this.vertexStore == null || this.vertexStore.size() == 0) - throw new RuntimeException("Nothing to restore"); - int prevVertex = this.vertexStore.pop(); - if (prevVertex > edgeStack.size()) - throw new RuntimeException("Cannot restore vertex from backtrack"); - while (prevVertex < edgeStack.size()) { - popVertex(); - } - } - - protected void track() { - edgeStack.push(getLastEdge()); - } - - protected void popVertex() { - setAsUnvisited(getLastEdge()); - setAsUnvisited(getCurrentVertex()); - - edgeStack.pop(); - if (lastEdge == null) { - setVertex(Keywords.START_NODE); - } else { - currentVertex = model.getSource(lastEdge); - } - lastEdge = (edgeStack.size() > 0 ? edgeStack.peek() : null); - numberOfEdgesTravesed--; - } - - /** - * @param weighted - * if edge weights are to be considered - */ - public void setWeighted(boolean weighted) { - this.weighted = weighted; - } - - /** - * @return true if the edge weights is considered - */ - public boolean isWeighted() { - return weighted; - } - - /** - * @return the number of edges traversed - */ - public int getNumberOfEdgesTravesed() { - return numberOfEdgesTravesed; - } - - public boolean isBacktrackPossible() { - return isCalculatingPath(); - } - - public boolean isCalculatingPath() { - return calculatingPath; - } - - public void setCalculatingPath(boolean calculatingPath) { - this.calculatingPath = calculatingPath; - } - - /** - * This functions returns a list of edges, which has not yet been covered - * - * @return - */ - public Vector getUncoveredEdges() { - Vector retur = new Vector(); - for (Edge edge : getAllEdges()) { - if (edge.getVisitedKey() <= 0) { - retur.add(edge); - } - } - return retur; - } - - /** - * This functions returns a list of edges, which has been covered - * - * @return - */ - public Vector getCoveredEdges() { - Vector retur = new Vector(getAllEdges()); - retur.removeAll(getUncoveredEdges()); - return retur; - } - - public Vector getUncoveredVertices() { - Vector retur = new Vector(); - for (Vertex vertex : getAllVertices()) { - if (vertex.getVisitedKey() <= 0) { - retur.add(vertex); - } - } - return retur; - } - - public Vector getCoveredVertices() { - Vector retur = new Vector(getAllVertices()); - retur.removeAll(getUncoveredVertices()); - return retur; - } - - public Vector getUncoveredElements() { - Vector retur = new Vector(getUncoveredEdges()); - retur.addAll(getUncoveredVertices()); - return retur; - } - - public Vector getCoveredElements() { - Vector retur = new Vector(getCoveredEdges()); - retur.addAll(getCoveredVertices()); - return retur; - } - - public Graph getModel() { - return model; - } - - public String getCurrentDataString() { - return ""; - } - - public boolean hasInternalVariables() { - return false; - } - - private void reset() { - numberOfEdgesTravesed = 0; - calculatingPath = false; - numOfCoveredEdges = 0; - numOfCoveredVertices = 0; - } - - public void setVertex(Vertex vertex) { - currentVertex = vertex; - } - - public void setAllUnvisited() { - logger.debug("setAllUnvisited"); - reset(); - for (Vertex vertex : model.getVertices()) { - vertex.setVisitedKey(0); - } - for (Edge edge : model.getEdges()) { - edge.setVisitedKey(0); - } - } -} diff --git a/src/main/java/org/graphwalker/multipleModels/ModelAPI.java b/src/main/java/org/graphwalker/multipleModels/ModelAPI.java deleted file mode 100644 index ab89d6ea..00000000 --- a/src/main/java/org/graphwalker/multipleModels/ModelAPI.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.graphwalker.multipleModels; - -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.generators.PathGenerator; - -/** - * @author krikar Any test should extend this class. - */ -public class ModelAPI { - private ModelBasedTesting mbt = null; - - public ModelAPI(String model, boolean efsm, PathGenerator generator, boolean weight) { - mbt = new ModelBasedTesting(); - mbt.readGraph(model); - mbt.enableExtended(efsm); - mbt.setGenerator(generator); - mbt.setWeighted(weight); - } - - public void setMbt(ModelBasedTesting mbt) { - this.mbt = mbt; - } - - public ModelBasedTesting getMbt() { - return mbt; - } -} \ No newline at end of file diff --git a/src/main/java/org/graphwalker/multipleModels/ModelHandler.java b/src/main/java/org/graphwalker/multipleModels/ModelHandler.java deleted file mode 100644 index d690276b..00000000 --- a/src/main/java/org/graphwalker/multipleModels/ModelHandler.java +++ /dev/null @@ -1,411 +0,0 @@ -/* - * The MIT License - * - * Copyright 2011 krikar. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package org.graphwalker.multipleModels; - -import java.util.ArrayList; -import java.util.Random; - -import org.apache.log4j.Logger; -import org.graphwalker.Keywords; -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.Util; -import org.graphwalker.conditions.NeverCondition; -import org.graphwalker.generators.RandomPathGenerator; -import org.graphwalker.graph.Graph; - -/** - * The ModelHandler handles multiple models. The basic workflow using this class - * is: - * - *
- * ModelHandler modelhandler = new ModelHandler();
- * ModelBasedTesting a = Util.getNewMbtFromXml(Util.getFile("A.xml"));
- * ModelBasedTesting b = Util.getNewMbtFromXml(Util.getFile("B.xml"));
- * ModelBasedTesting c = Util.getNewMbtFromXml(Util.getFile("C.xml"));
- * modelhandler.add("A", a, new Model_A_API());
- * modelhandler.add("B", b, new Model_B_API());
- * modelhandler.add("C", c, new Model_C_API());
- * modelhandler.execute("A");
- * 
- * - * New keywords and datum is introduced to handle multiple models. A model can - * now switch execution into another model using the keyword - * {@link Keywords#SWITCH_MODEL SWITCH_MODEL}. This means that the current model - * is paused, and any other loaded model(s) with the same - * {@link Keywords#GRAPH_VERTEX GRAH_VERTEX} is a candidate to switch into. Also - * the current paused model can be resumed. - * - * The executions ends when all models has reached their stop criteria. - * - * @see SWITCH_MODEL - * @see GRAPH_VERTEX - * - * @author Kristian Karl - */ -public class ModelHandler { - - static Logger logger = Util.setupLogger(ModelHandler.class); - ArrayList models = new ArrayList(); - static private Random random = new Random(); - private String currentVertex; - - private static class ModelRunnable implements Runnable { - - private String name; - private ModelBasedTesting mbt; - private Object modelAPI; - private boolean executionRestarted = false; - private boolean crashed = false; - - public ModelRunnable(String name, ModelAPI modelAPI) { - this.name = name; - this.mbt = modelAPI.getMbt(); - this.modelAPI = modelAPI; - } - - @Override - public void run() { - try { - logger.debug("Will start executing the model: " + this.mbt.getGraph()); - mbt.executePath(modelAPI); - } catch (Exception e) { - crashed = true; - Util.logStackTraceToError(e); - } - } - - public String getName() { - return name; - } - - public ModelBasedTesting getMbt() { - return mbt; - } - - public boolean isCrashed() { - return crashed; - } - - public boolean isExecutionRestarted() { - return executionRestarted; - } - - public void setExecutionRestarted(boolean executionRestarted) { - logger.debug("Will change executionRestarted from: " + this.executionRestarted + ", to: " + executionRestarted); - this.executionRestarted = executionRestarted; - } - } - - /** - * @return All models currently loaded. - */ - public ArrayList getModels() { - return models; - } - - /** - * Adds a model to the handler. - * - * @param name - * The name of the model. This is not the same as the name of the - * {@link Graph#getLabelKey() graph}. It's a logical name of the - * model, and it may not already be used by the handler. - * @param modelAPI - */ - public synchronized void add(String name, ModelAPI modelAPI) { - if (hasModel(name)) { - throw new IllegalArgumentException("The model name " + name + " has already been used."); - } - logger.debug("Adding the model: " + Integer.toHexString(System.identityHashCode(modelAPI.getMbt())) + ", " - + modelAPI.getMbt().getGraph()); - modelAPI.getMbt().setMultiModelHandler(this); - models.add(new ModelRunnable(name, modelAPI)); - } - - /** - * Removed a model from the handler. - * - * @param model - * Removes the specified model from the handler. - */ - public void remove(ModelRunnable model) { - models.remove(model); - } - - /** - * Removed a model from the handler. - * - * @param index - * Removes the specified model by index from the handler. - */ - public void remove(long index) { - models.remove((int) index); - } - - /** - * Starts executing the models. The execution is finished when all the models - * stop criteria are reached. - * - * @param name - * The logical name of the model which will start the execution. - * @throws InterruptedException - */ - public void execute(String name) throws InterruptedException { - if (!hasModel(name)) { - throw new IllegalArgumentException("The model name " + name + " does not exist in the model handler. Have you forgotten to add it?"); - } - - ModelRunnable model = getModel(name); - - // Start running the first model - Thread t = new Thread(model); - t.start(); - - // Enter main loop - while (true) { - waitForModelToDoSomething(model); - - // As long as we have any running model, let them run until finished or - // paused. - while (isAnyModelRunning()) { - Thread.sleep(10); - } - logger.debug("No model is running."); - - // If all models are finished, then exit - if (isAllModelsDone()) { - break; - } - logger.debug("Not all models has reached their desired stop conditions."); - - // Now, find models with matching vertex name. - // If the model is paused, the current vertex is matched. - // If the model is not started, the graph name is matched. - ArrayList pausedAndNotStartedModels = getModelMatchingCurrentVertex(); - if (pausedAndNotStartedModels.isEmpty()) { - logger.debug("Did not find any models, matching the current vertex: " + currentVertex); - logger.debug(getStatistics()); - break; - } - - // Run the model, but check for it's state. The model is either - // suspended or not started. - int selectModel = random.nextInt(pausedAndNotStartedModels.size()); - model = pausedAndNotStartedModels.get(selectModel); - logger.debug("Number of models to select from: " + pausedAndNotStartedModels.size()); - logger.debug("Selecting model(" + selectModel + ") " + model.getName()); - if (model.getMbt().isSuspended()) { - model.getMbt().resume(); - } else { - t = new Thread(model); - t.start(); - } - } - } - - /** - * Wait for the model to enter a running, paused or stopped state - * - * @param model - * @throws InterruptedException - */ - private void waitForModelToDoSomething(ModelRunnable model) throws InterruptedException { - while (true) { - check4Crash(model); - if (model.getMbt().isRunning()) { - break; - } else if (model.getMbt().isSuspended()) { - break; - } else if (!model.getMbt().hasNextStep()) { - break; - } - Thread.sleep(10); - } - } - - /** - * Searches for any model with matching vertex name. If the model is paused, - * the current vertex is matched. If the model is not started, the graph name - * is matched. - * - * @param v - * The vertex to match - * @return an array of models that matches - */ - private ArrayList getModelMatchingCurrentVertex() { - logger.debug("Looking for paused or not started model matching current vertex: " + currentVertex); - ArrayList array = new ArrayList(); - for (ModelRunnable model : models) { - logger.debug("Examining model: " + model.getName()); - logger.debug(" Current vertex of graph: " + model.getMbt().getCurrentVertex()); - - check4Crash(model); - - if (model.getMbt().getGraph().getLabelKey().equals(currentVertex) - || model.getMbt().getCurrentVertex().getLabelKey().equals(currentVertex)) { - logger.debug(" " + model.getName() + ", has matching graph or current vertex label"); - if (model.getMbt().hasNotStartedExecution()) { - logger.debug(" Adding not started model: " + model.getName()); - array.add(model); - } else if (model.getMbt().isSuspended()) { - if (model.getMbt().isCulDeSac()) { - logger.debug(" Model has ended up in a Cul-de-Sac"); - if (!model.getMbt().hasNextStep()) { - logger.debug(" Model has reached it's stop condition, so restarting model and resetting current vertex to Start: " - + model.getName()); - model.setExecutionRestarted(true); - model.getMbt().setGenerator(new RandomPathGenerator(new NeverCondition())); - model.getMbt().setCurrentVertex(Keywords.START_NODE); - } else { - logger.debug(" Model has not reached it's stop condition, so restarting model and resetting current vertex to Start: " - + model.getName()); - model.setExecutionRestarted(true); - model.getMbt().setCurrentVertex(Keywords.START_NODE); - } - } else { - logger.debug(" Adding paused model, " + model.getName()); - array.add(model); - } - } else if (!model.getMbt().hasNextStep()) { - logger.debug(" Restarting model: " + model.getName()); - model.setExecutionRestarted(true); - model.getMbt().setGenerator(new RandomPathGenerator(new NeverCondition())); - array.add(model); - } else if (model.isExecutionRestarted()) { - logger.debug(" Adding recently restarted model: " + model.getName()); - array.add(model); - } - } - } - return array; - } - - /** - * Gets a model by it's logical name. - * - * @param name - * The logical name of a model - * @return The model that matches the logical name. - */ - private ModelRunnable getModel(String name) { - for (ModelRunnable model : models) { - check4Crash(model); - if (model.getName().equals(name)) { - return model; - } - } - return null; - } - - /** - * Searches the handler for a model in a running state. - * - * @return True if any model is in a running state, else false will be - * returned. - */ - private boolean isAnyModelRunning() { - for (ModelRunnable model : models) { - check4Crash(model); - if (model.getMbt().isRunning()) { - return true; - } - } - return false; - } - - /** - * Checks whether the models of the handler has executed. - * - * @return True if all models has reached the stop criteria, else false is - * returned. - */ - /** - * @return - */ - public boolean isAllModelsDone() { - for (ModelRunnable model : models) { - logger.debug("Examining model: " + model.getMbt().getGraph()); - check4Crash(model); - if (model.getMbt().getGenerator().getStopCondition() instanceof NeverCondition) { - logger.debug(" Model: " + model.getName() + ", has a NeverCondition, thus by definition finished."); - } else if (!model.getMbt().hasNextStep()) { - logger.debug(" Model: " + model.getName() + ", has reached it's stop condition"); - } else { - logger.debug(" Model: " + model.getName() + ", is not done: " + model.getMbt().getStatisticsString()); - return false; - } - } - logger.debug("All models has reached their desired stop conditions."); - return true; - } - - /** - * Checks if the handler has a model with the same logical name already - * loaded. - * - * @param name - * The logical name of the model - * @return True if the handler already has a model with matching logical name. - */ - private boolean hasModel(String name) { - for (ModelRunnable model : models) { - check4Crash(model); - if (model.getName().equals(name)) { - return true; - } - } - return false; - } - - private void check4Crash(ModelRunnable model) { - if (model.isCrashed()) { - logger.error("Model has crashed: " + model.getName()); - throw new RuntimeException("Model has crashed"); - } - } - - /** - * Returns the statistics from all models. - * - * @return The aggregated statistics for all models - * @throws InterruptedException - */ - public String getStatistics() throws InterruptedException { - StringBuilder statistics = new StringBuilder("Statistics for multiple models"); - for (ModelRunnable model : models) { - statistics.append("\n\nStatistics for ").append(model.getName()).append(":\n"); - statistics.append(model.mbt.getStatisticsString()); - } - return statistics.toString(); - } - - public synchronized String getCurrentVertex() { - return currentVertex; - } - - public synchronized void setCurrentVertex(String currentVertex) { - logger.debug("Changing current vertex from: " + this.currentVertex + ", to: " + currentVertex); - this.currentVertex = currentVertex; - } -} diff --git a/src/main/java/org/graphwalker/statistics/EdgeCoverageStatistics.java b/src/main/java/org/graphwalker/statistics/EdgeCoverageStatistics.java deleted file mode 100644 index 942d5fe6..00000000 --- a/src/main/java/org/graphwalker/statistics/EdgeCoverageStatistics.java +++ /dev/null @@ -1,83 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.statistics; - -import java.util.HashSet; - -import org.graphwalker.graph.AbstractElement; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; - -/** - * @author Johan Tejle - * - */ -public class EdgeCoverageStatistics extends Statistics { - - private int max; - private HashSet usedEdges; - - /** - * - * @param model - */ - public EdgeCoverageStatistics(Graph model) { - max = model.getEdges().size(); - usedEdges = new HashSet(); - } - - /* - * (non-Javadoc) - * - * @see - * org.graphwalker.statistics.Statistics#addProgress(edu.uci.ics.jung.graph - * .impl.AbstractElement) - */ - @Override - public void addProgress(AbstractElement element) { - if (element instanceof Edge) - usedEdges.add(element.toString()); - } - - /* - * (non-Javadoc) - * - * @see org.graphwalker.statistics.Statistics#getCurrent() - */ - @Override - public int getCurrent() { - return usedEdges.size(); - } - - /* - * (non-Javadoc) - * - * @see org.graphwalker.statistics.Statistics#getMax() - */ - @Override - public int getMax() { - return max; - } - -} diff --git a/src/main/java/org/graphwalker/statistics/EdgeSequenceCoverageStatistics.java b/src/main/java/org/graphwalker/statistics/EdgeSequenceCoverageStatistics.java deleted file mode 100644 index 343eaf57..00000000 --- a/src/main/java/org/graphwalker/statistics/EdgeSequenceCoverageStatistics.java +++ /dev/null @@ -1,145 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.statistics; - -import java.util.HashSet; -import java.util.Stack; - -import org.graphwalker.graph.AbstractElement; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; - -/** - * @author Johan Tejle - * - */ -public class EdgeSequenceCoverageStatistics extends Statistics { - - private HashSet usedSequences; - private HashSet allSequences; - private Stack pathHistory; - private int length; - - /** - * - * @param model - * @param sequenceLength - */ - @SuppressWarnings("unchecked") - public EdgeSequenceCoverageStatistics(Graph model, int sequenceLength) { - this.length = sequenceLength; - usedSequences = new HashSet(); - allSequences = new HashSet(); - pathHistory = new Stack(); - - Stack[] possibilities = new Stack[sequenceLength]; - for (int i = 0; i < sequenceLength; i++) { - possibilities[i] = new Stack(); - } - possibilities[0].addAll(model.getEdges()); - while (possibilities[0].size() > 0) { - for (int i = 0; i < sequenceLength - 1; i++) { - if (possibilities[i].size() == 0) - return; - if (possibilities[i + 1].size() == 0) - possibilities[i + 1].addAll(model.getOutEdges(model.getDest(possibilities[i].peek()))); - } - while (possibilities[sequenceLength - 1].size() > 0) { - allSequences.add(getSequenceName(possibilities)); - possibilities[sequenceLength - 1].pop(); - } - for (int i = sequenceLength - 1; i > 0; i--) { - if (possibilities[i].size() == 0) { - possibilities[i - 1].pop(); - } - } - } - } - - /** - * @param possibilities - * @return - */ - private String getSequenceName(Stack[] possibilities) { - StringBuilder stringBuilder = new StringBuilder(); - for (Stack possibility : possibilities) { - stringBuilder.append(possibility.peek().hashCode()); - stringBuilder.append(" "); - } - return stringBuilder.toString().trim(); - } - - /** - * @return - */ - private String getCurrentSequenceName() { - StringBuilder stringBuilder = new StringBuilder(); - for (int i = 0; i < pathHistory.size(); i++) { - stringBuilder.append(pathHistory.elementAt(i).hashCode()); - stringBuilder.append(" "); - } - return stringBuilder.toString().trim(); - } - - /* - * (non-Javadoc) - * - * @see - * org.graphwalker.statistics.Statistics#addProgress(edu.uci.ics.jung.graph - * .impl.AbstractElement) - */ - @Override - public void addProgress(AbstractElement element) { - if (element instanceof Edge) { - pathHistory.add(element); - } - if (pathHistory.size() > this.length) { - pathHistory.remove(0); - } - if (pathHistory.size() == this.length) { - usedSequences.add(getCurrentSequenceName()); - } - } - - /* - * (non-Javadoc) - * - * @see org.graphwalker.statistics.Statistics#getCurrent() - */ - @Override - public int getCurrent() { - return usedSequences.size(); - } - - /* - * (non-Javadoc) - * - * @see org.graphwalker.statistics.Statistics#getMax() - */ - @Override - public int getMax() { - return allSequences.size(); - } - -} diff --git a/src/main/java/org/graphwalker/statistics/RequirementCoverageStatistics.java b/src/main/java/org/graphwalker/statistics/RequirementCoverageStatistics.java deleted file mode 100644 index 0e99136e..00000000 --- a/src/main/java/org/graphwalker/statistics/RequirementCoverageStatistics.java +++ /dev/null @@ -1,99 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.statistics; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Vector; - -import org.graphwalker.graph.AbstractElement; -import org.graphwalker.graph.Graph; - -/** - * @author Johan Tejle - * - */ -public class RequirementCoverageStatistics extends Statistics { - - private HashSet usedRequirements; - private HashSet allRequirements; - - /** - * - * @param model - */ - public RequirementCoverageStatistics(Graph model) { - usedRequirements = new HashSet(); - allRequirements = new HashSet(); - - Vector allElements = new Vector(); - allElements.addAll(model.getEdges()); - allElements.addAll(model.getVertices()); - for (AbstractElement e : allElements) { - if (!e.getReqTagKey().isEmpty()) { - appendRequirements(allRequirements, e.getReqTagKey()); - } - } - } - - private void appendRequirements(HashSet set, String requirements) { - String[] tags = requirements.split(","); - Collections.addAll(set, tags); - } - - /* - * (non-Javadoc) - * - * @see - * org.graphwalker.statistics.Statistics#addProgress(edu.uci.ics.jung.graph - * .impl.AbstractElement) - */ - @Override - public void addProgress(AbstractElement element) { - if (element != null && !element.getReqTagKey().isEmpty()) { - appendRequirements(usedRequirements, element.getReqTagKey()); - } - } - - /* - * (non-Javadoc) - * - * @see org.graphwalker.statistics.Statistics#getCurrent() - */ - @Override - public int getCurrent() { - return usedRequirements.size(); - } - - /* - * (non-Javadoc) - * - * @see org.graphwalker.statistics.Statistics#getMax() - */ - @Override - public int getMax() { - return allRequirements.size(); - } - -} diff --git a/src/main/java/org/graphwalker/statistics/Statistics.java b/src/main/java/org/graphwalker/statistics/Statistics.java deleted file mode 100644 index e9a300d8..00000000 --- a/src/main/java/org/graphwalker/statistics/Statistics.java +++ /dev/null @@ -1,38 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.statistics; - -import org.graphwalker.graph.AbstractElement; - -/** - * @author Johan Tejle - * - */ -public abstract class Statistics { - public abstract void addProgress(AbstractElement element); - - public abstract int getCurrent(); - - public abstract int getMax(); -} diff --git a/src/main/java/org/graphwalker/statistics/VertexCoverageStatistics.java b/src/main/java/org/graphwalker/statistics/VertexCoverageStatistics.java deleted file mode 100644 index 338cbd77..00000000 --- a/src/main/java/org/graphwalker/statistics/VertexCoverageStatistics.java +++ /dev/null @@ -1,84 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.statistics; - -import java.util.HashSet; - -import org.graphwalker.graph.AbstractElement; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; - -/** - * @author Johan Tejle - * - */ -public class VertexCoverageStatistics extends Statistics { - - private int max; - private HashSet usedVertices; - - /** - * - * @param model - */ - public VertexCoverageStatistics(Graph model) { - max = model.getVertices().size(); - usedVertices = new HashSet(); - } - - /* - * (non-Javadoc) - * - * @see - * org.graphwalker.statistics.Statistics#addProgress(edu.uci.ics.jung.graph - * .impl.AbstractElement) - */ - @Override - public void addProgress(AbstractElement element) { - if (element instanceof Vertex) { - usedVertices.add(element.toString()); - } - } - - /* - * (non-Javadoc) - * - * @see org.graphwalker.statistics.Statistics#getCurrent() - */ - @Override - public int getCurrent() { - return usedVertices.size(); - } - - /* - * (non-Javadoc) - * - * @see org.graphwalker.statistics.Statistics#getMax() - */ - @Override - public int getMax() { - return max; - } - -} diff --git a/src/main/resources/META-INF/MANIFEST.MF b/src/main/resources/META-INF/MANIFEST.MF deleted file mode 100644 index 202105b3..00000000 --- a/src/main/resources/META-INF/MANIFEST.MF +++ /dev/null @@ -1 +0,0 @@ -Main-Class: org.graphwalker.CLI diff --git a/src/main/resources/org/graphwalker/GUI/resources/icons/back.png b/src/main/resources/org/graphwalker/GUI/resources/icons/back.png deleted file mode 100644 index f4be8c35..00000000 Binary files a/src/main/resources/org/graphwalker/GUI/resources/icons/back.png and /dev/null differ diff --git a/src/main/resources/org/graphwalker/GUI/resources/icons/exit.png b/src/main/resources/org/graphwalker/GUI/resources/icons/exit.png deleted file mode 100644 index e66d3a73..00000000 Binary files a/src/main/resources/org/graphwalker/GUI/resources/icons/exit.png and /dev/null differ diff --git a/src/main/resources/org/graphwalker/GUI/resources/icons/first.png b/src/main/resources/org/graphwalker/GUI/resources/icons/first.png deleted file mode 100644 index bb949c38..00000000 Binary files a/src/main/resources/org/graphwalker/GUI/resources/icons/first.png and /dev/null differ diff --git a/src/main/resources/org/graphwalker/GUI/resources/icons/new.png b/src/main/resources/org/graphwalker/GUI/resources/icons/new.png deleted file mode 100644 index 44e444fd..00000000 Binary files a/src/main/resources/org/graphwalker/GUI/resources/icons/new.png and /dev/null differ diff --git a/src/main/resources/org/graphwalker/GUI/resources/icons/next.png b/src/main/resources/org/graphwalker/GUI/resources/icons/next.png deleted file mode 100644 index af634050..00000000 Binary files a/src/main/resources/org/graphwalker/GUI/resources/icons/next.png and /dev/null differ diff --git a/src/main/resources/org/graphwalker/GUI/resources/icons/open.png b/src/main/resources/org/graphwalker/GUI/resources/icons/open.png deleted file mode 100644 index 28b43db0..00000000 Binary files a/src/main/resources/org/graphwalker/GUI/resources/icons/open.png and /dev/null differ diff --git a/src/main/resources/org/graphwalker/GUI/resources/icons/pause.png b/src/main/resources/org/graphwalker/GUI/resources/icons/pause.png deleted file mode 100644 index 073ab781..00000000 Binary files a/src/main/resources/org/graphwalker/GUI/resources/icons/pause.png and /dev/null differ diff --git a/src/main/resources/org/graphwalker/GUI/resources/icons/reload.png b/src/main/resources/org/graphwalker/GUI/resources/icons/reload.png deleted file mode 100644 index f935359c..00000000 Binary files a/src/main/resources/org/graphwalker/GUI/resources/icons/reload.png and /dev/null differ diff --git a/src/main/resources/org/graphwalker/GUI/resources/icons/run.png b/src/main/resources/org/graphwalker/GUI/resources/icons/run.png deleted file mode 100644 index c1772427..00000000 Binary files a/src/main/resources/org/graphwalker/GUI/resources/icons/run.png and /dev/null differ diff --git a/src/main/resources/org/graphwalker/GUI/resources/icons/save.png b/src/main/resources/org/graphwalker/GUI/resources/icons/save.png deleted file mode 100644 index 9c9a2259..00000000 Binary files a/src/main/resources/org/graphwalker/GUI/resources/icons/save.png and /dev/null differ diff --git a/src/main/resources/org/graphwalker/resources/graphwalker.properties b/src/main/resources/org/graphwalker/resources/graphwalker.properties deleted file mode 100644 index 45386501..00000000 --- a/src/main/resources/org/graphwalker/resources/graphwalker.properties +++ /dev/null @@ -1,27 +0,0 @@ -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=ALL, CONSOLE, LOG - -# stdout is set to be a ConsoleAppender. -log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout -log4j.appender.CONSOLE.layout.ConversionPattern=%d [%t] %-5p %c - %m%n - -log4j.appender.LOG.layout=org.apache.log4j.PatternLayout -log4j.appender.LOG.layout.ConversionPattern=%d [%t] %-5p - %m%n - -log4j.appender.LOG=org.apache.log4j.RollingFileAppender -log4j.appender.LOG.File=logs/graphwalker.log -log4j.appender.LOG.MaxFileSize=20MB -log4j.appender.LOG.MaxBackupIndex=5 - -# Differentiate the log levels -log4j.appender.CONSOLE.threshold=ERROR -log4j.appender.LOG.threshold=INFO - -# The port on which the web services run -graphwalker.ws.port=9090 - -# Should the SOAP service be started when the GUI app starts -org.graphwalker.GUI.startSOAP=false \ No newline at end of file diff --git a/src/main/resources/org/graphwalker/resources/version.properties b/src/main/resources/org/graphwalker/resources/version.properties deleted file mode 100644 index 25889ed4..00000000 --- a/src/main/resources/org/graphwalker/resources/version.properties +++ /dev/null @@ -1,4 +0,0 @@ -version.major=2 -version.minor=5 -version.fix=14 -version.svn.rev=911 \ No newline at end of file diff --git a/src/test/java/org/graphwalker/CLITest.java b/src/test/java/org/graphwalker/CLITest.java deleted file mode 100644 index f7088400..00000000 --- a/src/test/java/org/graphwalker/CLITest.java +++ /dev/null @@ -1,442 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.PrintStream; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.log4j.Logger; -import org.graphwalker.CLI; -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.Util; - -import junit.framework.TestCase; - -public class CLITest extends TestCase { - - Pattern pattern; - Matcher matcher; - StringBuffer stdOutput; - StringBuffer errOutput; - String outMsg; - String errMsg; - static Logger logger = Util.setupLogger(CLITest.class); - - @Override - protected void setUp() throws Exception { - super.setUp(); - ModelBasedTesting.getInstance().reset(); - } - - private OutputStream redirectOut() { - return new OutputStream() { - @Override - public void write(int b) throws IOException { - stdOutput.append(Character.toString((char) b)); - } - }; - } - - private OutputStream redirectErr() { - return new OutputStream() { - @Override - public void write(int b) throws IOException { - errOutput.append(Character.toString((char) b)); - } - }; - } - - private InputStream redirectIn() { - return new InputStream() { - @Override - public int read() throws IOException { - try { - Thread.sleep(300); - } catch (InterruptedException e) { - Util.logStackTraceToError(e); - } - return '0'; - } - }; - } - - private void runCommand(String args[]) { - stdOutput = new StringBuffer(); - errOutput = new StringBuffer(); - - PrintStream outStream = new PrintStream(redirectOut()); - PrintStream oldOutStream = System.out; // backup - PrintStream errStream = new PrintStream(redirectErr()); - PrintStream oldErrStream = System.err; // backup - - System.setOut(outStream); - System.setErr(errStream); - - CLI.main(args); - - System.setOut(oldOutStream); - System.setErr(oldErrStream); - - outMsg = stdOutput.toString(); - errMsg = errOutput.toString(); - logger.debug("stdout: " + outMsg); - logger.debug("stderr: " + errMsg); - } - - private void moveMbtPropertiesFile() { - File mbt_properties = new File("graphwalker.properties"); - if (mbt_properties.exists()) { - mbt_properties.renameTo(new File("graphwalker.properties.bak")); - } - assertFalse(new File("graphwalker.properties").exists()); - } - - private void restoreMbtPropertiesFile() { - File mbt_properties = new File("graphwalker.properties.bak"); - if (mbt_properties.exists()) { - mbt_properties.renameTo(new File("graphwalker.properties")); - } - assertFalse(new File("graphwalker.properties.bak").exists()); - } - - /** - * Test command: java -jar mbt.jar - */ - public void testNoArgs() { - String args[] = {}; - runCommand(args); - pattern = Pattern.compile("Type 'java -jar graphwalker.jar help' for usage.", Pattern.MULTILINE); - matcher = pattern.matcher(errMsg); - assertTrue(matcher.find()); - assertTrue("Nothing should be written to standard output: " + outMsg, outMsg.isEmpty()); - } - - /** - * Test command: java -jar mbt.jar -v - */ - public void testVersion() { - String args[] = { "-v" }; - runCommand(args); - assertTrue("No error messages should occur: " + errMsg, errMsg.isEmpty()); - pattern = Pattern.compile("^org\\.graphwalker version " + ModelBasedTesting.getInstance().getVersionString(), Pattern.MULTILINE); - matcher = pattern.matcher(outMsg); - assertTrue(matcher.find()); - } - - /** - * Test command: java -jar mbt.jar - */ - public void testNoMbtPropertiesFile() { - String args[] = {}; - moveMbtPropertiesFile(); - runCommand(args); - restoreMbtPropertiesFile(); - pattern = Pattern.compile("Type 'java -jar graphwalker.jar help' for usage.", Pattern.MULTILINE); - matcher = pattern.matcher(errMsg); - assertTrue(matcher.find()); - assertTrue("Nothing should be written to standard output: " + outMsg, outMsg.isEmpty()); - } - - /** - * Test command: java -jar mbt.jar offline -f - * graphml/reqtags/ExtendedMain.graphml -g RANDOM -s TEST_LENGTH:10 - */ - public void testNoMbtPropertiesFileOffline() { - String args[] = { "offline", "-f", "graphml/reqtags/ExtendedMain.graphml", "-g", "RANDOM", "-s", "TEST_LENGTH:10" }; - moveMbtPropertiesFile(); - runCommand(args); - restoreMbtPropertiesFile(); - System.out.println(errMsg); - assertEquals("No error messages should occur.", "", errMsg); - assertEquals(0, getNumMatches(Pattern.compile("INFO").matcher(outMsg))); - } - - /** - * Test command: java -jar mbt.jar sputnik - */ - public void testUnkownCommand() { - String args[] = { "sputnik" }; - runCommand(args); - pattern = Pattern.compile("^Unkown command: .*\\s+", Pattern.MULTILINE); - matcher = pattern.matcher(errMsg); - assertTrue(matcher.find()); - assertTrue("Nothing should be written to standard output: " + outMsg, outMsg.isEmpty()); - } - - /** - * Test command: java -jar mbt.jar offline -f - * graphml/reqtags/ExtendedMain.graphml -g A_STAR -s EDGE_COVERAGE:100 - */ - public void testOfflineA_StarEdgeCoverage() { - String args[] = { "offline", "-f", "graphml/reqtags/ExtendedMain.graphml", "-g", "A_STAR", "-s", "EDGE_COVERAGE:100" }; - runCommand(args); - assertEquals(errMsg, "", errMsg); - assertEquals(outMsg, 0, getNumMatches(Pattern.compile("INFO").matcher(outMsg))); - } - - private int getNumMatches(Matcher m) { - int numMatches = 0; - while (m.find() == true) - numMatches++; - return numMatches; - } - - /** - * Test command: java -jar mbt.jar offline -f - * graphml/reqtags/ExtendedMain.graphml -g RANDOM -s EDGE_COVERAGE:100 - */ - public void testOfflineRandomEdgeCoverage() { - String args[] = { "offline", "-f", "graphml/reqtags/ExtendedMain.graphml", "-g", "RANDOM", "-s", "EDGE_COVERAGE:100" }; - runCommand(args); - assertTrue("No error messgaes should occur: " + errMsg, errMsg.isEmpty()); - assertTrue("Expected at least 78 lines, got: " + outMsg.split("\r\n|\r|\n").length, outMsg.split("\r\n|\r|\n").length >= 78); - } - - /** - * Test command: java -jar mbt.jar offline -f - * graphml/reqtags/ExtendedMain.graphml -g RANDOM -s VERTEX_COVERAGE:100 - */ - public void testOfflineRandomStateCoverage() { - String args[] = { "offline", "-f", "graphml/reqtags/ExtendedMain.graphml", "-g", "RANDOM", "-s", "VERTEX_COVERAGE:100" }; - runCommand(args); - assertTrue("No error messages should occur: " + errMsg, errMsg.isEmpty()); - assertTrue("Expected at least 24 lines, got: " + outMsg.split("\r\n|\r|\n").length, outMsg.split("\r\n|\r|\n").length >= 24); - } - - /** - * Test command: java -jar mbt.jar offline -f - * graphml/reqtags/ExtendedMain.graphml -g A_STAR -s VERTEX_COVERAGE:100 - */ - public void testOfflineA_StarStateCoverage() { - String args[] = { "offline", "-f", "graphml/reqtags/ExtendedMain.graphml", "-g", "A_STAR", "-s", "VERTEX_COVERAGE:100" }; - runCommand(args); - assertEquals("No error messages should occur.", "", errMsg); - assertTrue(outMsg, getNumMatches(Pattern.compile("INFO").matcher(outMsg)) <= 21); - } - - /** - * Test command: java -jar mbt.jar offline -f - * graphml/reqtags/ExtendedMain.graphml -g a_star -s "REACHED_REQUIREMENT:req - * 78 - */ - public void testOfflineA_StarReachedRequirement() { - String args[] = { "offline", "-f", "graphml/reqtags/ExtendedMain.graphml", "-g", "a_star", "-s", "REACHED_REQUIREMENT:req 78" }; - runCommand(args); - assertEquals("No error messages should occur.", "", errMsg); - assertEquals(0, getNumMatches(Pattern.compile("INFO").matcher(outMsg))); - } - - /** - * Test command: java -jar mbt.jar requirements -f - * graphml/reqtags/ExtendedMain.graphml - */ - public void testListReqTags() { - String args[] = { "requirements", "-f", "graphml/reqtags/ExtendedMain.graphml" }; - runCommand(args); - assertTrue("No error messages should occur: " + errMsg, errMsg.isEmpty()); - assertEquals(6, getNumMatches(Pattern.compile("req[ \\d]+").matcher(outMsg))); - } - - /** - * Test command: java -jar mbt.jar source -f graphml/methods/Main.graphml -t - * templates/perl.template - */ - public void testGenerateCodeFromTemplateHeaderAndFooter() { - String args[] = { "source", "-f", "graphml/methods/Main.graphml", "-t", "templates/junit.template" }; - runCommand(args); - assertTrue("No error messages should occur: " + errMsg, errMsg.isEmpty()); - pattern = Pattern.compile(" implements the ", Pattern.MULTILINE); - matcher = pattern.matcher(outMsg); - assertTrue(matcher.find()); - } - - /** - * Test command: java -jar mbt.jar source -f graphml/methods/Main.graphml -t - * templates/perl.template - */ - public void testGenerateCodeFromTemplate() { - String args[] = { "source", "-f", "graphml/methods/Main.graphml", "-t", "templates/perl.template" }; - runCommand(args); - assertTrue("No error messages should occur: " + errMsg, errMsg.isEmpty()); - pattern = Pattern.compile(" implements the ", Pattern.MULTILINE); - matcher = pattern.matcher(outMsg); - assertTrue(matcher.find()); - } - - /** - * Test command: java -jar mbt.jar offline -f - * graphml/misc/missing_inedges.graphml -g RANDOM -s EDGE_COVERAGE:100 - */ - public void testNoVerticesWithNoInEdges() { - String args[] = { "offline", "-f", "graphml/misc/missing_inedges.graphml", "-g", "RANDOM", "-s", "EDGE_COVERAGE:100" }; - runCommand(args); - pattern = Pattern.compile("^No in-edges! Vertex: .* is not reachable, from file: 'graphml.misc.missing_inedges.graphml'$", - Pattern.MULTILINE); - matcher = pattern.matcher(errMsg); - assertTrue(matcher.find()); - } - - /** - * Test command: java -jar mbt.jar offline -f - * graphml/misc/missing_inedges.graphml -g RANDOM -s EDGE_COVERAGE:100 - */ - public void testVertexWithNoInEdges() { - String args[] = { "offline", "-f", "graphml/misc/missing_inedges.graphml", "-g", "RANDOM", "-s", "EDGE_COVERAGE:100" }; - runCommand(args); - pattern = Pattern.compile("No in-edges! Vertex: 'v_InvalidKey', INDEX=9 is not reachable.", Pattern.MULTILINE); - matcher = pattern.matcher(errMsg); - assertTrue(matcher.find()); - } - - /** - * Test command: java -jar mbt.jar online -f graphml/methods/Main.graphml -g - * RANDOM -s TEST_DURATION:10 - */ - public void testOnlineRandom10seconds() { - String args[] = { "online", "-f", "graphml/methods/Main.graphml", "-g", "RANDOM", "-s", "TEST_DURATION:10", "-o", "1" }; - InputStream oldInputStream = System.in; // backup - System.setIn(redirectIn()); - long startTime = System.currentTimeMillis(); - runCommand(args); - long runTime = System.currentTimeMillis() - startTime; - System.setIn(oldInputStream); - assertEquals("No error messages should occur.", "", errMsg); - assertTrue((runTime - 10000) < 3000); - } - - /** - * Test command: java -jar mbt.jar methods -f graphml/methods/Main.graphml - */ - public void testCountMethods() { - String args[] = { "methods", "-f", "graphml/methods/Main.graphml" }; - runCommand(args); - assertTrue("No error messages should occur: " + errMsg, errMsg.isEmpty()); - pattern = Pattern - .compile( - "e_Cancel\\s+e_CloseApp\\s+e_CloseDB\\s+e_CloseDialog\\s+e_EnterCorrectKey\\s+e_EnterInvalidKey\\s+e_Initialize\\s+e_No\\s+e_Start\\s+e_StartWithDatabase\\s+e_Yes\\s+v_EnterMasterCompositeMasterKey\\s+v_InvalidKey\\s+v_KeePassNotRunning\\s+v_MainWindowEmpty\\s+v_MainWindow_DB_Loaded\\s+v_SaveBeforeCloseLock", - Pattern.MULTILINE); - matcher = pattern.matcher(outMsg); - assertTrue(matcher.find()); - } - - /** - * Check for reserved keywords Test command: java -jar mbt.jar methods -f - * graphml/test24 - */ - public void testReservedKeywords() { - String args[] = { "methods", "-f", "graphml/test24" }; - runCommand(args); - pattern = Pattern.compile( - "Could not parse file: '.*graphml.test24.(Camera|Time).graphml'. Edge has a label 'BACKTRACK', which is a reserved keyword", - Pattern.MULTILINE); - matcher = pattern.matcher(errMsg); - System.out.println(errMsg); - assertTrue(matcher.find()); - } - - /** - * Check for reserved keywords Test command: java -jar mbt.jar xml -f - * xml/reqtags/mbt_init6.xml - */ - public void testXmlSetup() { - String args[] = { "xml", "-f", "xml/reqtags/mbt_init6.xml" }; - runCommand(args); - assertTrue("No error messages should occur: " + errMsg, errMsg.isEmpty()); - assertEquals(6, getNumMatches(Pattern.compile("req[ \\d]+").matcher(outMsg))); - } - - /** - * Check that xml with java executor. Test command: java -jar mbt.jar xml -f - * xml/reqtags/mbt_init5.xml - */ - public void testXmlSetupWithJavaExecutor() { - String args[] = { "xml", "-f", "xml/javaExecutor.xml" }; - runCommand(args); - assertTrue("No error messages should occur: " + errMsg, errMsg.isEmpty()); - assertEquals(outMsg, 76, getNumMatches(Pattern.compile("(Vertex:|Edge:)").matcher(outMsg))); - } - - /** - * Test command: java -jar mbt.jar soap -f xml/reqtags/mbt_init6.xml - */ - public void testSOAPWithXML() { - String args[] = { "soap", "-f", "xml/reqtags/mbt_init6.xml" }; - runCommand(args); - assertTrue("No error messages should occur: " + errMsg, errMsg.isEmpty()); - assertTrue( - outMsg, - outMsg - .matches("(?s).*Now running as a SOAP server. For the WSDL file, see: http://.*:9090/mbt-services\\?WSDL\\s+Press Ctrl\\+C to quit\\s+")); - } - - /** - * Test command: java -jar mbt.jar soap - */ - public void testSOAPWithoutXML() { - String args[] = { "soap" }; - runCommand(args); - assertTrue("No error messages should occur: " + errMsg, errMsg.isEmpty()); - assertEquals( - true, - outMsg - .matches("Now running as a SOAP server. For the WSDL file, see: http://.*:9090/mbt-services\\?WSDL\\s+Press Ctrl\\+C to quit\\s+")); - } - - /** - * Test command: java -jar mbt.jar soap -f xml/reqtags/mbt_init6.xml - */ - public void testSOAPWithCorrectClassPathInXML() { - String args[] = { "soap", "-f", "xml/reqtags/mbt_init8.xml" }; - runCommand(args); - assertTrue("No error messages should occur: " + errMsg, errMsg.isEmpty()); - assertTrue( - outMsg, - outMsg - .matches("(?s).*Now running as a SOAP server. For the WSDL file, see: http://.*:9090/mbt-services\\?WSDL\\s+Press Ctrl\\+C to quit\\s+")); - } - - /** - * Test command: java -jar mbt.jar soap -f xml/reqtags/mbt_init9.xml - */ - public void testSOAPWithIncorrectClassPathInXML() { - String args[] = { "soap", "-f", "xml/reqtags/mbt_init9.xml" }; - runCommand(args); - assertTrue(errMsg, errMsg.matches("(?s).*Could not add: 'non-existing-path' to CLASSPATH.*")); - } - - /** - * Test command: java -jar mbt.jar xml -f xml/ReachedVertex.xml - */ - public void testReachedVertexXML() { - String args[] = { "xml", "-f", "xml/ReachedVertex.xml" }; - runCommand(args); - System.out.println(errMsg); - assertTrue("No error messages should occur: " + errMsg, errMsg.isEmpty()); - } -} diff --git a/src/test/java/org/graphwalker/ExtendedFiniteStateMachineTest.java b/src/test/java/org/graphwalker/ExtendedFiniteStateMachineTest.java deleted file mode 100644 index e375dfd7..00000000 --- a/src/test/java/org/graphwalker/ExtendedFiniteStateMachineTest.java +++ /dev/null @@ -1,89 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker; - -import org.graphwalker.Util; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; -import org.graphwalker.machines.ExtendedFiniteStateMachine; - -import junit.framework.TestCase; - -public class ExtendedFiniteStateMachineTest extends TestCase { - - Graph graph; - Vertex start; - Vertex v1; - Vertex v2; - Edge e1; - Edge e2; - Edge e3; - Edge e4; - - @Override - protected void setUp() throws Exception { - super.setUp(); - graph = new Graph(); - - start = Util.addVertexToGraph(graph, "Start"); - - v1 = Util.addVertexToGraph(graph, "V1"); - v1.setReqTagKey("REQ002"); - - v2 = Util.addVertexToGraph(graph, "V2"); - v2.setReqTagKey("REQ004"); - - e1 = Util.addEdgeToGraph(graph, start, v1, "E1", null, null, "x=1;y=new Vector()"); - e1.setReqTagKey("REQ001,REQ002"); - - e2 = Util.addEdgeToGraph(graph, v1, v2, "E2", null, null, "x=2"); - e2.setReqTagKey("REQ003"); - - e3 = Util.addEdgeToGraph(graph, v2, v2, "E3", null, "x<6", "x++"); - - e4 = Util.addEdgeToGraph(graph, v2, v1, "E4", null, "y.size()<3", "y.add(x)"); - } - - public void testRequirements() { - ExtendedFiniteStateMachine EFSM = new ExtendedFiniteStateMachine(false); - EFSM.setModel(graph); - assertEquals("{REQ001=0, REQ004=0, REQ003=0, REQ002=0}", EFSM.getAllRequirements().toString()); - assertEquals("[]", EFSM.getCoveredRequirements().toString()); - } - - public void testRequirementsWalk() { - ExtendedFiniteStateMachine EFSM = new ExtendedFiniteStateMachine(false); - EFSM.setModel(graph); - assertEquals("Start", EFSM.getCurrentVertexName()); - EFSM.walkEdge(e1); - assertEquals("V1/x=1;y=[];", EFSM.getCurrentVertexName()); - assertEquals("{REQ001=1, REQ004=0, REQ003=0, REQ002=2}", EFSM.getAllRequirements().toString()); - assertEquals("[REQ001, REQ002]", EFSM.getCoveredRequirements().toString()); - EFSM.walkEdge(e2); - assertEquals("V2/x=2;y=[];", EFSM.getCurrentVertexName()); - assertEquals("{REQ001=1, REQ004=1, REQ003=1, REQ002=2}", EFSM.getAllRequirements().toString()); - assertEquals("[REQ001, REQ004, REQ003, REQ002]", EFSM.getCoveredRequirements().toString()); - } -} diff --git a/src/test/java/org/graphwalker/ExtendedMain.java b/src/test/java/org/graphwalker/ExtendedMain.java deleted file mode 100644 index 04b2597e..00000000 --- a/src/test/java/org/graphwalker/ExtendedMain.java +++ /dev/null @@ -1,159 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -/** - * - */ -package org.graphwalker; - -/** - * @author Johan Tejle - * - */ -public class ExtendedMain { - /** - * This method implements the Edge 'e_Cancel' - */ - public void e_Cancel() { - System.out.println("Edge: e_Cancel"); - } - - /** - * This method implements the Edge 'e_ChangeDatabase' - */ - public void e_ChangeDatabase() { - System.out.println("Edge: e_ChangeDatabase"); - } - - /** - * This method implements the Edge 'e_CloseApp' - */ - public void e_CloseApp() { - System.out.println("Edge: e_CloseApp"); - } - - /** - * This method implements the Edge 'e_CloseDB' - */ - public void e_CloseDB() { - System.out.println("Edge: e_CloseDB"); - } - - /** - * This method implements the Edge 'e_CloseDialog' - */ - public void e_CloseDialog() { - System.out.println("Edge: e_CloseDialog"); - } - - /** - * This method implements the Edge 'e_EnterCorrectKey' - */ - public void e_EnterCorrectKey() { - System.out.println("Edge: e_EnterCorrectKey"); - } - - /** - * This method implements the Edge 'e_EnterInvalidKey' - */ - public void e_EnterInvalidKey() { - System.out.println("Edge: e_EnterInvalidKey"); - } - - /** - * This method implements the Edge 'e_Initialize' - */ - public void e_Initialize() { - System.out.println("Edge: e_Initialize"); - } - - /** - * This method implements the Edge 'e_No' - */ - public void e_No() { - System.out.println("Edge: e_No"); - } - - /** - * This method implements the Edge 'e_Start' - */ - public void e_Start() { - System.out.println("Edge: e_Start"); - } - - /** - * This method implements the Edge 'e_StartWithDatabase' - */ - public void e_StartWithDatabase() { - System.out.println("Edge: e_StartWithDatabase"); - } - - /** - * This method implements the Edge 'e_Yes' - */ - public void e_Yes() { - System.out.println("Edge: e_Yes"); - } - - /** - * This method implements the Vertex 'v_EnterMasterCompositeMasterKey' - */ - public void v_EnterMasterCompositeMasterKey() { - System.out.println("Vertex: v_EnterMasterCompositeMasterKey"); - } - - /** - * This method implements the Vertex 'v_InvalidKey' - */ - public void v_InvalidKey() { - System.out.println("Vertex: v_InvalidKey"); - } - - /** - * This method implements the Vertex 'v_KeePassNotRunning' - */ - public void v_KeePassNotRunning() { - System.out.println("Vertex: v_KeePassNotRunning"); - } - - /** - * This method implements the Vertex 'v_MainWindowEmpty' - */ - public void v_MainWindowEmpty() { - System.out.println("Vertex: v_MainWindowEmpty"); - } - - /** - * This method implements the Vertex 'v_MainWindow_DB_Loaded' - */ - public void v_MainWindow_DB_Loaded() { - System.out.println("Vertex: v_MainWindow_DB_Loaded"); - } - - /** - * This method implements the Vertex 'v_SaveBeforeCloseLock' - */ - public void v_SaveBeforeCloseLock() { - System.out.println("Vertex: v_SaveBeforeCloseLock"); - } -} diff --git a/src/test/java/org/graphwalker/FiniteStateMachineTest.java b/src/test/java/org/graphwalker/FiniteStateMachineTest.java deleted file mode 100644 index 4dbe8a23..00000000 --- a/src/test/java/org/graphwalker/FiniteStateMachineTest.java +++ /dev/null @@ -1,90 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker; - -import org.graphwalker.Util; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; -import org.graphwalker.machines.FiniteStateMachine; - -import junit.framework.TestCase; - -public class FiniteStateMachineTest extends TestCase { - - Graph graph; - Vertex start; - Vertex v1; - Vertex v2; - Edge e1; - Edge e2; - Edge e3; - Edge e4; - - @Override - protected void setUp() throws Exception { - super.setUp(); - graph = new Graph(); - - start = Util.addVertexToGraph(graph, "Start"); - - v1 = Util.addVertexToGraph(graph, "V1"); - v1.setReqTagKey("REQ002"); - - v2 = Util.addVertexToGraph(graph, "V2"); - v2.setReqTagKey("REQ004"); - - e1 = Util.addEdgeToGraph(graph, start, v1, "E1", null, null, null); - e1.setReqTagKey("REQ001,REQ002"); - - e2 = Util.addEdgeToGraph(graph, v1, v2, "E2", null, null, null); - e2.setReqTagKey("REQ003"); - - e3 = Util.addEdgeToGraph(graph, v2, v2, "E3", null, null, null); - - e4 = Util.addEdgeToGraph(graph, v2, v1, "E4", null, null, null); - } - - public void testRequirements() { - FiniteStateMachine FSM = new FiniteStateMachine(); - FSM.setModel(graph); - assertEquals("{REQ001=0, REQ004=0, REQ003=0, REQ002=0}", FSM.getAllRequirements().toString()); - assertEquals("[]", FSM.getCoveredRequirements().toString()); - } - - public void testRequirementsWalk() { - FiniteStateMachine FSM = new FiniteStateMachine(); - FSM.setModel(graph); - assertEquals("Start", FSM.getCurrentVertexName()); - FSM.walkEdge(e1); - assertEquals("E1", FSM.getLastEdgeName()); - assertEquals("V1", FSM.getCurrentVertexName()); - assertEquals("{REQ001=1, REQ004=0, REQ003=0, REQ002=2}", FSM.getAllRequirements().toString()); - assertEquals("[REQ001, REQ002]", FSM.getCoveredRequirements().toString()); - FSM.walkEdge(e2); - assertEquals("V2", FSM.getCurrentVertexName()); - assertEquals("{REQ001=1, REQ004=1, REQ003=1, REQ002=2}", FSM.getAllRequirements().toString()); - assertEquals("[REQ001, REQ004, REQ003, REQ002]", FSM.getCoveredRequirements().toString()); - } -} diff --git a/src/test/java/org/graphwalker/KeywordsTest.java b/src/test/java/org/graphwalker/KeywordsTest.java deleted file mode 100644 index 214861ba..00000000 --- a/src/test/java/org/graphwalker/KeywordsTest.java +++ /dev/null @@ -1,92 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker; - -import org.graphwalker.Keywords; -import org.graphwalker.exceptions.GeneratorException; -import org.graphwalker.exceptions.StopConditionException; - -import junit.framework.TestCase; - -public class KeywordsTest extends TestCase { - - public void testKeywords() { - assertEquals(true, Keywords.isKeyWord("BACKTRACK")); - assertEquals(true, Keywords.isKeyWord("backtrack")); - assertEquals(true, Keywords.isKeyWord("BLOCKED")); - assertEquals(true, Keywords.isKeyWord("blocked")); - assertEquals(true, Keywords.isKeyWord("MERGE")); - assertEquals(true, Keywords.isKeyWord("merge")); - assertEquals(true, Keywords.isKeyWord("NO_MERGE")); - assertEquals(true, Keywords.isKeyWord("no_merge")); - assertEquals(true, Keywords.isKeyWord("SWITCH_MODEL")); - assertEquals(true, Keywords.isKeyWord("switch_model")); - } - - public void testNonKeywords() { - assertEquals(false, Keywords.isKeyWord("BACKTRACKING")); - assertEquals(false, Keywords.isKeyWord("BLOCK")); - assertEquals(false, Keywords.isKeyWord("MERGED")); - assertEquals(false, Keywords.isKeyWord("NO_MERGED")); - assertEquals(false, Keywords.isKeyWord("REQTAG")); - assertEquals(false, Keywords.isKeyWord("")); - } - - public void testGetStopCondition() throws StopConditionException { - assertTrue(Keywords.getStopCondition("REACHED_EDGE") != -1); - assertTrue(Keywords.getStopCondition("REACHED_VERTEX") != -1); - assertTrue(Keywords.getStopCondition("EDGE_COVERAGE") != -1); - assertTrue(Keywords.getStopCondition("VERTEX_COVERAGE") != -1); - assertTrue(Keywords.getStopCondition("TEST_LENGTH") != -1); - assertTrue(Keywords.getStopCondition("TEST_DURATION") != -1); - assertTrue(Keywords.getStopCondition("REQUIREMENT_COVERAGE") != -1); - assertTrue(Keywords.getStopCondition("REACHED_REQUIREMENT") != -1); - - try { - assertTrue(Keywords.getStopCondition("REACHEDREQUIREMENT") == -1); - assertTrue(Keywords.getStopCondition("") == -1); - assertTrue(Keywords.getStopCondition(null) == -1); - } catch (StopConditionException e) { - } - - assertTrue(Keywords.getStopConditions().size() > 0); - } - - public void testGetGenerator() throws GeneratorException { - assertTrue(Keywords.getGenerator("RANDOM") != -1); - assertTrue(Keywords.getGenerator("A_STAR") != -1); - assertTrue(Keywords.getGenerator("LIST") != -1); - assertTrue(Keywords.getGenerator("STUB") != -1); - assertTrue(Keywords.getGenerator("REQUIREMENTS") != -1); - - try { - assertTrue(Keywords.getGenerator("RASNDOM") == -1); - assertTrue(Keywords.getGenerator("") == -1); - assertTrue(Keywords.getGenerator(null) == -1); - } catch (GeneratorException e) { - } - - assertTrue(Keywords.getGenerators().size() > 0); - } -} diff --git a/src/test/java/org/graphwalker/ModelBasedTestingTest.java b/src/test/java/org/graphwalker/ModelBasedTestingTest.java deleted file mode 100644 index 22a6ee77..00000000 --- a/src/test/java/org/graphwalker/ModelBasedTestingTest.java +++ /dev/null @@ -1,265 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker; - -import java.awt.GraphicsEnvironment; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintStream; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.graphwalker.Keywords; -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.Util; -import org.graphwalker.exceptions.GeneratorException; -import org.graphwalker.exceptions.InvalidDataException; -import org.graphwalker.exceptions.StopConditionException; -import org.graphwalker.generators.NonOptimizedShortestPath; -import org.jdom.JDOMException; - -import junit.framework.TestCase; - -/** - * @author Johan Tejle - * - */ -public class ModelBasedTestingTest extends TestCase { - - @Override - protected void setUp() throws Exception { - super.setUp(); - ModelBasedTesting.getInstance().reset(); - } - - private InputStream redirectIn() { - return new InputStream() { - @Override - public int read() throws IOException { - try { - Thread.sleep(100); - } catch (InterruptedException e) { - Util.logStackTraceToError(e); - } - return '0'; - } - }; - } - - public void testXmlLoading_Simple() throws StopConditionException, GeneratorException, IOException, JDOMException, InterruptedException { - ModelBasedTesting mbt = Util.loadMbtFromXml(Util.getFile("xml/reqtags/mbt_init.xml")); - assertEquals("RANDOM{EC>=100}", mbt.toString()); - } - - public void testXmlLoading_Moderate() throws StopConditionException, GeneratorException, IOException, JDOMException, InterruptedException { - ModelBasedTesting mbt = Util.loadMbtFromXml(Util.getFile("xml/reqtags/mbt_init2.xml")); - assertEquals("RANDOM{((EC>=100 AND SC>=100) OR L=50)}", mbt.toString()); - } - - @SuppressWarnings("static-access") - public void testXmlLoading_Advanced() throws StopConditionException, GeneratorException, IOException, JDOMException, InterruptedException { - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - if (ge.isHeadless()) - return; - - ModelBasedTesting mbt = Util.loadMbtFromXml(Util.getFile("xml/reqtags/mbt_init3.xml")); - assertEquals("RANDOM{EC>=10}\nRANDOM{(SC>=30 AND EC>=10)}", mbt.toString()); - } - - @SuppressWarnings("static-access") - public void testXmlLoading_OfflineStub() throws StopConditionException, GeneratorException, IOException, JDOMException, - InterruptedException { - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - if (ge.isHeadless()) - return; - - ModelBasedTesting mbt = Util.loadMbtFromXml(Util.getFile("xml/reqtags/mbt_init4.xml")); - assertEquals("CODE", mbt.toString()); - File f = new File("mbt_init4.java"); - assertTrue(f.exists()); - assertTrue(f.delete()); - assertFalse(f.exists()); - } - - @SuppressWarnings("static-access") - public void testXmlLoading_JavaExecution() throws StopConditionException, GeneratorException, IOException, JDOMException, - InterruptedException { - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - if (ge.isHeadless()) - return; - - ModelBasedTesting mbt = Util.loadMbtFromXml(Util.getFile("xml/reqtags/mbt_init5.xml")); - assertEquals("RANDOM{SC>=40}", mbt.toString()); - } - - public void testXmlLoading_OfflineRequirements() throws StopConditionException, GeneratorException, IOException, JDOMException, - InterruptedException { - PrintStream oldOut = System.out; - ByteArrayOutputStream innerOut = new ByteArrayOutputStream(); - - System.setOut(new PrintStream(innerOut)); - ModelBasedTesting mbt = Util.loadMbtFromXml(Util.getFile("xml/reqtags/mbt_init6.xml")); - System.setOut(oldOut); - - assertEquals("REQUIREMENTS", mbt.toString()); - assertEquals(6, getNumMatches(Pattern.compile("req[ \\d]+").matcher(innerOut.toString()))); - } - - public void testXmlLoading_OnlineRequirements() throws StopConditionException, GeneratorException, IOException, JDOMException, - InterruptedException { - InputStream oldIn = System.in; - PrintStream oldOut = System.out; - ByteArrayOutputStream innerOut = new ByteArrayOutputStream(); - - System.setOut(new PrintStream(innerOut)); - System.setIn(redirectIn()); - ModelBasedTesting mbt = Util.loadMbtFromXml(Util.getFile("xml/reqtags/mbt_init7.xml")); - System.setIn(oldIn); - System.setOut(oldOut); - - assertEquals("REQUIREMENTS", mbt.toString()); - assertEquals(6, getNumMatches(Pattern.compile("req[ \\d]+").matcher(innerOut.toString()))); - } - - @SuppressWarnings("static-access") - public void testGetdataValue() throws InvalidDataException, StopConditionException, GeneratorException, IOException, JDOMException, - InterruptedException { - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - if (ge.isHeadless()) - return; - - InputStream oldIn = System.in; - PrintStream oldOut = System.out; - ByteArrayOutputStream innerOut = new ByteArrayOutputStream(); - - System.setOut(new PrintStream(innerOut)); - System.setIn(redirectIn()); - ModelBasedTesting mbt = Util.loadMbtFromXml(Util.getFile("xml/reqtags/mbt_init10.xml")); - System.setIn(oldIn); - System.setOut(oldOut); - - System.out.print(mbt.getDataValue("incorrect")); - - assertEquals("0", mbt.getDataValue("incorrect")); - } - - private int getNumMatches(Matcher m) { - int numMatches = 0; - while (m.find() == true) - numMatches++; - return numMatches; - } - - @SuppressWarnings("static-access") - public void testExecAction() throws InvalidDataException, StopConditionException, GeneratorException, IOException, JDOMException, - InterruptedException { - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - if (ge.isHeadless()) - return; - - InputStream oldIn = System.in; - PrintStream oldOut = System.out; - ByteArrayOutputStream innerOut = new ByteArrayOutputStream(); - - System.setOut(new PrintStream(innerOut)); - System.setIn(redirectIn()); - ModelBasedTesting mbt = Util.loadMbtFromXml(Util.getFile("xml/reqtags/mbt_init11.xml")); - System.setIn(oldIn); - System.setOut(oldOut); - - System.out.print(mbt.execAction("str.toUpperCase()")); - - assertEquals("ABC", mbt.execAction("str.toUpperCase()")); - } - - @SuppressWarnings("static-access") - public void testPassRequirement() throws StopConditionException, GeneratorException, IOException, JDOMException, InterruptedException { - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - if (ge.isHeadless()) - return; - - ModelBasedTesting mbt; - mbt = Util.loadMbtFromXml(Util.getFile("xml/reqCoverage.xml")); - mbt.passRequirement(true); - mbt.passRequirement(false); - mbt.passRequirement(true); - } - - public void testNewState() throws StopConditionException, InterruptedException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/ModelBasedTestingTest.testNewState.graphml"); - mbt.enableExtended(false); - mbt.setWeighted(false); - NonOptimizedShortestPath generator = new NonOptimizedShortestPath(Util.getCondition(mbt.getMachine(), Keywords.CONDITION_EDGE_COVERAGE, - "100")); - mbt.setGenerator(generator); - - String[] pair = mbt.getNextStep(); - assertEquals("e_init", pair[0]); - assertEquals("v_BrowserStopped", pair[1]); - assertEquals("e_init", mbt.getCurrentEdgeName()); - assertEquals("v_BrowserStopped", mbt.getCurrentVertexName()); - - pair = mbt.getNextStep(); - assertEquals("e_StartBrowser", pair[0]); - assertEquals("v_BrowserStarted", pair[1]); - assertEquals("e_StartBrowser", mbt.getCurrentEdgeName()); - assertEquals("v_BrowserStarted", mbt.getCurrentVertexName()); - - pair = mbt.getNextStep(); - assertEquals("e_EnterBaseURL", pair[0]); - assertEquals("v_BaseURL", pair[1]); - assertEquals("e_EnterBaseURL", mbt.getCurrentEdgeName()); - assertEquals("v_BaseURL", mbt.getCurrentVertexName()); - - assertEquals(false, mbt.setCurrentVertex("foobar")); - assertEquals(false, mbt.setCurrentVertex((String) null)); - pair = mbt.getNextStep(); - assertEquals("e_SearchBook", pair[0]); - assertEquals("v_SearchResult", pair[1]); - assertEquals("e_SearchBook", mbt.getCurrentEdgeName()); - assertEquals("v_SearchResult", mbt.getCurrentVertexName()); - - assertEquals(false, mbt.setCurrentVertex("")); - assertEquals("e_SearchBook", pair[0]); - assertEquals("v_SearchResult", pair[1]); - assertEquals("e_SearchBook", mbt.getCurrentEdgeName()); - assertEquals("v_SearchResult", mbt.getCurrentVertexName()); - - assertEquals(true, mbt.setCurrentVertex("v_BrowserStopped")); - pair = mbt.getNextStep(); - assertEquals("e_StartBrowser", pair[0]); - assertEquals("v_BrowserStarted", pair[1]); - assertEquals("e_StartBrowser", mbt.getCurrentEdgeName()); - assertEquals("v_BrowserStarted", mbt.getCurrentVertexName()); - - pair = mbt.getNextStep(); - assertEquals("e_EnterBaseURL", pair[0]); - assertEquals("v_BaseURL", pair[1]); - assertEquals("e_EnterBaseURL", mbt.getCurrentEdgeName()); - assertEquals("v_BaseURL", mbt.getCurrentVertexName()); - } -} diff --git a/src/test/java/org/graphwalker/MultipleModelsTest.java b/src/test/java/org/graphwalker/MultipleModelsTest.java deleted file mode 100644 index f3f0c28a..00000000 --- a/src/test/java/org/graphwalker/MultipleModelsTest.java +++ /dev/null @@ -1,407 +0,0 @@ -package org.graphwalker; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.MultipleModels; -import org.graphwalker.Util; -import org.graphwalker.exceptions.GeneratorException; -import org.graphwalker.exceptions.StopConditionException; -import org.jdom.JDOMException; -import org.junit.Test; - -public class MultipleModelsTest { - - @Test - public void testGetInstance() { - MultipleModels a = MultipleModels.getInstance(); - MultipleModels b = MultipleModels.getInstance(); - - a.reset(); - b.reset(); - - assertNotNull(a); - assertSame(a, b); - } - - @Test - public void testGetUniqueName() { - MultipleModels mmInstance = MultipleModels.getInstance(); - mmInstance.reset(); - - String name = "A"; - mmInstance.getUniqueName("A"); - assertFalse(name.equals(mmInstance.getUniqueName(name))); - } - - @Test - public void testNameFormat() { - MultipleModels mmInstance = MultipleModels.getInstance(); - mmInstance.reset(); - - String desiredName = "My Model"; - assertEquals("My Model", mmInstance.getUniqueName(desiredName)); - assertEquals("My Model 1", mmInstance.getUniqueName(desiredName)); - } - - @Test - public void testMaxNames() { - MultipleModels mmInstance = MultipleModels.getInstance(); - mmInstance.reset(); - - String name = "Max Name"; - for (int i = 0; i < 1000; i++) { - mmInstance.getUniqueName(name); - } - } - - @Test(expected = IndexOutOfBoundsException.class) - public void testMaxNamesBounds() { - MultipleModels mmInstance = MultipleModels.getInstance(); - mmInstance.reset(); - - String name = "Bound Name"; - for (int i = 0; i < 1001; i++) { - mmInstance.getUniqueName(name); - } - } - - @Test - public void testAddAndGetModel() throws StopConditionException, GeneratorException, IOException, JDOMException, InterruptedException { - MultipleModels mmInstance = MultipleModels.getInstance(); - mmInstance.reset(); - - ModelBasedTesting model = Util.getNewMbtFromXml(Util.getFile("xml/multipleA.xml")); - String modelName = mmInstance.getUniqueName("A"); - - mmInstance.addModel(modelName, model); - assertEquals(model, mmInstance.getModel(modelName)); - } - - @Test(expected = IllegalArgumentException.class) - public void testAddSameModelAgain() throws StopConditionException, GeneratorException, IOException, JDOMException, InterruptedException { - MultipleModels mmInstance = MultipleModels.getInstance(); - mmInstance.reset(); - - ModelBasedTesting model1 = Util.getNewMbtFromXml(Util.getFile("xml/multipleA.xml")); - ModelBasedTesting model2 = Util.getNewMbtFromXml(Util.getFile("xml/multipleA.xml")); - - String modelName = mmInstance.getUniqueName("A"); - - mmInstance.addModel(modelName, model1); - assertEquals(model1, mmInstance.getModel(modelName)); - mmInstance.addModel(modelName, model2); - } - - @Test - public void testAddNonReservedName() throws StopConditionException, GeneratorException, IOException, JDOMException, InterruptedException { - MultipleModels mmInstance = MultipleModels.getInstance(); - mmInstance.reset(); - - ModelBasedTesting model = Util.getNewMbtFromXml(Util.getFile("xml/multipleA.xml")); - String modelName = "Non reserved"; - mmInstance.addModel(modelName, model); - assertTrue(!modelName.equals(mmInstance.getUniqueName(modelName))); - } - - @Test - public void testExecuteModel() throws StopConditionException, GeneratorException, IOException, JDOMException, InterruptedException { - MultipleModels mmInstance = MultipleModels.getInstance(); - mmInstance.reset(); - - ModelBasedTesting model = Util.getNewMbtFromXml(Util.getFile("xml/multipleB.xml")); - String modelName = mmInstance.getUniqueName("B"); - - mmInstance.addModel(modelName, model); - assertTrue(model.hasNextStep()); - - mmInstance.executeModel(modelName, new ModelAPI(modelName)); - assertTrue(mmInstance.isExecuting(modelName)); - Thread.sleep(1000); - assertFalse(model.hasNextStep()); - assertFalse(mmInstance.isExecuting(modelName)); - assertTrue(mmInstance.isFinished(modelName)); - } - - @Test(expected = IllegalStateException.class) - public void testExecuteModelTwice() throws StopConditionException, GeneratorException, IOException, JDOMException, InterruptedException { - MultipleModels mmInstance = MultipleModels.getInstance(); - mmInstance.reset(); - - ModelBasedTesting model = Util.getNewMbtFromXml(Util.getFile("xml/multipleB.xml")); - String modelName = mmInstance.getUniqueName("B"); - - mmInstance.addModel(modelName, model); - mmInstance.executeModel(modelName, new ModelAPI(modelName)); - mmInstance.executeModel(modelName, new ModelAPI(modelName)); - } - - @Test(expected = IllegalArgumentException.class) - public void testExecuteNonAddedModel() { - MultipleModels mmInstance = MultipleModels.getInstance(); - mmInstance.reset(); - - String modelName = mmInstance.getUniqueName("Non-existing"); - mmInstance.executeModel(modelName, new ModelAPI(modelName)); - } - - @Test - public void testMultipleModels() throws StopConditionException, GeneratorException, IOException, JDOMException, InterruptedException { - MultipleModels mmInstance = MultipleModels.getInstance(); - mmInstance.reset(); - - ModelBasedTesting model1 = Util.getNewMbtFromXml(Util.getFile("xml/multipleA.xml")); - ModelBasedTesting model2 = Util.getNewMbtFromXml(Util.getFile("xml/multipleA.xml")); - String model1Name = mmInstance.getUniqueName("A"); - String model2Name = mmInstance.getUniqueName("A"); - - mmInstance.addModel(model1Name, model1); - mmInstance.addModel(model2Name, model2); - - assertNotNull(mmInstance.getModel(model1Name)); - assertNotNull(mmInstance.getModel(model2Name)); - } - - @Test - public void testSpawnMultipleModels() throws StopConditionException, GeneratorException, IOException, JDOMException, InterruptedException { - MultipleModels mmInstance = MultipleModels.getInstance(); - mmInstance.reset(); - - ModelBasedTesting model = Util.getNewMbtFromXml(Util.getFile("xml/multipleA.xml")); - String modelName = mmInstance.getUniqueName("A"); - String spawnedModelName = mmInstance.getUniqueName("B"); - - mmInstance.addModel(modelName, model); - assertNull(mmInstance.getModel(spawnedModelName)); - mmInstance.executeModel(modelName, new ModelAPI(modelName, spawnedModelName, true, false)); - Thread.sleep(1000); - assertNotNull(mmInstance.getModel(spawnedModelName)); - } - - @Test - public void testPausedMultipleModels() throws StopConditionException, GeneratorException, IOException, JDOMException, - InterruptedException, ExecutionException, TimeoutException { - MultipleModels mmInstance = MultipleModels.getInstance(); - mmInstance.reset(); - - ModelBasedTesting model = Util.getNewMbtFromXml(Util.getFile("xml/multipleA.xml")); - String modelName = mmInstance.getUniqueName("A"); - String spawnedModelName = mmInstance.getUniqueName("B"); - - mmInstance.addModel(modelName, model); - assertNull(mmInstance.getModel(spawnedModelName)); - mmInstance.executeModel(modelName, new ModelAPI(modelName, spawnedModelName, true, true)); - Thread.sleep(1000); - model.getFuture().get(2, TimeUnit.SECONDS); - assertTrue(model.getFuture().isDone()); - Thread.sleep(1000); - ModelBasedTesting spawnedModel = mmInstance.getModel(spawnedModelName); - assertNotNull(spawnedModel); - spawnedModel.getFuture().get(2, TimeUnit.SECONDS); - assertTrue(spawnedModel.getFuture().isDone()); - } - - @Test - public void testGetStatistics() throws StopConditionException, GeneratorException, IOException, JDOMException, InterruptedException { - MultipleModels mmInstance = MultipleModels.getInstance(); - mmInstance.reset(); - - ModelBasedTesting model = Util.getNewMbtFromXml(Util.getFile("xml/multipleB.xml")); - String modelName = mmInstance.getUniqueName("B"); - - mmInstance.addModel(modelName, model); - mmInstance.executeModel(modelName, new ModelAPI(modelName)); - String actualResult = mmInstance.getStatistics(); - assertTrue(mmInstance.isFinished()); - assertFalse(model.hasNextStep()); - assertFalse(mmInstance.isExecuting(modelName)); - assertTrue(actualResult.contains(modelName)); - } - - @Test - public void testGetStatisticsMultipleModels() throws StopConditionException, GeneratorException, IOException, JDOMException, - InterruptedException { - MultipleModels mmInstance = MultipleModels.getInstance(); - mmInstance.reset(); - - ModelBasedTesting model = Util.getNewMbtFromXml(Util.getFile("xml/multipleA.xml")); - String modelName = mmInstance.getUniqueName("A"); - String spawnedModelName = mmInstance.getUniqueName("B"); - - mmInstance.addModel(modelName, model); - mmInstance.executeModel(modelName, new ModelAPI(modelName, spawnedModelName, true, false)); - - String actualResult = mmInstance.getStatistics(); - System.out.println(actualResult); - - assertTrue(actualResult.contains(modelName)); - assertTrue(actualResult.contains(spawnedModelName)); - } - - public class ModelAPI { - private String modelName; - private String spawnedModelName; - private boolean spawn; - private boolean pause; - - public ModelAPI(String modelName) { - this(modelName, "", false, false); - } - - public ModelAPI(String modelName, String spawnedModelName, boolean spawn, boolean pause) { - this.modelName = modelName; - this.spawnedModelName = spawnedModelName; - this.spawn = spawn; - this.pause = pause; - } - - public void a() { - // System.out.println("Execute edge: a"); - } - - public void b() { - if (pause) { - ModelBasedTesting model = MultipleModels.getInstance().getModel(modelName); - model.setFuture(new FutureTaskImpl("b is finished for model " + modelName, 1, TimeUnit.SECONDS)); - } - - } - - public void c() { - // System.out.println("Execute edge: c"); - - } - - public void d() { - // System.out.println("Execute edge: d"); - - } - - public void e() { - // System.out.println("Execute edge: e"); - - } - - public void f() { - // System.out.println("Execute edge: f"); - - } - - // Vertices - public void A() { - // System.out.println("Execute vertex: A for model " + modelName); - - } - - public void B() { - // System.out.println("Execute vertex: B"); - - } - - public void C() throws StopConditionException, GeneratorException, IOException, JDOMException, InterruptedException { - if (spawn) { - MultipleModels mmInstance = MultipleModels.getInstance(); - ModelBasedTesting modelB = Util.getNewMbtFromXml(Util.getFile("xml/multipleB.xml")); - - mmInstance.addModel(spawnedModelName, modelB); - - if (pause) { - mmInstance.executeModel(spawnedModelName, new ModelAPI(spawnedModelName, "", false, true)); - } else { - mmInstance.executeModel(spawnedModelName, new ModelAPI(spawnedModelName)); - - } - } - - } - - public void D() { - // System.out.println("Execute vertex: D"); - - } - - public void E() { - // System.out.println("Execute vertex: E"); - - } - - public void F() { - - } - } - - public class FutureTaskImpl implements Future { - private String result; - private long createdTime; - private long computationTime; - private boolean isDone; - private boolean isCancelled; - - public FutureTaskImpl(String desiredResult, long computationTime, TimeUnit unit) { - result = desiredResult; - createdTime = System.currentTimeMillis(); - this.computationTime = TimeUnit.MILLISECONDS.convert(computationTime, unit); - isDone = false; - isCancelled = false; - } - - @Override - public boolean cancel(boolean mayInterruptIfRunning) { - if (isDone) { - return false; - } else { - isCancelled = true; - isDone = true; - return true; - } - } - - @Override - public String get() throws InterruptedException, ExecutionException { - while (!isDone()) { - Thread.sleep(10); - } - return result; - } - - @Override - public String get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { - long startedTime = System.currentTimeMillis(); - while (!isDone()) { - if (System.currentTimeMillis() >= startedTime + TimeUnit.MILLISECONDS.convert(timeout, unit)) { - throw new TimeoutException("Future task timed out."); - } - Thread.sleep(10); - } - return result; - } - - @Override - public boolean isCancelled() { - return isCancelled; - } - - @Override - public boolean isDone() { - if (!isDone) { - if (System.currentTimeMillis() >= createdTime + computationTime) { - isDone = true; - } - } - return isDone; - } - - } - -} diff --git a/src/test/java/org/graphwalker/RequirementVariableTest.java b/src/test/java/org/graphwalker/RequirementVariableTest.java deleted file mode 100644 index 54b40d05..00000000 --- a/src/test/java/org/graphwalker/RequirementVariableTest.java +++ /dev/null @@ -1,235 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker; - -import org.graphwalker.Util; -import org.graphwalker.conditions.TestCaseLength; -import org.graphwalker.generators.RandomPathGenerator; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; -import org.graphwalker.machines.FiniteStateMachine; - -import junit.framework.TestCase; - -public class RequirementVariableTest extends TestCase { - - Graph graph; - Vertex start; - Vertex v1; - Vertex v2; - Edge e1; - Edge e2; - Edge e3; - Edge e4; - - @Override - protected void setUp() throws Exception { - super.setUp(); - graph = new Graph(); - - start = Util.addVertexToGraph(graph, "Start"); - - v1 = Util.addVertexToGraph(graph, "V1"); - - v2 = Util.addVertexToGraph(graph, "V2"); - v2.setReqTagKey("REQ004,${reqvar}"); - - e1 = Util.addEdgeToGraph(graph, start, v1, "E1", null, null, ""); - e1.setActionsKey("reqvar=\"REQ002,REQ003\""); - - e2 = Util.addEdgeToGraph(graph, v1, v2, "E2", null, null, ""); - e2.setActionsKey("reqvar=reqvar + \",REQ005\" + \",REQ007\""); - - e3 = Util.addEdgeToGraph(graph, v2, v1, "E3", null, null, ""); - - e4 = Util.addEdgeToGraph(graph, v1, v2, "E2", null, null, ""); - e4.setActionsKey("reqvar=\"REQ006\""); - } - - public void testRequirements() { - // ExtendedFiniteStateMachine EFSM = new ExtendedFiniteStateMachine(false); - - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.enableExtended(true); - FiniteStateMachine EFSM = mbt.getMachine(); - mbt.setGenerator(new RandomPathGenerator(new TestCaseLength(10))); - - EFSM.setModel(graph); - mbt.populateMachineRequirementHashTable(); - EFSM.walkEdge(e1); - EFSM.walkEdge(e2); - mbt.passRequirement(true); - String[] tmp = EFSM.getStatisticsVerbose().split("\n"); - int numberOfExpectedAssersions = 0; - for (int i = 0; i < tmp.length; i++) { - if (tmp[i].contains("REQ002")) { - assertEquals("Requirement: REQ002 has passed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ003")) { - assertEquals("Requirement: REQ003 has passed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ004")) { - assertEquals("Requirement: REQ004 has passed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ005")) { - assertEquals("Requirement: REQ005 has passed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ006")) { - assertEquals("Requirement: REQ006 is not tested.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ007")) { - assertEquals("Requirement: REQ007 has passed.", tmp[i]); - numberOfExpectedAssersions++; - } - } - assertEquals(6, numberOfExpectedAssersions); - numberOfExpectedAssersions = 0; - - EFSM.walkEdge(e3); - EFSM.walkEdge(e4); - mbt.passRequirement(false); - tmp = EFSM.getStatisticsVerbose().split("\n"); - for (int i = 0; i < tmp.length; i++) { - if (tmp[i].contains("REQ002")) { - assertEquals("Requirement: REQ002 has passed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ003")) { - assertEquals("Requirement: REQ003 has passed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ004")) { - assertEquals("Requirement: REQ004 has failed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ005")) { - assertEquals("Requirement: REQ005 has passed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ006")) { - assertEquals("Requirement: REQ006 has failed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ007")) { - assertEquals("Requirement: REQ007 has passed.", tmp[i]); - numberOfExpectedAssersions++; - } - } - assertEquals(6, numberOfExpectedAssersions); - numberOfExpectedAssersions = 0; - - EFSM.walkEdge(e3); - EFSM.walkEdge(e2); - mbt.passRequirement(false); - tmp = EFSM.getStatisticsVerbose().split("\n"); - for (int i = 0; i < tmp.length; i++) { - if (tmp[i].contains("REQ002")) { - assertEquals("Requirement: REQ002 has passed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ003")) { - assertEquals("Requirement: REQ003 has passed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ004")) { - assertEquals("Requirement: REQ004 has failed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ005")) { - assertEquals("Requirement: REQ005 has failed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ006")) { - assertEquals("Requirement: REQ006 has failed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ007")) { - assertEquals("Requirement: REQ007 has failed.", tmp[i]); - numberOfExpectedAssersions++; - } - } - assertEquals(6, numberOfExpectedAssersions); - numberOfExpectedAssersions = 0; - - EFSM.walkEdge(e3); - EFSM.walkEdge(e2); - mbt.passRequirement(true); - for (int i = 0; i < tmp.length; i++) { - if (tmp[i].contains("REQ002")) { - assertEquals("Requirement: REQ002 has passed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ003")) { - assertEquals("Requirement: REQ003 has passed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ004")) { - assertEquals("Requirement: REQ004 has failed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ005")) { - assertEquals("Requirement: REQ005 has failed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ006")) { - assertEquals("Requirement: REQ006 has failed.", tmp[i]); - numberOfExpectedAssersions++; - } - if (tmp[i].contains("REQ007")) { - assertEquals("Requirement: REQ007 has failed.", tmp[i]); - numberOfExpectedAssersions++; - } - } - assertEquals(6, numberOfExpectedAssersions); - - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } - - public void testRequirementsWalk() { - // ExtendedFiniteStateMachine EFSM = new ExtendedFiniteStateMachine(false); - // EFSM.setModel(graph); - // assertEquals("Start", EFSM.getCurrentVertexName()); - // EFSM.walkEdge(e1); - // assertEquals("V1/x=1;y=[];", EFSM.getCurrentVertexName()); - // assertEquals("{REQ001=1, REQ004=0, REQ003=0, REQ002=2}", - // EFSM.getAllRequirements().toString()); - // assertEquals("[REQ001, REQ002]", - // EFSM.getCoveredRequirements().toString()); - // EFSM.walkEdge(e2); - // assertEquals("V2/x=2;y=[];", EFSM.getCurrentVertexName()); - // assertEquals("{REQ001=1, REQ004=1, REQ003=1, REQ002=2}", - // EFSM.getAllRequirements().toString()); - // assertEquals("[REQ001, REQ004, REQ003, REQ002]", - // EFSM.getCoveredRequirements().toString()); - } -} diff --git a/src/test/java/org/graphwalker/SoapServiceTest.java b/src/test/java/org/graphwalker/SoapServiceTest.java deleted file mode 100644 index 1312cd88..00000000 --- a/src/test/java/org/graphwalker/SoapServiceTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.graphwalker; - -import org.junit.Test; - -public class SoapServiceTest { - - @Test(expected = RuntimeException.class) - public void testGetDataValue() { - SoapServices ss = new SoapServices(new ModelBasedTesting()); - ss.GetDataValue(null); - } - -} diff --git a/src/test/java/org/graphwalker/StatisticsManagerTest.java b/src/test/java/org/graphwalker/StatisticsManagerTest.java deleted file mode 100644 index 078ae280..00000000 --- a/src/test/java/org/graphwalker/StatisticsManagerTest.java +++ /dev/null @@ -1,208 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker; - -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; - -import org.graphwalker.StatisticsManager; -import org.graphwalker.Util; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; -import org.graphwalker.statistics.EdgeCoverageStatistics; -import org.graphwalker.statistics.EdgeSequenceCoverageStatistics; -import org.graphwalker.statistics.RequirementCoverageStatistics; -import org.graphwalker.statistics.VertexCoverageStatistics; - -import junit.framework.TestCase; - -/** - * @author Johan Tejle - * - */ -public class StatisticsManagerTest extends TestCase { - - Graph graph; - Vertex start; - Vertex v1; - Vertex v2; - Edge e1; - Edge e2; - Edge e3; - Edge e4; - - @Override - protected void setUp() throws Exception { - super.setUp(); - graph = new Graph(); - - start = Util.addVertexToGraph(graph, "Start"); - - v1 = Util.addVertexToGraph(graph, "V1"); - v1.setReqTagKey("REQ002"); - - v2 = Util.addVertexToGraph(graph, "V2"); - v2.setReqTagKey("REQ004"); - - e1 = Util.addEdgeToGraph(graph, start, v1, "E1", null, null, "x=1;y=new Vector()"); - e1.setReqTagKey("REQ001,REQ002"); - - e2 = Util.addEdgeToGraph(graph, v1, v2, "E2", null, null, "x=2"); - e2.setReqTagKey("REQ003"); - - e3 = Util.addEdgeToGraph(graph, v2, v2, "E3", null, "x<6", "x++"); - - e4 = Util.addEdgeToGraph(graph, v2, v1, "E4", null, "y.size()<3", "y.add(x)"); - } - - public void testConstructor() { - new StatisticsManager(); - } - - public void testAdd() { - StatisticsManager statisticsManager = new StatisticsManager(); - statisticsManager.addStatisicsCounter("State Coverage", new VertexCoverageStatistics(graph)); - statisticsManager.addStatisicsCounter("Edge Coverage", new EdgeCoverageStatistics(graph)); - statisticsManager.addStatisicsCounter("2-Edge Sequence Coverage", new EdgeSequenceCoverageStatistics(graph, 2)); - statisticsManager.addStatisicsCounter("3-Edge Sequence Coverage", new EdgeSequenceCoverageStatistics(graph, 3)); - statisticsManager.addStatisicsCounter("Requirements Coverage", new RequirementCoverageStatistics(graph)); - assertEquals("[Requirements Coverage, Edge Coverage, State Coverage, 3-Edge Sequence Coverage, 2-Edge Sequence Coverage]", - statisticsManager.getCounterNames().toString()); - } - - public void testProgress() { - StatisticsManager statisticsManager = new StatisticsManager(); - statisticsManager.addStatisicsCounter("State Coverage", new VertexCoverageStatistics(graph)); - statisticsManager.addStatisicsCounter("Edge Coverage", new EdgeCoverageStatistics(graph)); - statisticsManager.addStatisicsCounter("2-Edge Sequence Coverage", new EdgeSequenceCoverageStatistics(graph, 2)); - statisticsManager.addStatisicsCounter("3-Edge Sequence Coverage", new EdgeSequenceCoverageStatistics(graph, 3)); - statisticsManager.addStatisicsCounter("Requirements Coverage", new RequirementCoverageStatistics(graph)); - statisticsManager.addProgress(start); - assertEquals( - true, - statisticsManager - .getCurrentStatisticXml() - .matches( - "<\\?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"\\?>\\s+\\s+")); - statisticsManager.addProgress(e1); - assertEquals( - true, - statisticsManager - .getCurrentStatisticXml() - .matches( - "<\\?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"\\?>\\s+\\s+")); - statisticsManager.addProgress(v1); - assertEquals( - true, - statisticsManager - .getCurrentStatisticXml() - .matches( - "<\\?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"\\?>\\s+\\s+")); - statisticsManager.addProgress(e2); - assertEquals( - true, - statisticsManager - .getCurrentStatisticXml() - .matches( - "<\\?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"\\?>\\s+\\s+")); - statisticsManager.addProgress(v2); - assertEquals( - true, - statisticsManager - .getCurrentStatisticXml() - .matches( - "<\\?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"\\?>\\s+\\s+")); - statisticsManager.addProgress(e3); - assertEquals( - true, - statisticsManager - .getCurrentStatisticXml() - .matches( - "<\\?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"\\?>\\s+\\s+")); - statisticsManager.addProgress(e4); - assertEquals( - true, - statisticsManager - .getCurrentStatisticXml() - .matches( - "<\\?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"\\?>\\s+\\s+")); - } - - public void testFullProgress() { - StatisticsManager statisticsManager = new StatisticsManager(); - statisticsManager.addStatisicsCounter("State Coverage", new VertexCoverageStatistics(graph)); - statisticsManager.addStatisicsCounter("Edge Coverage", new EdgeCoverageStatistics(graph)); - statisticsManager.addStatisicsCounter("2-Edge Sequence Coverage", new EdgeSequenceCoverageStatistics(graph, 2)); - statisticsManager.addStatisicsCounter("3-Edge Sequence Coverage", new EdgeSequenceCoverageStatistics(graph, 3)); - statisticsManager.addStatisicsCounter("Requirements Coverage", new RequirementCoverageStatistics(graph)); - statisticsManager.addProgress(start); - statisticsManager.addProgress(e1); - statisticsManager.addProgress(v1); - statisticsManager.addProgress(e2); - statisticsManager.addProgress(v2); - statisticsManager.addProgress(e3); - statisticsManager.addProgress(e4); - assertEquals( - true, - statisticsManager - .getFullProgressXml() - .matches( - "<\\?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"\\?>\\s+\\s+")); - } - - public void testFullProgressReport() { - StatisticsManager statisticsManager = new StatisticsManager(); - statisticsManager.addStatisicsCounter("State Coverage", new VertexCoverageStatistics(graph)); - statisticsManager.addStatisicsCounter("Edge Coverage", new EdgeCoverageStatistics(graph)); - statisticsManager.addStatisicsCounter("2-Edge Sequence Coverage", new EdgeSequenceCoverageStatistics(graph, 2)); - statisticsManager.addStatisicsCounter("3-Edge Sequence Coverage", new EdgeSequenceCoverageStatistics(graph, 3)); - statisticsManager.addStatisicsCounter("Requirements Coverage", new RequirementCoverageStatistics(graph)); - statisticsManager.addProgress(start); - statisticsManager.addProgress(e1); - statisticsManager.addProgress(v1); - statisticsManager.addProgress(e2); - statisticsManager.addProgress(v2); - statisticsManager.addProgress(e3); - statisticsManager.addProgress(e4); - statisticsManager.setReportTemplate(getClass().getClassLoader().getResourceAsStream("templates/short.report")); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - statisticsManager.writeFullReport(new PrintStream(out)); - assertEquals( - "" - + Util.newline - + "" - + Util.newline - + "" + Util.newline + "" - + Util.newline + "" + Util.newline + "" + Util.newline - + "" + Util.newline + "" + Util.newline - + "" + Util.newline + "" + Util.newline - + "" + Util.newline + "" + Util.newline - + "" + Util.newline + "
\"Coverage\" Edge Coverage
State Coverage
2-Edge Sequence Coverage
3-Edge Sequence Coverage
" + Util.newline, out.toString()); - } - -} diff --git a/src/test/java/org/graphwalker/UtilTest.java b/src/test/java/org/graphwalker/UtilTest.java deleted file mode 100644 index e01435f1..00000000 --- a/src/test/java/org/graphwalker/UtilTest.java +++ /dev/null @@ -1,85 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker; - -import org.apache.log4j.Logger; -import org.graphwalker.Util; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; - -import junit.framework.TestCase; - -public class UtilTest extends TestCase { - - public void testAbortIf_1() { - try { - Util.AbortIf(true, "Working"); - fail("expected error message"); - } catch (Exception e) { - assertEquals("Working", e.getMessage()); - } - } - - public void testAbortIf_2() { - Util.AbortIf(false, "Working"); - } - - public void testGetCompleteEdgeName() { - Graph graph = new Graph(); - Vertex v1 = new Vertex(); - v1.setIndexKey(new Integer(1)); - v1.setLabelKey("V1"); - graph.addVertex(v1); - Vertex v2 = new Vertex(); - v2.setIndexKey(new Integer(2)); - v2.setLabelKey("V2"); - graph.addVertex(v2); - Edge edge = new Edge(); - edge.setIndexKey(new Integer(3)); - edge.setLabelKey("E1"); - graph.addEdge(edge, v1, v2); - - assertEquals("Edge: 'E1', INDEX=3", edge.toString()); - } - - public void testGetCompleteVertexName() { - Graph graph = new Graph(); - Vertex v1 = new Vertex(); - v1.setIndexKey(new Integer(1)); - v1.setLabelKey("V1"); - graph.addVertex(v1); - - assertEquals("Vertex: 'V1', INDEX=1", v1.toString()); - } - - public void testSetupLogger() { - Logger logger = Util.setupLogger(UtilTest.class); - logger.debug("Working"); - } - - public void testReadPropertySOAP_GUI() { - assertEquals(true, Util.readSoapGuiStartupState() == true || Util.readSoapGuiStartupState() == false); - } -} diff --git a/src/test/java/org/graphwalker/bugs/Issue_10.java b/src/test/java/org/graphwalker/bugs/Issue_10.java deleted file mode 100644 index 6295df15..00000000 --- a/src/test/java/org/graphwalker/bugs/Issue_10.java +++ /dev/null @@ -1,104 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.bugs; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintStream; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.log4j.Logger; -import org.graphwalker.CLI; -import org.graphwalker.CLITest; -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.Util; - -import junit.framework.TestCase; - -public class Issue_10 extends TestCase { - - Pattern pattern; - Matcher matcher; - StringBuffer stdOutput; - StringBuffer errOutput; - String outMsg; - String errMsg; - static Logger logger = Util.setupLogger(CLITest.class); - - @Override - protected void setUp() throws Exception { - super.setUp(); - ModelBasedTesting.getInstance().reset(); - } - - private OutputStream redirectOut() { - return new OutputStream() { - @Override - public void write(int b) throws IOException { - // Redirect to nothing, else we'll get an OutOfMemoryException - // stdOutput.append( Character.toString((char) b) ); - } - }; - } - - private OutputStream redirectErr() { - return new OutputStream() { - @Override - public void write(int b) throws IOException { - errOutput.append(Character.toString((char) b)); - } - }; - } - - private void runCommand(String args[]) { - stdOutput = new StringBuffer(); - errOutput = new StringBuffer(); - - PrintStream outStream = new PrintStream(redirectOut()); - PrintStream oldOutStream = System.out; // backup - PrintStream errStream = new PrintStream(redirectErr()); - PrintStream oldErrStream = System.err; // backup - - System.setOut(outStream); - System.setErr(errStream); - - CLI.main(args); - - System.setOut(oldOutStream); - System.setErr(oldErrStream); - - outMsg = stdOutput.toString(); - errMsg = errOutput.toString(); - logger.debug("stdout: " + outMsg); - logger.debug("stderr: " + errMsg); - } - - // - public void testIssue_10() { - String args[] = { "xml", "-f", "xml/bugs/Issue_10.xml" }; - runCommand(args); - assertTrue(errMsg, errMsg.isEmpty()); - } -} diff --git a/src/test/java/org/graphwalker/bugs/Issue_9.java b/src/test/java/org/graphwalker/bugs/Issue_9.java deleted file mode 100644 index e4800b0e..00000000 --- a/src/test/java/org/graphwalker/bugs/Issue_9.java +++ /dev/null @@ -1,105 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.bugs; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintStream; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.log4j.Logger; -import org.graphwalker.CLI; -import org.graphwalker.CLITest; -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.Util; - -import junit.framework.TestCase; - -public class Issue_9 extends TestCase { - - Pattern pattern; - Matcher matcher; - StringBuffer stdOutput; - StringBuffer errOutput; - String outMsg; - String errMsg; - static Logger logger = Util.setupLogger(CLITest.class); - - @Override - protected void setUp() throws Exception { - super.setUp(); - ModelBasedTesting.getInstance().reset(); - } - - private OutputStream redirectOut() { - return new OutputStream() { - @Override - public void write(int b) throws IOException { - // Redirect to nothing, else we'll get an OutOfMemoryException - // stdOutput.append( Character.toString((char) b) ); - } - }; - } - - private OutputStream redirectErr() { - return new OutputStream() { - @Override - public void write(int b) throws IOException { - errOutput.append(Character.toString((char) b)); - } - }; - } - - private void runCommand(String args[]) { - stdOutput = new StringBuffer(); - errOutput = new StringBuffer(); - - PrintStream outStream = new PrintStream(redirectOut()); - PrintStream oldOutStream = System.out; // backup - PrintStream errStream = new PrintStream(redirectErr()); - PrintStream oldErrStream = System.err; // backup - - System.setOut(outStream); - System.setErr(errStream); - - CLI.main(args); - - System.setOut(oldOutStream); - System.setErr(oldErrStream); - - outMsg = stdOutput.toString(); - errMsg = errOutput.toString(); - logger.debug("stdout: " + outMsg); - logger.debug("stderr: " + errMsg); - } - - // Test will excute during 35 seconds - public void testIssue_9() { - System.out.println("Test will excute during 35 seconds"); - String args[] = { "xml", "-f", "xml/bugs/Issue_9.xml" }; - runCommand(args); - assertTrue(errMsg, errMsg.isEmpty()); - } -} diff --git a/src/test/java/org/graphwalker/conditions/AlternativeConditionTest.java b/src/test/java/org/graphwalker/conditions/AlternativeConditionTest.java deleted file mode 100644 index bfcf8176..00000000 --- a/src/test/java/org/graphwalker/conditions/AlternativeConditionTest.java +++ /dev/null @@ -1,56 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import org.graphwalker.conditions.AlternativeCondition; -import org.graphwalker.conditions.NeverCondition; - -import junit.framework.TestCase; - -public class AlternativeConditionTest extends TestCase { - - public void testConstructor() { - new AlternativeCondition(); - } - - public void testFulfillment() { - AlternativeCondition condition = new AlternativeCondition(); - condition.add(new NeverCondition()); - assertEquals(0, condition.getFulfilment(), 0.01); - condition.add(new NeverCondition()); - assertEquals(0, condition.getFulfilment(), 0.01); - condition.add(new NeverCondition()); - assertEquals(0, condition.getFulfilment(), 0.01); - } - - public void testIsFulfilled() { - AlternativeCondition condition = new AlternativeCondition(); - condition.add(new NeverCondition()); - assertEquals(false, condition.isFulfilled()); - condition.add(new NeverCondition()); - assertEquals(false, condition.isFulfilled()); - condition.add(new NeverCondition()); - assertEquals(false, condition.isFulfilled()); - } -} diff --git a/src/test/java/org/graphwalker/conditions/CombinationalConditionTest.java b/src/test/java/org/graphwalker/conditions/CombinationalConditionTest.java deleted file mode 100644 index 9187d4da..00000000 --- a/src/test/java/org/graphwalker/conditions/CombinationalConditionTest.java +++ /dev/null @@ -1,52 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import org.graphwalker.conditions.CombinationalCondition; -import org.graphwalker.conditions.NeverCondition; - -import junit.framework.TestCase; - -public class CombinationalConditionTest extends TestCase { - - public void testConstructor() { - new CombinationalCondition(); - } - - public void testFulfillment() { - CombinationalCondition condition = new CombinationalCondition(); - condition.add(new NeverCondition()); - assertEquals(0, condition.getFulfilment(), 0.01); - } - - public void testIsFulfilled() { - CombinationalCondition condition = new CombinationalCondition(); - condition.add(new NeverCondition()); - assertEquals(false, condition.isFulfilled()); - condition.add(new NeverCondition()); - assertEquals(false, condition.isFulfilled()); - condition.add(new NeverCondition()); - assertEquals(false, condition.isFulfilled()); - } -} diff --git a/src/test/java/org/graphwalker/conditions/EdgeCoverageTest.java b/src/test/java/org/graphwalker/conditions/EdgeCoverageTest.java deleted file mode 100644 index 867cee66..00000000 --- a/src/test/java/org/graphwalker/conditions/EdgeCoverageTest.java +++ /dev/null @@ -1,94 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.Util; -import org.graphwalker.conditions.EdgeCoverage; -import org.graphwalker.exceptions.GeneratorException; -import org.graphwalker.exceptions.StopConditionException; -import org.graphwalker.generators.RandomPathGenerator; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; - -import junit.framework.TestCase; - -public class EdgeCoverageTest extends TestCase { - - Graph graph; - Vertex start; - Vertex v1; - Vertex v2; - Edge e0; - Edge e1; - - @Override - protected void setUp() throws Exception { - super.setUp(); - graph = new Graph(); - - start = Util.addVertexToGraph(graph, "Start"); - v1 = Util.addVertexToGraph(graph, "V1"); - v2 = Util.addVertexToGraph(graph, "V2"); - - e0 = Util.addEdgeToGraph(graph, start, v1, "E0", null, null, null); - e1 = Util.addEdgeToGraph(graph, v1, v2, "E1", null, null, null); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - graph = null; - start = v1 = v2 = null; - e0 = e1 = null; - } - - public void testFulfillment() throws StopConditionException, GeneratorException, InterruptedException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGraph(graph); - mbt.setGenerator(new RandomPathGenerator(new EdgeCoverage())); - assertTrue(mbt.hasNextStep()); - - assertEquals((double) 0 / 2, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - mbt.getNextStep(); - assertEquals((double) 1 / 2, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - mbt.getNextStep(); - assertEquals((double) 2 / 2, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - } - - public void testIsFulfilled() throws StopConditionException, GeneratorException, InterruptedException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGraph(graph); - mbt.setGenerator(new RandomPathGenerator(new EdgeCoverage())); - assertTrue(mbt.hasNextStep()); - - assertEquals(false, mbt.getGenerator().getStopCondition().isFulfilled()); - mbt.getNextStep(); - assertEquals(false, mbt.getGenerator().getStopCondition().isFulfilled()); - mbt.getNextStep(); - assertEquals(true, mbt.getGenerator().getStopCondition().isFulfilled()); - } - -} diff --git a/src/test/java/org/graphwalker/conditions/ReachedEdgeTest.java b/src/test/java/org/graphwalker/conditions/ReachedEdgeTest.java deleted file mode 100644 index 2242488b..00000000 --- a/src/test/java/org/graphwalker/conditions/ReachedEdgeTest.java +++ /dev/null @@ -1,99 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.Util; -import org.graphwalker.conditions.ReachedEdge; -import org.graphwalker.exceptions.GeneratorException; -import org.graphwalker.generators.RandomPathGenerator; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; - -import junit.framework.TestCase; - -public class ReachedEdgeTest extends TestCase { - - Graph graph; - Vertex start; - Vertex v1; - Vertex v2; - Edge e0; - Edge e1; - - @Override - protected void setUp() throws Exception { - super.setUp(); - ModelBasedTesting.getInstance().reset(); - graph = new Graph(); - - start = Util.addVertexToGraph(graph, "Start"); - v1 = Util.addVertexToGraph(graph, "V1"); - v2 = Util.addVertexToGraph(graph, "V2"); - - e0 = Util.addEdgeToGraph(graph, start, v1, "E0", null, null, null); - e1 = Util.addEdgeToGraph(graph, v1, v2, "E1", null, null, null); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - graph = null; - start = v1 = v2 = null; - e0 = e1 = null; - } - - public void testConstructor() { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGenerator(new RandomPathGenerator(new ReachedEdge("E1"))); - } - - public void testFulfillment() throws GeneratorException, InterruptedException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGraph(graph); - mbt.setGenerator(new RandomPathGenerator(new ReachedEdge("E1"))); - assertTrue(mbt.hasNextStep()); - - assertEquals(0, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - mbt.getNextStep(); - assertEquals(0, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - mbt.getNextStep(); - assertEquals(1, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - } - - public void testIsFulfilled() throws GeneratorException, InterruptedException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGraph(graph); - mbt.setGenerator(new RandomPathGenerator(new ReachedEdge("E1"))); - assertTrue(mbt.hasNextStep()); - - assertEquals(false, mbt.getGenerator().getStopCondition().isFulfilled()); - mbt.getNextStep(); - assertEquals(false, mbt.getGenerator().getStopCondition().isFulfilled()); - mbt.getNextStep(); - assertEquals(true, mbt.getGenerator().getStopCondition().isFulfilled()); - } - -} diff --git a/src/test/java/org/graphwalker/conditions/ReachedRequirementTest.java b/src/test/java/org/graphwalker/conditions/ReachedRequirementTest.java deleted file mode 100644 index 0a1883b2..00000000 --- a/src/test/java/org/graphwalker/conditions/ReachedRequirementTest.java +++ /dev/null @@ -1,103 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.Util; -import org.graphwalker.conditions.ReachedRequirement; -import org.graphwalker.exceptions.GeneratorException; -import org.graphwalker.generators.RandomPathGenerator; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; - -import junit.framework.TestCase; - -public class ReachedRequirementTest extends TestCase { - Graph graph; - Vertex start; - Vertex v1; - Vertex v2; - Edge e0; - Edge e1; - - @Override - protected void setUp() throws Exception { - super.setUp(); - ModelBasedTesting.getInstance().reset(); - graph = new Graph(); - - start = Util.addVertexToGraph(graph, "Start"); - v1 = Util.addVertexToGraph(graph, "V1"); - v2 = Util.addVertexToGraph(graph, "V2"); - - v1.setReqTagKey("R1"); - v2.setReqTagKey("R2"); - - e0 = Util.addEdgeToGraph(graph, start, v1, "E0", null, null, null); - e1 = Util.addEdgeToGraph(graph, v1, v2, "E1", null, null, null); - - e0.setReqTagKey("R3"); - e1.setReqTagKey("R4"); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - graph = null; - start = v1 = v2 = null; - e0 = e1 = null; - } - - public void testConstructor() { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGenerator(new RandomPathGenerator(new ReachedRequirement("R4"))); - } - - public void testFulfillment() throws GeneratorException, InterruptedException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGraph(graph); - mbt.setGenerator(new RandomPathGenerator(new ReachedRequirement("R4"))); - assertTrue(mbt.hasNextStep()); - - assertEquals(0, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - mbt.getNextStep(); - assertEquals(0, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - mbt.getNextStep(); - assertEquals(1, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - } - - public void testIsFulfilled() throws GeneratorException, InterruptedException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGraph(graph); - mbt.setGenerator(new RandomPathGenerator(new ReachedRequirement("R4"))); - assertTrue(mbt.hasNextStep()); - - assertEquals(false, mbt.getGenerator().getStopCondition().isFulfilled()); - mbt.getNextStep(); - assertEquals(false, mbt.getGenerator().getStopCondition().isFulfilled()); - mbt.getNextStep(); - assertEquals(true, mbt.getGenerator().getStopCondition().isFulfilled()); - } -} diff --git a/src/test/java/org/graphwalker/conditions/ReachedStateTest.java b/src/test/java/org/graphwalker/conditions/ReachedStateTest.java deleted file mode 100644 index 66a5f849..00000000 --- a/src/test/java/org/graphwalker/conditions/ReachedStateTest.java +++ /dev/null @@ -1,98 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.Util; -import org.graphwalker.conditions.ReachedVertex; -import org.graphwalker.exceptions.GeneratorException; -import org.graphwalker.generators.RandomPathGenerator; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; - -import junit.framework.TestCase; - -public class ReachedStateTest extends TestCase { - Graph graph; - Vertex start; - Vertex v1; - Vertex v2; - Edge e0; - Edge e1; - - @Override - protected void setUp() throws Exception { - super.setUp(); - ModelBasedTesting.getInstance().reset(); - graph = new Graph(); - - start = Util.addVertexToGraph(graph, "Start"); - v1 = Util.addVertexToGraph(graph, "V1"); - v2 = Util.addVertexToGraph(graph, "V2"); - - e0 = Util.addEdgeToGraph(graph, start, v1, "E0", null, null, null); - e1 = Util.addEdgeToGraph(graph, v1, v2, "E1", null, null, null); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - graph = null; - start = v1 = v2 = null; - e0 = e1 = null; - } - - public void testConstructor() { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGenerator(new RandomPathGenerator(new ReachedVertex("V2"))); - } - - public void testFulfillment() throws GeneratorException, InterruptedException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGraph(graph); - mbt.setGenerator(new RandomPathGenerator(new ReachedVertex("V2"))); - assertTrue(mbt.hasNextStep()); - - assertEquals(0, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - mbt.getNextStep(); - assertEquals(0.5, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - mbt.getNextStep(); - assertEquals(1, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - } - - public void testIsFulfilled() throws GeneratorException, InterruptedException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGraph(graph); - mbt.setGenerator(new RandomPathGenerator(new ReachedVertex("V2"))); - assertTrue(mbt.hasNextStep()); - - assertEquals(false, mbt.getGenerator().getStopCondition().isFulfilled()); - mbt.getNextStep(); - assertEquals(false, mbt.getGenerator().getStopCondition().isFulfilled()); - mbt.getNextStep(); - assertEquals(true, mbt.getGenerator().getStopCondition().isFulfilled()); - } - -} diff --git a/src/test/java/org/graphwalker/conditions/RequirementCoverageTest.java b/src/test/java/org/graphwalker/conditions/RequirementCoverageTest.java deleted file mode 100644 index 020682e6..00000000 --- a/src/test/java/org/graphwalker/conditions/RequirementCoverageTest.java +++ /dev/null @@ -1,105 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.Util; -import org.graphwalker.conditions.RequirementCoverage; -import org.graphwalker.exceptions.GeneratorException; -import org.graphwalker.generators.RandomPathGenerator; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; - -import junit.framework.TestCase; - -public class RequirementCoverageTest extends TestCase { - - Graph graph; - Vertex start; - Vertex v1; - Vertex v2; - Edge e0; - Edge e1; - - @Override - protected void setUp() throws Exception { - super.setUp(); - ModelBasedTesting.getInstance().reset(); - graph = new Graph(); - - start = Util.addVertexToGraph(graph, "Start"); - v1 = Util.addVertexToGraph(graph, "V1"); - v2 = Util.addVertexToGraph(graph, "V2"); - - v1.setReqTagKey("R1"); - v2.setReqTagKey("R2"); - - e0 = Util.addEdgeToGraph(graph, start, v1, "E0", null, null, null); - e1 = Util.addEdgeToGraph(graph, v1, v2, "E1", null, null, null); - - e0.setReqTagKey("R3"); - e1.setReqTagKey("R4"); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - graph = null; - start = v1 = v2 = null; - e0 = e1 = null; - } - - public void testConstructor() { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGenerator(new RandomPathGenerator(new RequirementCoverage())); - } - - public void testFulfillment() throws GeneratorException, InterruptedException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGraph(graph); - mbt.setGenerator(new RandomPathGenerator(new RequirementCoverage())); - assertTrue(mbt.hasNextStep()); - - assertEquals((double) 0 / 4, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - mbt.getNextStep(); - assertEquals((double) 2 / 4, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - mbt.getNextStep(); - assertEquals((double) 4 / 4, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - } - - public void testIsFulfilled() throws GeneratorException, InterruptedException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGraph(graph); - mbt.setGenerator(new RandomPathGenerator(new RequirementCoverage())); - assertTrue(mbt.hasNextStep()); - - assertEquals(false, mbt.getGenerator().getStopCondition().isFulfilled()); - mbt.getNextStep(); - assertEquals(false, mbt.getGenerator().getStopCondition().isFulfilled()); - mbt.getNextStep(); - assertEquals(true, mbt.getGenerator().getStopCondition().isFulfilled()); - } - -} diff --git a/src/test/java/org/graphwalker/conditions/StateCoverageTest.java b/src/test/java/org/graphwalker/conditions/StateCoverageTest.java deleted file mode 100644 index aa48061a..00000000 --- a/src/test/java/org/graphwalker/conditions/StateCoverageTest.java +++ /dev/null @@ -1,97 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.Util; -import org.graphwalker.conditions.VertexCoverage; -import org.graphwalker.exceptions.GeneratorException; -import org.graphwalker.exceptions.StopConditionException; -import org.graphwalker.generators.RandomPathGenerator; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; - -import junit.framework.TestCase; - -public class StateCoverageTest extends TestCase { - Graph graph; - Vertex start; - Vertex v1; - Vertex v2; - Edge e0; - Edge e1; - - @Override - protected void setUp() throws Exception { - super.setUp(); - graph = new Graph(); - - start = Util.addVertexToGraph(graph, "Start"); - v1 = Util.addVertexToGraph(graph, "V1"); - v2 = Util.addVertexToGraph(graph, "V2"); - - e0 = Util.addEdgeToGraph(graph, start, v1, "E0", null, null, null); - e1 = Util.addEdgeToGraph(graph, v1, v2, "E1", null, null, null); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - graph = null; - start = v1 = v2 = null; - e0 = e1 = null; - } - - public void testConstructor() throws StopConditionException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGenerator(new RandomPathGenerator(new VertexCoverage())); - } - - public void testFulfillment() throws StopConditionException, GeneratorException, InterruptedException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGraph(graph); - mbt.setGenerator(new RandomPathGenerator(new VertexCoverage())); - assertTrue(mbt.hasNextStep()); - - assertEquals((double) 1 / 3, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - mbt.getNextStep(); - assertEquals((double) 2 / 3, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - mbt.getNextStep(); - assertEquals((double) 3 / 3, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - } - - public void testIsFulfilled() throws StopConditionException, GeneratorException, InterruptedException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGraph(graph); - mbt.setGenerator(new RandomPathGenerator(new VertexCoverage())); - assertTrue(mbt.hasNextStep()); - - assertEquals(false, mbt.getGenerator().getStopCondition().isFulfilled()); - mbt.getNextStep(); - assertEquals(false, mbt.getGenerator().getStopCondition().isFulfilled()); - mbt.getNextStep(); - assertEquals(true, mbt.getGenerator().getStopCondition().isFulfilled()); - } -} diff --git a/src/test/java/org/graphwalker/conditions/TestCaseLengthTest.java b/src/test/java/org/graphwalker/conditions/TestCaseLengthTest.java deleted file mode 100644 index a5dd2b08..00000000 --- a/src/test/java/org/graphwalker/conditions/TestCaseLengthTest.java +++ /dev/null @@ -1,98 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.Util; -import org.graphwalker.conditions.TestCaseLength; -import org.graphwalker.exceptions.GeneratorException; -import org.graphwalker.generators.RandomPathGenerator; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; - -import junit.framework.TestCase; - -public class TestCaseLengthTest extends TestCase { - Graph graph; - Vertex start; - Vertex v1; - Vertex v2; - Edge e0; - Edge e1; - - @Override - protected void setUp() throws Exception { - super.setUp(); - ModelBasedTesting.getInstance().reset(); - graph = new Graph(); - - start = Util.addVertexToGraph(graph, "Start"); - v1 = Util.addVertexToGraph(graph, "V1"); - v2 = Util.addVertexToGraph(graph, "V2"); - - e0 = Util.addEdgeToGraph(graph, start, v1, "E0", null, null, null); - e1 = Util.addEdgeToGraph(graph, v1, v2, "E1", null, null, null); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - graph = null; - start = v1 = v2 = null; - e0 = e1 = null; - } - - public void testConstructor() { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGenerator(new RandomPathGenerator(new TestCaseLength(2))); - } - - public void testFulfillment() throws GeneratorException, InterruptedException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGraph(graph); - mbt.setGenerator(new RandomPathGenerator(new TestCaseLength(2))); - assertTrue(mbt.hasNextStep()); - - assertEquals((double) 0 / 2, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - mbt.getNextStep(); - assertEquals((double) 1 / 2, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - mbt.getNextStep(); - assertEquals((double) 2 / 2, mbt.getGenerator().getStopCondition().getFulfilment(), 0.01); - } - - public void testIsFulfilled() throws GeneratorException, InterruptedException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGraph(graph); - mbt.setGenerator(new RandomPathGenerator(new TestCaseLength(2))); - assertTrue(mbt.hasNextStep()); - - assertEquals(false, mbt.getGenerator().getStopCondition().isFulfilled()); - mbt.getNextStep(); - assertEquals(false, mbt.getGenerator().getStopCondition().isFulfilled()); - mbt.getNextStep(); - assertEquals(true, mbt.getGenerator().getStopCondition().isFulfilled()); - } - -} diff --git a/src/test/java/org/graphwalker/conditions/TimeDurationTest.java b/src/test/java/org/graphwalker/conditions/TimeDurationTest.java deleted file mode 100644 index 71e1eb76..00000000 --- a/src/test/java/org/graphwalker/conditions/TimeDurationTest.java +++ /dev/null @@ -1,110 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.conditions; - -import org.graphwalker.Keywords; -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.Util; -import org.graphwalker.conditions.TimeDuration; -import org.graphwalker.exceptions.GeneratorException; -import org.graphwalker.generators.RandomPathGenerator; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; - -import junit.framework.TestCase; - -public class TimeDurationTest extends TestCase { - Graph graph; - Vertex start; - Vertex v1; - Vertex v2; - Edge e0; - Edge e1; - - @Override - protected void setUp() throws Exception { - super.setUp(); - graph = new Graph(); - - start = Util.addVertexToGraph(graph, "Start"); - v1 = Util.addVertexToGraph(graph, "V1"); - v2 = Util.addVertexToGraph(graph, "V2"); - - e0 = Util.addEdgeToGraph(graph, start, v1, "E0", null, null, null); - e1 = Util.addEdgeToGraph(graph, v1, v2, "E1", null, null, null); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - graph = null; - start = v1 = v2 = null; - e0 = e1 = null; - } - - public void testConstructor() { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.setGenerator(new RandomPathGenerator(new TimeDuration(1))); - } - - public void testFulfillment() throws InterruptedException, GeneratorException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - double startTime = System.currentTimeMillis(); - mbt.setGraph(graph); - mbt.setGenerator(Keywords.GENERATOR_RANDOM); - mbt.setGenerator(new RandomPathGenerator(new TimeDuration(1))); - assertTrue(mbt.hasNextStep()); - - while ((System.currentTimeMillis() - startTime) < 10) - Thread.sleep(1); - assertEquals((System.currentTimeMillis() - startTime) / 1000, mbt.getGenerator().getStopCondition().getFulfilment(), 0.1); - while ((System.currentTimeMillis() - startTime) < 900) - Thread.sleep(1); - assertEquals((System.currentTimeMillis() - startTime) / 1000, mbt.getGenerator().getStopCondition().getFulfilment(), 0.1); - while ((System.currentTimeMillis() - startTime) < 1000) - Thread.sleep(1); - assertEquals((System.currentTimeMillis() - startTime) / 1000, mbt.getGenerator().getStopCondition().getFulfilment(), 0.1); - } - - public void testIsFulfilled() throws InterruptedException, GeneratorException { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - double startTime = System.currentTimeMillis(); - mbt.setGraph(graph); - mbt.setGenerator(new RandomPathGenerator(new TimeDuration(1))); - assertTrue(mbt.hasNextStep()); - - while ((System.currentTimeMillis() - startTime) < 10) - Thread.sleep(1); - assertEquals(false, mbt.getGenerator().getStopCondition().isFulfilled()); - while ((System.currentTimeMillis() - startTime) < 900) - Thread.sleep(1); - assertEquals(false, mbt.getGenerator().getStopCondition().isFulfilled()); - while ((System.currentTimeMillis() - startTime) < 1000) - Thread.sleep(1); - System.out.println(mbt.getGenerator().getStopCondition().getFulfilment()); - assertEquals(true, mbt.getGenerator().getStopCondition().isFulfilled()); - } - -} diff --git a/src/test/java/org/graphwalker/filters/AccessableEdgeFilterTest.java b/src/test/java/org/graphwalker/filters/AccessableEdgeFilterTest.java deleted file mode 100644 index 162e1cce..00000000 --- a/src/test/java/org/graphwalker/filters/AccessableEdgeFilterTest.java +++ /dev/null @@ -1,154 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.filters; - -import org.graphwalker.filters.AccessableEdgeFilter; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; - -import bsh.EvalError; -import bsh.Interpreter; - -import junit.framework.TestCase; - -public class AccessableEdgeFilterTest extends TestCase { - private AccessableEdgeFilter f; - private Graph g; - private Edge e; - private Interpreter dataStore; - - @Override - protected void setUp() throws Exception { - super.setUp(); - dataStore = new Interpreter(); - - Vertex v1 = new Vertex(); - Vertex v2 = new Vertex(); - g = new Graph(); - g.addVertex(v1); - g.addVertex(v2); - - e = new Edge(); - g.addEdge(e, v1, v2); - - e.setLabelKey(""); - - f = new AccessableEdgeFilter(dataStore); - } - - public void testAcceptEdgeEdge1() { - e.setLabelKey(""); - assertEquals(true, f.acceptEdge(g, e)); - } - - public void testAcceptEdgeEdge2() { - e.setLabelKey("test"); - assertEquals(true, f.acceptEdge(g, e)); - } - - public void testAcceptEdgeEdge3() { - e.setLabelKey("test"); - e.setGuardKey("true"); - assertEquals(true, f.acceptEdge(g, e)); - } - - public void testAcceptEdgeEdge4() { - e.setGuardKey("true"); - assertEquals(true, f.acceptEdge(g, e)); - } - - public void testAcceptEdgeEdge5() { - e.setGuardKey("true"); - e.setActionsKey("test"); - assertEquals(true, f.acceptEdge(g, e)); - } - - public void testAcceptEdgeEdge6() { - e.setGuardKey("false"); - assertEquals(false, f.acceptEdge(g, e)); - } - - public void testAcceptEdgeEdge7() throws EvalError { - dataStore.eval("X=false"); - e.setGuardKey("X"); - assertEquals(false, f.acceptEdge(g, e)); - } - - public void testAcceptEdgeEdge8() throws EvalError { - dataStore.eval("X=true"); - e.setGuardKey("X"); - assertEquals(true, f.acceptEdge(g, e)); - } - - public void testAcceptEdgeEdge9() throws EvalError { - dataStore.eval("X=true"); - e.setGuardKey("X==true"); - assertEquals(true, f.acceptEdge(g, e)); - } - - public void testAcceptEdgeEdge10() throws EvalError { - dataStore.eval("X=true"); - e.setGuardKey("X==false"); - assertEquals(false, f.acceptEdge(g, e)); - } - - public void testAcceptEdgeEdge11() throws EvalError { - dataStore.eval("X=true"); - dataStore.eval("Y=true"); - e.setGuardKey("X==Y"); - assertEquals(true, f.acceptEdge(g, e)); - } - - public void testAcceptEdgeEdge12() throws EvalError { - dataStore.eval("X=true"); - dataStore.eval("Y=false"); - e.setGuardKey("X==Y"); - assertEquals(false, f.acceptEdge(g, e)); - } - - public void testAcceptEdgeEdge13() throws EvalError { - dataStore.eval("X=5"); - e.setGuardKey("X==5"); - assertEquals(true, f.acceptEdge(g, e)); - } - - public void testAcceptEdgeEdge14() throws EvalError { - dataStore.eval("X=6"); - e.setGuardKey("X==5"); - assertEquals(false, f.acceptEdge(g, e)); - } - - public void testAcceptEdgeEdge15() throws EvalError { - dataStore.eval("X=6"); - e.setGuardKey("X>5"); - assertEquals(true, f.acceptEdge(g, e)); - } - - public void testAcceptEdgeEdge16() throws EvalError { - dataStore.eval("X=4"); - e.setGuardKey("X<5"); - assertEquals(true, f.acceptEdge(g, e)); - } -} diff --git a/src/test/java/org/graphwalker/generators/A_StarPathGeneratorEFSMBeanShellTest.java b/src/test/java/org/graphwalker/generators/A_StarPathGeneratorEFSMBeanShellTest.java deleted file mode 100644 index 039b909c..00000000 --- a/src/test/java/org/graphwalker/generators/A_StarPathGeneratorEFSMBeanShellTest.java +++ /dev/null @@ -1,129 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.generators; - -import org.graphwalker.Util; -import org.graphwalker.conditions.ReachedEdge; -import org.graphwalker.conditions.ReachedVertex; -import org.graphwalker.generators.A_StarPathGenerator; -import org.graphwalker.generators.PathGenerator; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; -import org.graphwalker.machines.ExtendedFiniteStateMachine; - -import junit.framework.TestCase; - -public class A_StarPathGeneratorEFSMBeanShellTest extends TestCase { - - Graph graph; - Vertex start; - Vertex v1; - Vertex v2; - Edge e0; - Edge e1; - Edge e2; - Edge e3; - - @Override - protected void setUp() throws Exception { - super.setUp(); - graph = new Graph(); - - start = Util.addVertexToGraph(graph, "Start"); - v1 = Util.addVertexToGraph(graph, "V1"); - v2 = Util.addVertexToGraph(graph, "V2"); - - e0 = Util.addEdgeToGraph(graph, start, v1, "E0", null, null, "x=1;y=new Vector()"); - e1 = Util.addEdgeToGraph(graph, v1, v2, "E1", null, null, "x=2"); - e2 = Util.addEdgeToGraph(graph, v2, v2, "E2", null, "x<4", "x++"); - e3 = Util.addEdgeToGraph(graph, v2, v1, "E3", null, "y.size()<3", "y.add(x)"); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - graph = null; - start = v1 = v2 = null; - e0 = e1 = e2 = e3 = null; - } - - public void test_EFSM_StateStop() throws InterruptedException { - PathGenerator pathGenerator = new A_StarPathGenerator(new ReachedVertex("V1/x=3;y=\\[2, 3, 3\\];")); - ExtendedFiniteStateMachine machine = new ExtendedFiniteStateMachine(false); - machine.setModel(graph); - pathGenerator.setMachine(machine); - - String[] stepPair; - stepPair = pathGenerator.getNext(); - assertEquals("E0", stepPair[0]); - assertEquals("V1/x=1;y=[];", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E1", stepPair[0]); - assertEquals("V2/x=2;y=[];", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E3", stepPair[0]); - assertEquals("V1/x=2;y=[2];", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E1", stepPair[0]); - assertEquals("V2/x=2;y=[2];", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E2", stepPair[0]); - assertEquals("V2/x=3;y=[2];", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E3", stepPair[0]); - assertEquals("V1/x=3;y=[2, 3];", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E1", stepPair[0]); - assertEquals("V2/x=2;y=[2, 3];", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E2", stepPair[0]); - assertEquals("V2/x=3;y=[2, 3];", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E3", stepPair[0]); - assertEquals("V1/x=3;y=[2, 3, 3];", stepPair[1]); - assertFalse(pathGenerator.hasNext()); - - } - - public void test_EFSM_EdgeStop() throws InterruptedException { - PathGenerator pathGenerator = new A_StarPathGenerator(new ReachedEdge("E2")); - ExtendedFiniteStateMachine machine = new ExtendedFiniteStateMachine(false); - machine.setModel(graph); - pathGenerator.setMachine(machine); - - String[] stepPair; - stepPair = pathGenerator.getNext(); - assertEquals("E0", stepPair[0]); - assertEquals("V1/x=1;y=[];", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E1", stepPair[0]); - assertEquals("V2/x=2;y=[];", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E2", stepPair[0]); - assertEquals("V2/x=3;y=[];", stepPair[1]); - assertFalse(pathGenerator.hasNext()); - - } -} diff --git a/src/test/java/org/graphwalker/generators/A_StarPathGeneratorEFSMJavaScriptTest.java b/src/test/java/org/graphwalker/generators/A_StarPathGeneratorEFSMJavaScriptTest.java deleted file mode 100644 index 1b3647c8..00000000 --- a/src/test/java/org/graphwalker/generators/A_StarPathGeneratorEFSMJavaScriptTest.java +++ /dev/null @@ -1,129 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.generators; - -import org.graphwalker.Util; -import org.graphwalker.conditions.ReachedEdge; -import org.graphwalker.conditions.ReachedVertex; -import org.graphwalker.generators.A_StarPathGenerator; -import org.graphwalker.generators.PathGenerator; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; -import org.graphwalker.machines.ExtendedFiniteStateMachine; - -import junit.framework.TestCase; - -public class A_StarPathGeneratorEFSMJavaScriptTest extends TestCase { - - Graph graph; - Vertex start; - Vertex v1; - Vertex v2; - Edge e0; - Edge e1; - Edge e2; - Edge e3; - - @Override - protected void setUp() throws Exception { - super.setUp(); - graph = new Graph(); - - start = Util.addVertexToGraph(graph, "Start"); - v1 = Util.addVertexToGraph(graph, "V1"); - v2 = Util.addVertexToGraph(graph, "V2"); - - e0 = Util.addEdgeToGraph(graph, start, v1, "E0", null, null, "importClass(java.util.Vector);x=1;y=new Vector()"); - e1 = Util.addEdgeToGraph(graph, v1, v2, "E1", null, null, "x=2"); - e2 = Util.addEdgeToGraph(graph, v2, v2, "E2", null, "x<4", "x++"); - e3 = Util.addEdgeToGraph(graph, v2, v1, "E3", null, "y.size()<3", "y.add(x)"); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - graph = null; - start = v1 = v2 = null; - e0 = e1 = e2 = e3 = null; - } - - public void test_EFSM_StateStop() throws InterruptedException { - PathGenerator pathGenerator = new A_StarPathGenerator(new ReachedVertex("V1/y=\\[2.0, 3.0, 3.0\\];x=3.0;")); - ExtendedFiniteStateMachine machine = new ExtendedFiniteStateMachine(true); - machine.setModel(graph); - pathGenerator.setMachine(machine); - - String[] stepPair; - stepPair = pathGenerator.getNext(); - assertEquals("E0", stepPair[0]); - assertEquals("V1/y=[];x=1.0;", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E1", stepPair[0]); - assertEquals("V2/y=[];x=2.0;", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E3", stepPair[0]); - assertEquals("V1/y=[2.0];x=2.0;", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E1", stepPair[0]); - assertEquals("V2/y=[2.0];x=2.0;", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E2", stepPair[0]); - assertEquals("V2/y=[2.0];x=3.0;", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E3", stepPair[0]); - assertEquals("V1/y=[2.0, 3.0];x=3.0;", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E1", stepPair[0]); - assertEquals("V2/y=[2.0, 3.0];x=2.0;", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E2", stepPair[0]); - assertEquals("V2/y=[2.0, 3.0];x=3.0;", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E3", stepPair[0]); - assertEquals("V1/y=[2.0, 3.0, 3.0];x=3.0;", stepPair[1]); - assertFalse(pathGenerator.hasNext()); - - } - - public void test_EFSM_EdgeStop() throws InterruptedException { - PathGenerator pathGenerator = new A_StarPathGenerator(new ReachedEdge("E2")); - ExtendedFiniteStateMachine machine = new ExtendedFiniteStateMachine(true); - machine.setModel(graph); - pathGenerator.setMachine(machine); - - String[] stepPair; - stepPair = pathGenerator.getNext(); - assertEquals("E0", stepPair[0]); - assertEquals("V1/y=[];x=1.0;", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E1", stepPair[0]); - assertEquals("V2/y=[];x=2.0;", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E2", stepPair[0]); - assertEquals("V2/y=[];x=3.0;", stepPair[1]); - assertFalse(pathGenerator.hasNext()); - - } -} diff --git a/src/test/java/org/graphwalker/generators/A_StarPathGeneratorFSMTest.java b/src/test/java/org/graphwalker/generators/A_StarPathGeneratorFSMTest.java deleted file mode 100644 index 7d95c1cc..00000000 --- a/src/test/java/org/graphwalker/generators/A_StarPathGeneratorFSMTest.java +++ /dev/null @@ -1,106 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.generators; - -import org.graphwalker.Util; -import org.graphwalker.conditions.ReachedEdge; -import org.graphwalker.conditions.ReachedVertex; -import org.graphwalker.generators.A_StarPathGenerator; -import org.graphwalker.generators.PathGenerator; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; -import org.graphwalker.machines.FiniteStateMachine; - -import junit.framework.TestCase; - -public class A_StarPathGeneratorFSMTest extends TestCase { - - Graph graph; - Vertex start; - Vertex v1; - Vertex v2; - Edge e0; - Edge e1; - Edge e2; - Edge e3; - - @Override - protected void setUp() throws Exception { - super.setUp(); - graph = new Graph(); - - start = Util.addVertexToGraph(graph, "Start"); - v1 = Util.addVertexToGraph(graph, "V1"); - v2 = Util.addVertexToGraph(graph, "V2"); - - e0 = Util.addEdgeToGraph(graph, start, v1, "E0", null, null, "importClass(java.util.Vector);x=1;y=new Vector()"); - e1 = Util.addEdgeToGraph(graph, v1, v2, "E1", null, null, "x=2"); - e2 = Util.addEdgeToGraph(graph, v2, v2, "E2", null, "x<4", "x++"); - e3 = Util.addEdgeToGraph(graph, v2, v1, "E3", null, "y.size()<3", "y.add(x)"); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - graph = null; - start = v1 = v2 = null; - e0 = e1 = e2 = e3 = null; - } - - public void test_FSM_StateStop() throws InterruptedException { - PathGenerator pathGenerator = new A_StarPathGenerator(new ReachedVertex("V2")); - FiniteStateMachine fsm = new FiniteStateMachine(); - fsm.setModel(graph); - pathGenerator.setMachine(fsm); - - String[] stepPair; - stepPair = pathGenerator.getNext(); - assertEquals("E0", stepPair[0]); - assertEquals("V1", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E1", stepPair[0]); - assertEquals("V2", stepPair[1]); - assertFalse(pathGenerator.hasNext()); - } - - public void test_FSM_EdgeStop() throws InterruptedException { - PathGenerator pathGenerator = new A_StarPathGenerator(new ReachedEdge("E2")); - FiniteStateMachine fsm = new FiniteStateMachine(); - fsm.setModel(graph); - pathGenerator.setMachine(fsm); - - String[] stepPair; - stepPair = pathGenerator.getNext(); - assertEquals("E0", stepPair[0]); - assertEquals("V1", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E1", stepPair[0]); - assertEquals("V2", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("E2", stepPair[0]); - assertEquals("V2", stepPair[1]); - assertFalse(pathGenerator.hasNext()); - } -} diff --git a/src/test/java/org/graphwalker/generators/AllPathPermutationsGeneratorTest.java b/src/test/java/org/graphwalker/generators/AllPathPermutationsGeneratorTest.java deleted file mode 100644 index afdd60da..00000000 --- a/src/test/java/org/graphwalker/generators/AllPathPermutationsGeneratorTest.java +++ /dev/null @@ -1,66 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.generators; - -import junit.framework.TestCase; - -import org.apache.log4j.Logger; -import org.graphwalker.Util; -import org.graphwalker.conditions.TestCaseLength; -import org.graphwalker.exceptions.StopConditionException; -import org.graphwalker.io.GraphML; -import org.graphwalker.machines.FiniteStateMachine; - -public class AllPathPermutationsGeneratorTest extends TestCase { - - private final Logger logger = Util.setupLogger(AllPathPermutationsGeneratorTest.class); - - @Override - protected void setUp() throws Exception { - super.setUp(); - } - - public void test_AllPathPermutationsGeneratior() throws StopConditionException, InterruptedException { - logger.info("TEST: test_AllPathPermutationsGeneration"); - logger.info("======================================================================="); - GraphML gml = new GraphML(); - gml.load("graphml/permutations/simple.graphml"); - FiniteStateMachine FSM = new FiniteStateMachine(); - FSM.setModel(gml.getModel()); - FSM.setWeighted(false); - - PathGenerator pathGenerator = new AllPathPermutationsGenerator(new TestCaseLength(42)); - pathGenerator.setMachine(FSM); - - while (pathGenerator.hasNext()) { - String[] stepPair = pathGenerator.getNext(); - int stats[] = FSM.getStatistics(); - int ec = 100 * stats[1] / stats[0]; - - logger.debug("call( " + stepPair[0] + " ) then verify( " + stepPair[1] + " ) --> Edge coverage @ " + ec + "%"); - } - assertEquals(3, ((AllPathPermutationsGenerator) pathGenerator).getDepth()); - logger.debug("=============================="); - } -} diff --git a/src/test/java/org/graphwalker/generators/CodeGeneratorTest.java b/src/test/java/org/graphwalker/generators/CodeGeneratorTest.java deleted file mode 100644 index 60bc0c02..00000000 --- a/src/test/java/org/graphwalker/generators/CodeGeneratorTest.java +++ /dev/null @@ -1,103 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.generators; - -import org.apache.log4j.Logger; -import org.graphwalker.Util; -import org.graphwalker.generators.CodeGenerator; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; -import org.graphwalker.machines.FiniteStateMachine; - -import junit.framework.TestCase; - -public class CodeGeneratorTest extends TestCase { - Logger logger = Util.setupLogger(CodeGeneratorTest.class); - - public void testGetNext() { - Graph graph = new Graph(); - - Vertex v1 = new Vertex(); - v1.setIndexKey(new Integer(1)); - v1.setLabelKey("Start"); - graph.addVertex(v1); - - Vertex v2 = new Vertex(); - v2.setIndexKey(new Integer(2)); - v2.setLabelKey("V2"); - graph.addVertex(v2); - - Edge edge = new Edge(); - graph.addEdge(edge, v1, v2); - edge.setIndexKey(new Integer(3)); - edge.setLabelKey("E1"); - - FiniteStateMachine FSM = new FiniteStateMachine(); - FSM.setModel(graph); - - String[] template = { "", "{EDGE_VERTEX}: {LABEL}", "" }; - CodeGenerator generator = new CodeGenerator(); - generator.setTemplate(template); - generator.setMachine(FSM); - - assertEquals("Edge: E1", generator.getNext()[0]); - assertEquals("Vertex: V2", generator.getNext()[0]); - assertFalse(generator.hasNext()); - } - - public void testHeaderFooter() { - Graph graph = new Graph(); - - Vertex v1 = new Vertex(); - v1.setIndexKey(new Integer(1)); - v1.setLabelKey("Start"); - graph.addVertex(v1); - - Vertex v2 = new Vertex(); - v2.setIndexKey(new Integer(2)); - v2.setLabelKey("V2"); - graph.addVertex(v2); - - Edge edge = new Edge(); - graph.addEdge(edge, v1, v2); - edge.setIndexKey(new Integer(3)); - edge.setLabelKey("E1"); - - FiniteStateMachine FSM = new FiniteStateMachine(); - FSM.setModel(graph); - - String[] template = { "This is the HEADER", "{EDGE_VERTEX}: {LABEL}", "This is the FOOTER" }; - CodeGenerator generator = new CodeGenerator(); - generator.setTemplate(template); - generator.setMachine(FSM); - - StringBuffer str = new StringBuffer(); - while (generator.hasNext()) { - str.append(generator.getNext()[0]); - } - System.out.println(str.toString()); - } - -} diff --git a/src/test/java/org/graphwalker/generators/CombinedPathGeneratorTest.java b/src/test/java/org/graphwalker/generators/CombinedPathGeneratorTest.java deleted file mode 100644 index 2847c6d8..00000000 --- a/src/test/java/org/graphwalker/generators/CombinedPathGeneratorTest.java +++ /dev/null @@ -1,92 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -/** - * - */ -package org.graphwalker.generators; - -import org.graphwalker.Util; -import org.graphwalker.generators.CodeGenerator; -import org.graphwalker.generators.CombinedPathGenerator; -import org.graphwalker.generators.ListGenerator; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; -import org.graphwalker.machines.FiniteStateMachine; - -import junit.framework.TestCase; - -/** - * @author Johan Tejle - * - */ -public class CombinedPathGeneratorTest extends TestCase { - - Graph graph; - - /* - * (non-Javadoc) - * - * @see junit.framework.TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - - graph = new Graph(); - - Vertex v1 = Util.addVertexToGraph(graph, "Start"); - Vertex v2 = Util.addVertexToGraph(graph, "V1"); - Util.addEdgeToGraph(graph, v1, v2, "E1", null, null, null); - } - - public void testCodeList() throws InterruptedException { - FiniteStateMachine FSM = new FiniteStateMachine(); - FSM.setModel(graph); - - String[] template = { "", "{EDGE_VERTEX}: {LABEL}", "" }; - CodeGenerator generator1 = new CodeGenerator(); - generator1.setTemplate(template); - ListGenerator generator2 = new ListGenerator(); - - CombinedPathGenerator pathGenerator = new CombinedPathGenerator(); - pathGenerator.addPathGenerator(generator1); - pathGenerator.addPathGenerator(generator2); - pathGenerator.setMachine(FSM); - - String[] stepPair; - - stepPair = pathGenerator.getNext(); - assertEquals("Edge: E1", stepPair[0]); - stepPair = pathGenerator.getNext(); - assertEquals("Vertex: V1", stepPair[0]); - stepPair = pathGenerator.getNext(); - assertEquals("E1", stepPair[0]); - assertEquals("Edge", stepPair[1]); - stepPair = pathGenerator.getNext(); - assertEquals("V1", stepPair[0]); - assertEquals("Vertex", stepPair[1]); - assertFalse(pathGenerator.hasNext()); - - } -} diff --git a/src/test/java/org/graphwalker/generators/ListGeneratorTest.java b/src/test/java/org/graphwalker/generators/ListGeneratorTest.java deleted file mode 100644 index 8f7c53e9..00000000 --- a/src/test/java/org/graphwalker/generators/ListGeneratorTest.java +++ /dev/null @@ -1,70 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.generators; - -import org.apache.log4j.Logger; -import org.graphwalker.Util; -import org.graphwalker.generators.ListGenerator; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; -import org.graphwalker.machines.FiniteStateMachine; - -import junit.framework.TestCase; - -public class ListGeneratorTest extends TestCase { - Logger logger = Util.setupLogger(ListGeneratorTest.class); - - public void testGetNext() { - Graph graph = new Graph(); - - Vertex v1 = new Vertex(); - v1.setIndexKey(new Integer(1)); - v1.setLabelKey("Start"); - graph.addVertex(v1); - - Vertex v2 = new Vertex(); - v2.setIndexKey(new Integer(2)); - v2.setLabelKey("V2"); - graph.addVertex(v2); - - Edge edge = new Edge(); - edge.setIndexKey(new Integer(3)); - edge.setLabelKey("E1"); - graph.addEdge(edge, v1, v2); - - ListGenerator generator = new ListGenerator(); - FiniteStateMachine fsm = new FiniteStateMachine(); - fsm.setModel(graph); - generator.setMachine(fsm); - - String[] s = generator.getNext(); - assertEquals("E1", s[0]); - assertEquals("Edge", s[1]); - s = generator.getNext(); - assertEquals("V2", s[0]); - assertEquals("Vertex", s[1]); - assertFalse(generator.hasNext()); - } -} diff --git a/src/test/java/org/graphwalker/generators/RandomPathGeneratorTest.java b/src/test/java/org/graphwalker/generators/RandomPathGeneratorTest.java deleted file mode 100644 index 36591bb5..00000000 --- a/src/test/java/org/graphwalker/generators/RandomPathGeneratorTest.java +++ /dev/null @@ -1,90 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.generators; - -import org.apache.log4j.Logger; -import org.graphwalker.Util; -import org.graphwalker.conditions.EdgeCoverage; -import org.graphwalker.exceptions.StopConditionException; -import org.graphwalker.generators.PathGenerator; -import org.graphwalker.generators.RandomPathGenerator; -import org.graphwalker.io.GraphML; -import org.graphwalker.machines.FiniteStateMachine; - -import junit.framework.TestCase; - -public class RandomPathGeneratorTest extends TestCase { - - private Logger logger = Util.setupLogger(RandomPathGeneratorTest.class); - - @Override - protected void setUp() throws Exception { - super.setUp(); - } - - public void test_WeightedRandomGeneration() throws StopConditionException, InterruptedException { - logger.info("TEST: test_WeightedRandomGeneration"); - logger.info("======================================================================="); - GraphML gml = new GraphML(); - gml.load("graphml/weight/FSM.graphml"); - FiniteStateMachine FSM = new FiniteStateMachine(); - FSM.setModel(gml.getModel()); - FSM.setWeighted(true); - - PathGenerator pathGenerator = new RandomPathGenerator(new EdgeCoverage(1.0)); - pathGenerator.setMachine(FSM); - - while (pathGenerator.hasNext()) { - String[] stepPair = pathGenerator.getNext(); - - int stats[] = FSM.getStatistics(); - int ec = 100 * stats[1] / stats[0]; - - logger.debug("call( " + stepPair[0] + " ) then verify( " + stepPair[1] + " ) --> Edge coverage @ " + ec + "%"); - } - logger.debug("=============================="); - } - - public void test_RandomGeneration() throws StopConditionException, InterruptedException { - logger.info("TEST: test_RandomGeneration"); - logger.info("======================================================================="); - GraphML gml = new GraphML(); - gml.load("graphml/weight/FSM.graphml"); - FiniteStateMachine FSM = new FiniteStateMachine(); - FSM.setModel(gml.getModel()); - FSM.setWeighted(false); - PathGenerator pathGenerator = new RandomPathGenerator(new EdgeCoverage(1.0)); - pathGenerator.setMachine(FSM); - - while (pathGenerator.hasNext()) { - String[] stepPair = pathGenerator.getNext(); - - int stats[] = FSM.getStatistics(); - int ec = 100 * stats[1] / stats[0]; - - logger.debug("call( " + stepPair[0] + " ) then verify( " + stepPair[1] + " ) --> Edge coverage @ " + ec + "%"); - } - logger.debug("=============================="); - } -} diff --git a/src/test/java/org/graphwalker/io/GraphMLTest.java b/src/test/java/org/graphwalker/io/GraphMLTest.java deleted file mode 100644 index e6fce779..00000000 --- a/src/test/java/org/graphwalker/io/GraphMLTest.java +++ /dev/null @@ -1,439 +0,0 @@ -//This file is part of the GraphWalker java package -//The MIT License -// -//Copyright (c) 2010 graphwalker.org -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in -//all copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -//THE SOFTWARE. - -package org.graphwalker.io; - -import org.graphwalker.ModelBasedTesting; -import org.graphwalker.graph.Edge; -import org.graphwalker.graph.Graph; -import org.graphwalker.graph.Vertex; -import org.graphwalker.io.GraphML; - -import junit.framework.TestCase; - -public class GraphMLTest extends TestCase { - - @Override - protected void setUp() throws Exception { - super.setUp(); - ModelBasedTesting.getInstance().reset(); - } - - public void testGraphNode() { - try { - GraphML modelHandler = new GraphML(); - modelHandler.load("graphml/multiple/switch/A.graphml"); - assertEquals(modelHandler.getModel().getVertexCount(), 5); - assertEquals(modelHandler.getModel().getEdgeCount(), 8); - assertEquals(modelHandler.getModel().getLabelKey(), "v_ClientNotRunning"); - - Vertex clientNotRunning = modelHandler.getModel().findVertex("v_ClientNotRunning"); - assertNotNull(clientNotRunning); - assertTrue(clientNotRunning.isGraphVertex()); - - Vertex whatsNew = modelHandler.getModel().findVertex("v_WhatsNew"); - assertNotNull(whatsNew); - assertFalse(whatsNew.isGraphVertex()); - - } catch (Exception e) { - System.out.println(e.getMessage()); - fail(e.getMessage()); - } - } - - public void testSwitchModelKeyWord() { - try { - GraphML modelHandler = new GraphML(); - modelHandler.load("graphml/multiple/switch/A.graphml"); - assertEquals(modelHandler.getModel().getVertexCount(), 5); - assertEquals(modelHandler.getModel().getEdgeCount(), 8); - assertEquals(modelHandler.getModel().getLabelKey(), "v_ClientNotRunning"); - - Vertex clientNotRunning = modelHandler.getModel().findVertex("v_ClientNotRunning"); - assertNotNull(clientNotRunning); - assertFalse(clientNotRunning.isSwitchModelKey()); - - Vertex whatsNew = modelHandler.getModel().findVertex("v_WhatsNew"); - assertNotNull(whatsNew); - assertTrue(whatsNew.isSwitchModelKey()); - - } catch (Exception e) { - System.out.println(e.getMessage()); - fail(e.getMessage()); - } - } - - // Test various types of efsm labels - public void testMergeFiles() { - try { - GraphML modelHandler = new GraphML(); - modelHandler.load("graphml/merging"); - assertEquals(modelHandler.getModel().getVertexCount(), 37); - assertEquals(modelHandler.getModel().getEdgeCount(), 92); - assertEquals(modelHandler.getModel().getLabelKey(), "v_A"); - } catch (Exception e) { - System.out.println(e.getMessage()); - fail(e.getMessage()); - } - } - - // Test various types of efsm labels - public void testMergeEFSM_Lables() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/efsm_lables/testMergeEFSM_Lables.graphml"); - } catch (Exception e) { - System.out.println(e.getMessage()); - fail(e.getMessage()); - } - } - - // Test merging and verifying that unique id's are created - public void testVerifyIds() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/test23"); - verifyIds(mbt.getGraph()); - } catch (Exception e) { - System.out.println(e.getMessage()); - fail(e.getMessage()); - } - } - - // Verify that mbt checks that subgraphs are unique. - public void testUniqueSubGraphs() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/test09"); - fail("Missing error message"); - } catch (RuntimeException e) { - String msg = e.getMessage(); - System.out.println(msg); - assertTrue(msg - .matches("Found 2 subgraphs using the same name: 'B', they are defined in files: '.*graphml.test09.(C|B).graphml', and :'.*graphml.test09.(B|C).graphml'")); - } - } - - // Verify that mbt reports and exits when an node without name is found - public void testEmptyVertexLabel() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/test10"); - fail("Missing error message"); - } catch (RuntimeException e) { - String msg = e.getMessage(); - System.out.println(msg); - assertTrue(msg.matches("Could not parse file: '.*test10.B\\.graphml'. Vertex is missing mandatory label")); - } - } - - // Verify that mbt reports and exits when a recursive subgraph situation - // emerges - public void testRecuresiveIncident() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/test11"); - fail("Missing error message"); - } catch (RuntimeException e) { - String msg = e.getMessage(); - System.out.println(msg); - assertTrue(msg.matches("Found a subgraph containing a duplicate vertex with name: 'C', in file: '.*test11.C\\.graphml'")); - } - } - - // Verify that mbt reports and exits when an edge containing a whitespace - // (tab) is found - public void testWhiteSpaceInEdgeLabel() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/test13"); - } catch (RuntimeException e) { - System.out.println(e.getMessage()); - fail(e.getMessage()); - } - } - - // Verify that mbt reports and exits when a vertex containing a whitespace - // (tab) is found - public void testWhiteSpaceInVertexLabel() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/test14"); - fail("Missing error message"); - } catch (RuntimeException e) { - String msg = e.getMessage(); - System.out.println(msg); - assertTrue(msg - .matches("Could not parse file: '.*graphml.test14.C\\.graphml'. Label of vertex: 'Containing a whitespace', containing whitespaces")); - } - } - - // Verify that a single graphml file with an edge coming from the START vertex - // with an empty label is catched. - public void testMainGraphWithStartVertexOutEdgeEmptyLabel() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/test15"); - fail("Missing error message"); - } catch (Exception e) { - String msg = e.getMessage(); - System.out.println(msg); - assertTrue(msg.matches("Did not find a Start vertex with an out edge with a label.")); - } - } - - // Verify that a file with 2 Start vertices is catched. Both Start vertices - // has edges with labels. - public void testTwoStartVerticesWithLabels() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/test17/test17.graphml"); - fail("Missing error message"); - } catch (Exception e) { - String msg = e.getMessage(); - System.out.println(msg); - assertTrue(msg.matches("Only one Start vertex can exist in one file, see file 'graphml/test17/test17.graphml'")); - } - } - - // Verify that a file with 2 Start vertices is catched. One edge has a label, - // the other has not. - public void testTwoStartVerticesOneLabel() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/test18/test18.graphml"); - fail("Missing error message"); - } catch (Exception e) { - String msg = e.getMessage(); - System.out.println(msg); - assertTrue(msg.matches("Only one Start vertex can exist in one file, see file 'graphml/test18/test18.graphml'")); - } - } - - // Verify that a file with 2 Start vertices is catched. Both edges has no - // labels. - public void testTwoStartVerticesNoLabel() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/test19/test19.graphml"); - fail("Missing error message"); - } catch (Exception e) { - String msg = e.getMessage(); - System.out.println(msg); - assertTrue(msg.matches("Only one Start vertex can exist in one file, see file 'graphml/test19/test19.graphml'")); - } - } - - // Verify that a file with 2 out edges from the Start vertex is catched. - public void testTwoOutEdgesFromStart() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/test20/test20.graphml"); - fail("Missing error message"); - } catch (Exception e) { - String msg = e.getMessage(); - System.out.println(msg); - assertTrue(msg.matches("A Start vertex can only have one out edge, look in file: graphml/test20/test20.graphml")); - } - } - - // Verify that merging of subgraphs works for graphml/mergeSubgraphs_01. - public void test_mergeSubgraphs_01() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/mergeSubgraphs_01"); - assertTrue(mbt.getGraph().getVertices().size() == 6); - assertTrue(mbt.getGraph().getEdges().size() == 16); - verifyIds(mbt.getGraph()); - } catch (Exception e) { - System.out.println(e.getMessage()); - fail(e.getMessage()); - } - } - - // Verify that merging of subgraphs works for graphml/mergeSubgraphs_02. - public void test_mergeSubgraphs_02() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/mergeSubgraphs_02"); - assertTrue(mbt.getGraph().getVertices().size() == 16); - assertTrue(mbt.getGraph().getEdges().size() == 55); - verifyIds(mbt.getGraph()); - } catch (Exception e) { - System.out.println(e.getMessage()); - fail(e.getMessage()); - } - } - - // Test merging of 2 simple graphs - public void testMergeSimpleGraph() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/test01"); - assertTrue(mbt.getGraph().getEdges().size() == 9); - assertTrue(mbt.getGraph().getVertices().size() == 7); - verifyIds(mbt.getGraph()); - } catch (Exception e) { - System.out.println(e.getMessage()); - fail(e.getMessage()); - } - } - - // Test merging of 2 simple graphs, with nodes containing key word NO_MERGE - public void testMergeSimpleGraph_Keyword_NO_MERGE() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/test02"); - assertTrue(mbt.getGraph().getEdges().size() == 11); - assertTrue(mbt.getGraph().getVertices().size() == 8); - verifyIds(mbt.getGraph()); - } catch (Exception e) { - System.out.println(e.getMessage()); - fail(e.getMessage()); - } - } - - // Test merging a folder consisting 162 graphs - public void xtestMergeLargeGraph() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/test03"); - assertTrue(mbt.getGraph().getEdges().size() == 1550); - assertTrue(mbt.getGraph().getVertices().size() == 788); - verifyIds(mbt.getGraph()); - } catch (Exception e) { - System.out.println(e.getMessage()); - fail(e.getMessage()); - } - } - - // Verify that a graph containing a Stop vertex is correctly merged. - public void testMergeSubGraphUsingStopVertex() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/test22"); - assertTrue(mbt.getGraph().getEdges().size() == 8); - assertTrue(mbt.getGraph().getVertices().size() == 8); - verifyIds(mbt.getGraph()); - } catch (Exception e) { - System.out.println(e.getMessage()); - fail(e.getMessage()); - } - } - - // Merging with subgraphs containing Stop vertices - public void testMergeSubGraphUsingStopVertices() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/test23"); - assertTrue(mbt.getGraph().getEdges().size() == 14); - assertTrue(mbt.getGraph().getVertices().size() == 9); - verifyIds(mbt.getGraph()); - } catch (Exception e) { - System.out.println(e.getMessage()); - fail(e.getMessage()); - } - } - - // - public void testGetDescriptionVertex() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/modelWithDescr.graphml"); - assertTrue(mbt.getGraph().findVertex("v_WithDescription").getDescriptionKey() - .equals("
    \nA very fine description in a vertex\n
")); - assertTrue(mbt.getGraph().findVertex("v_WithNoDescription").getDescriptionKey().isEmpty()); - } catch (Exception e) { - System.out.println(e.getMessage()); - fail(e.getMessage()); - } - } - - public void testGetDescriptionEdge() { - try { - ModelBasedTesting mbt = ModelBasedTesting.getInstance(); - mbt.readGraph("graphml/modelWithDescr.graphml"); - assertTrue(mbt.getGraph().findEdge("e_WithDescription").getDescriptionKey().equals("
    \nA very fine description in a edge\n
")); - assertTrue(mbt.getGraph().findEdge("e_WithNoDescription").getDescriptionKey().isEmpty()); - } catch (Exception e) { - System.out.println(e.getMessage()); - fail(e.getMessage()); - } - } - - // Verify that all vertices and edges has indexes, and that no duplicates - // exists. - private void verifyIds(Graph g) { - Object[] vertices1 = g.getVertices().toArray(); - for (int i = 0; i < vertices1.length; i++) { - Vertex v1 = (Vertex) vertices1[i]; - int hits = 0; - Integer index1 = v1.getIndexKey(); - Object[] vertices2 = g.getVertices().toArray(); - for (int j = 0; j < vertices1.length; j++) { - Vertex v2 = (Vertex) vertices2[j]; - Integer index2 = v2.getIndexKey(); - if (index1.intValue() == index2.intValue()) { - hits++; - } - } - assertTrue(hits == 1); - - Object[] edges = g.getEdges().toArray(); - for (int j = 0; j < edges.length; j++) { - Edge e = (Edge) edges[j]; - Integer index2 = e.getIndexKey(); - if (index1.intValue() == index2.intValue()) { - hits++; - } - } - assertTrue(hits == 1); - } - - Object[] edges1 = g.getEdges().toArray(); - for (int i = 0; i < edges1.length; i++) { - Edge e1 = (Edge) edges1[i]; - int hits = 0; - Integer index1 = e1.getIndexKey(); - Object[] edges2 = g.getEdges().toArray(); - for (int j = 0; j < edges2.length; j++) { - Edge e2 = (Edge) edges2[j]; - Integer index2 = e2.getIndexKey(); - if (index1.intValue() == index2.intValue()) { - hits++; - } - } - assertTrue(hits == 1); - - Object[] vertices2 = g.getVertices().toArray(); - for (int j = 0; j < vertices1.length; j++) { - Vertex v2 = (Vertex) vertices2[j]; - Integer index2 = v2.getIndexKey(); - if (index1.intValue() == index2.intValue()) { - hits++; - } - } - assertTrue(hits == 1); - } - } -} diff --git a/src/test/java/org/graphwalker/mbt_init.xml b/src/test/java/org/graphwalker/mbt_init.xml deleted file mode 100755 index b9b6cc72..00000000 --- a/src/test/java/org/graphwalker/mbt_init.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/java/org/graphwalker/multiple/ModelHandlerTest.java b/src/test/java/org/graphwalker/multiple/ModelHandlerTest.java deleted file mode 100644 index f6417dfb..00000000 --- a/src/test/java/org/graphwalker/multiple/ModelHandlerTest.java +++ /dev/null @@ -1,139 +0,0 @@ -package org.graphwalker.multiple; - -import org.apache.log4j.Logger; -import org.graphwalker.Util; -import org.junit.Ignore; -import org.junit.Test; -import static org.junit.Assert.*; - -import org.graphwalker.conditions.EdgeCoverage; -import org.graphwalker.conditions.NeverCondition; -import org.graphwalker.conditions.ReachedVertex; -import org.graphwalker.generators.RandomPathGenerator; -import org.graphwalker.multipleModels.ModelAPI; -import org.graphwalker.multipleModels.ModelHandler; - -public class ModelHandlerTest { - - static Logger logger = Util.setupLogger(ModelHandlerTest.class); - - @Test - public void contructor() throws Exception { - ModelHandler modelhandler = new ModelHandler(); - assertNotNull(modelhandler); - assertNotNull(modelhandler.getModels()); - } - - @Test - public void addModels() throws Exception { - ModelHandler modelhandler = new ModelHandler(); - modelhandler.add("A", new ModelAPI("graphml/multiple/switch/A.graphml", true, new RandomPathGenerator(new NeverCondition()), false)); - assertTrue(modelhandler.getModels().size() == 1); - modelhandler.add("B", new ModelAPI("graphml/multiple/switch/B.graphml", true, new RandomPathGenerator(new NeverCondition()), false)); - assertTrue(modelhandler.getModels().size() == 2); - } - - @Test(expected = IllegalArgumentException.class) - public void addDuplicateNameModels() throws Exception { - ModelHandler modelhandler = new ModelHandler(); - modelhandler.add("A", new ModelAPI("graphml/multiple/switch/A.graphml", true, new RandomPathGenerator(new NeverCondition()), false)); - modelhandler.add("A", new ModelAPI("graphml/multiple/switch/B.graphml", true, new RandomPathGenerator(new NeverCondition()), false)); - } - - @Test - public void removeModel() throws Exception { - ModelHandler modelhandler = new ModelHandler(); - modelhandler.add("A", new ModelAPI("graphml/multiple/switch/A.graphml", true, new RandomPathGenerator(new NeverCondition()), false)); - modelhandler.remove(0); - assertTrue(modelhandler.getModels().isEmpty()); - } - - @Test(expected = IllegalArgumentException.class) - public void executeIncorrectName() throws Exception { - ModelHandler modelhandler = new ModelHandler(); - modelhandler.add("A", new ModelAPI("graphml/multiple/switch/A.graphml", true, new RandomPathGenerator(new NeverCondition()), false)); - modelhandler.execute("a"); - } - - @Test - public void executeSingleModel() throws Exception { - ModelHandler modelhandler = new ModelHandler(); - modelhandler.add("A", new Model_A_API("graphml/multiple/switch/A.graphml", true, new RandomPathGenerator(new EdgeCoverage(1.0)))); - modelhandler.execute("A"); - assertTrue(modelhandler.isAllModelsDone()); - } - - @Test - public void executeTwoModel() throws Exception { - ModelHandler modelhandler = new ModelHandler(); - modelhandler.add("A", new Model_A_API("graphml/multiple/switch/A.graphml", true, new RandomPathGenerator(new EdgeCoverage(1.0)))); - modelhandler.add("B", new Model_B_API("graphml/multiple/switch/B.graphml", true, new RandomPathGenerator(new EdgeCoverage(1.0)))); - modelhandler.execute("A"); - assertTrue(modelhandler.isAllModelsDone()); - } - - @Test - public void executeTwoModelsCulDeSac() throws Exception { - ModelHandler modelhandler = new ModelHandler(); - - modelhandler.add("Login", new Model_A1_API("graphml/multiple/switch/A1.graphml", true, new RandomPathGenerator(new EdgeCoverage(1.0)))); - modelhandler.add("ExitClient", new Model_B1_API("graphml/multiple/switch/B1.graphml", true, new RandomPathGenerator(new EdgeCoverage( - 1.0)))); - - modelhandler.execute("Login"); - assertTrue(modelhandler.isAllModelsDone()); - } - - @Ignore - public void executeModelThatStops() throws Exception { - ModelHandler modelhandler = new ModelHandler(); - - modelhandler.add("A", new Model_A_API("graphml/multiple/switch/A.graphml", true, new RandomPathGenerator( - new ReachedVertex("v_WhatsNew")))); - modelhandler.add("B", new Model_B_API("graphml/multiple/switch/B.graphml", true, new RandomPathGenerator(new EdgeCoverage(1.0)))); - - modelhandler.execute("A"); - assertTrue(modelhandler.isAllModelsDone()); - } - - @Test - public void executeThreeModel() throws Exception { - ModelHandler modelhandler = new ModelHandler(); - modelhandler.add("A", new Model_A_API("graphml/multiple/switch/A.graphml", true, new RandomPathGenerator( - new ReachedVertex("v_WhatsNew")))); - modelhandler.add("B", new Model_B_API("graphml/multiple/switch/B.graphml", true, new RandomPathGenerator(new EdgeCoverage(1.0)))); - modelhandler.add("C", new Model_C_API("graphml/multiple/switch/C.graphml", true, new RandomPathGenerator(new EdgeCoverage(1.0)))); - modelhandler.execute("A"); - assertTrue(modelhandler.isAllModelsDone()); - } - - @Test - public void getStatistics() throws Exception { - ModelHandler modelhandler = new ModelHandler(); - modelhandler.add("A", new Model_A_API("graphml/multiple/switch/A.graphml", true, new RandomPathGenerator( - new ReachedVertex("v_WhatsNew")))); - modelhandler.execute("A"); - assertTrue(modelhandler.isAllModelsDone()); - - String actualResult = modelhandler.getStatistics(); - assertTrue(actualResult, actualResult.contains("Statistics for A:")); - assertFalse(actualResult, actualResult.contains("Statistics for B:")); - assertFalse(actualResult, actualResult.contains("Statistics for C:")); - } - - @Test - public void getStatisticsMultipleModels() throws Exception { - ModelHandler modelhandler = new ModelHandler(); - modelhandler.add("A", new Model_A_API("graphml/multiple/switch/A.graphml", true, new RandomPathGenerator( - new ReachedVertex("v_WhatsNew")))); - modelhandler.add("B", new Model_B_API("graphml/multiple/switch/B.graphml", true, new RandomPathGenerator(new EdgeCoverage(1.0)))); - modelhandler.add("C", new Model_C_API("graphml/multiple/switch/C.graphml", true, new RandomPathGenerator(new EdgeCoverage(1.0)))); - modelhandler.execute("A"); - assertTrue(modelhandler.isAllModelsDone()); - - String actualResult = modelhandler.getStatistics(); - assertTrue(actualResult, actualResult.contains("Statistics for A:")); - assertTrue(actualResult, actualResult.contains("Statistics for B:")); - assertTrue(actualResult, actualResult.contains("Statistics for C:")); - } -} diff --git a/src/test/java/org/graphwalker/multiple/Model_A1_API.java b/src/test/java/org/graphwalker/multiple/Model_A1_API.java deleted file mode 100644 index 922d1aa5..00000000 --- a/src/test/java/org/graphwalker/multiple/Model_A1_API.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.graphwalker.multiple; - -import org.graphwalker.generators.PathGenerator; -import org.graphwalker.multipleModels.ModelAPI; - -/** - * Hello world! - * - */ -public class Model_A1_API extends ModelAPI { - - public Model_A1_API(String model, boolean efsm, PathGenerator generator) { - super(model, efsm, generator, false); - } - - public void e_Init() { - } - - public void e_StartClient() { - } - - public void e_ValidPremiumCredentials() { - } - - public void v_ClientNotRunning() { - } - - public void v_LoginPrompted() { - } - - public void v_WhatsNew() { - } -} diff --git a/src/test/java/org/graphwalker/multiple/Model_A_API.java b/src/test/java/org/graphwalker/multiple/Model_A_API.java deleted file mode 100644 index bfa99fae..00000000 --- a/src/test/java/org/graphwalker/multiple/Model_A_API.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.graphwalker.multiple; - -import org.graphwalker.generators.PathGenerator; -import org.graphwalker.multipleModels.ModelAPI; - -/** - * Hello world! - * - */ -public class Model_A_API extends ModelAPI { - - public Model_A_API(String model, boolean efsm, PathGenerator generator) { - super(model, efsm, generator, false); - } - - public void e_ExitClient() { - } - - public void e_Init() { - } - - public void e_LogOut() { - } - - public void e_Start() { - } - - public void e_ToggleRememberMe() { - } - - public void e_ValidLogin() { - } - - public void v_ClientNotRunning() { - } - - public void v_ClientRunning() { - } - - public void v_Login() { - } - - public void v_WhatsNew() { - } -} diff --git a/src/test/java/org/graphwalker/multiple/Model_B1_API.java b/src/test/java/org/graphwalker/multiple/Model_B1_API.java deleted file mode 100644 index fb40aa85..00000000 --- a/src/test/java/org/graphwalker/multiple/Model_B1_API.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.graphwalker.multiple; - -import org.graphwalker.generators.PathGenerator; -import org.graphwalker.multipleModels.ModelAPI; - -/** - * Hello world! - * - */ -public class Model_B1_API extends ModelAPI { - - public Model_B1_API(String model, boolean efsm, PathGenerator generator) { - super(model, efsm, generator, false); - } - - public void e_Init() { - } - - public void e_Logout() { - } - - public void e_Close() { - } - - public void e_ExitClient() { - } - - public void v_ClientNotRunning() { - } - - public void v_LoginPrompted() { - } - - public void v_WhatsNew() { - } -} diff --git a/src/test/java/org/graphwalker/multiple/Model_B_API.java b/src/test/java/org/graphwalker/multiple/Model_B_API.java deleted file mode 100644 index 287d528b..00000000 --- a/src/test/java/org/graphwalker/multiple/Model_B_API.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.graphwalker.multiple; - -import org.graphwalker.generators.PathGenerator; -import org.graphwalker.multipleModels.ModelAPI; - -/** - * Hello world! - * - */ -public class Model_B_API extends ModelAPI { - - public Model_B_API(String model, boolean efsm, PathGenerator generator) { - super(model, efsm, generator, false); - } - - public void e_CreatePlaylist() { - } - - public void e_DeletePlaylist() { - } - - public void e_Init() { - } - - public void v_PaylistCreated() { - } - - public void v_WhatsNew() { - } -} diff --git a/src/test/java/org/graphwalker/multiple/Model_C_API.java b/src/test/java/org/graphwalker/multiple/Model_C_API.java deleted file mode 100644 index 7327dc96..00000000 --- a/src/test/java/org/graphwalker/multiple/Model_C_API.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.graphwalker.multiple; - -import org.graphwalker.generators.PathGenerator; -import org.graphwalker.multipleModels.ModelAPI; - -/** - * Hello world! - * - */ -public class Model_C_API extends ModelAPI { - - public Model_C_API(String model, boolean efsm, PathGenerator generator) { - super(model, efsm, generator, false); - } - - public void e_GotoWhatsNew() { - } - - public void e_ViewPlaylist() { - } - - public void e_Init() { - } - - public void v_PaylistCreated() { - } - - public void v_WhatsNew() { - } -} diff --git a/src/test/resources/bsh/reqtags/graph.bsh b/src/test/resources/bsh/reqtags/graph.bsh deleted file mode 100644 index 7e224c01..00000000 --- a/src/test/resources/bsh/reqtags/graph.bsh +++ /dev/null @@ -1,46 +0,0 @@ -import bsh.util.BshCanvas; // BshCanvas simply buffers graphics - -graph( int width, int height ) { - scale=object(); - scale.x=100; scale.y=100; - - drawAxis() { - graphics.setColor( Color.red ); - graphics.drawLine( 0, height/2, width, height/2 ); - graphics.drawLine( width/2, 0, width/2, height ); - } - - plot(x, y, Color color) { - graphics.setColor( color ); - graphics.fillOval( (int)((x/scale.x+1)*(width/2))-1, - (int)((-y/scale.y+1)*(height/2))-1, 3, 3); - canvas.repaint(); - } - - clear() { - graphics.setColor( Color.white ); - graphics.fillRect(0,0,width,height); - drawAxis(); - canvas.repaint(); - } - - setScale( x, y ) { - scale.x=1.0*x; - scale.y=1.0*y; - } - - canvas=new BshCanvas(); - canvas.setSize( width, height ); - frame=frame( canvas ); - graphics=canvas.getBufferedGraphics(); - drawAxis(); - - return this; -} - -g=graph(400,200); -g.setScale(2*Math.PI,1.0); -for (x=-2*Math.PI; x<2*Math.PI; x+=0.1) { - y=Math.sin(x); - g.plot( x, y, Color.black ); -} diff --git a/src/test/resources/bsh/reqtags/mbt_startup.bsh b/src/test/resources/bsh/reqtags/mbt_startup.bsh deleted file mode 100644 index f9e705f8..00000000 --- a/src/test/resources/bsh/reqtags/mbt_startup.bsh +++ /dev/null @@ -1,3 +0,0 @@ - import java.util.Vector; - - Vector v = new Vector(); \ No newline at end of file diff --git a/src/test/resources/graphml/ModelBasedTestingTest.testNewState.graphml b/src/test/resources/graphml/ModelBasedTestingTest.testNewState.graphml deleted file mode 100644 index 96f6d8f6..00000000 --- a/src/test/resources/graphml/ModelBasedTestingTest.testNewState.graphml +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - v_BrowserStarted - - - - - - - - - - - - - v_BaseURL -REQTAG=UC01 2.2.1 - - - - - - - - - - - - - v_SearchResult -REQTAG=UC01 2.2.2 - - - - - - - - - - - - - v_BrowserStopped - - - - - - - - - - - - - v_BookInformation -REQTAG=UC01 2.2.3 - - - - - - - - - - - - - v_OtherBoughtBooks - - - - - - - - - - - - - v_ShoppingCart -REQTAG=UC01 2.3 - - - - - - - - - - - - - e_init / num_of_books = 0; MAX_BOOKS = 5; - - - - - - - - - - - - e_EnterBaseURL - - - - - - - - - - - - e_SearchBook - - - - - - - - - - - - e_StartBrowser - - - - - - - - - - - - e_ClickBook - - - - - - - - - - - - - - - e_AddBookToCart [num_of_books<=MAX_BOOKS] / num_of_books++; - - - - - - - - - - - - - - - - - e_ShoppingCart - - - - - - - - - - - - - - - e_ShoppingCart - - - - - - - - - - - - - - - - - e_ShoppingCart - - - - - - - - - - - - - - - - - e_SearchBook - - - - - - - - - - - - - - - - - e_SearchBook - - - - - - - - - - - - - - - - - e_SearchBook - - - - - - - - - - diff --git a/src/test/resources/graphml/UC01.graphml b/src/test/resources/graphml/UC01.graphml deleted file mode 100644 index 96f6d8f6..00000000 --- a/src/test/resources/graphml/UC01.graphml +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - v_BrowserStarted - - - - - - - - - - - - - v_BaseURL -REQTAG=UC01 2.2.1 - - - - - - - - - - - - - v_SearchResult -REQTAG=UC01 2.2.2 - - - - - - - - - - - - - v_BrowserStopped - - - - - - - - - - - - - v_BookInformation -REQTAG=UC01 2.2.3 - - - - - - - - - - - - - v_OtherBoughtBooks - - - - - - - - - - - - - v_ShoppingCart -REQTAG=UC01 2.3 - - - - - - - - - - - - - e_init / num_of_books = 0; MAX_BOOKS = 5; - - - - - - - - - - - - e_EnterBaseURL - - - - - - - - - - - - e_SearchBook - - - - - - - - - - - - e_StartBrowser - - - - - - - - - - - - e_ClickBook - - - - - - - - - - - - - - - e_AddBookToCart [num_of_books<=MAX_BOOKS] / num_of_books++; - - - - - - - - - - - - - - - - - e_ShoppingCart - - - - - - - - - - - - - - - e_ShoppingCart - - - - - - - - - - - - - - - - - e_ShoppingCart - - - - - - - - - - - - - - - - - e_SearchBook - - - - - - - - - - - - - - - - - e_SearchBook - - - - - - - - - - - - - - - - - e_SearchBook - - - - - - - - - - diff --git a/src/test/resources/graphml/bugs/Issue_10.graphml b/src/test/resources/graphml/bugs/Issue_10.graphml deleted file mode 100644 index e7bc6fe7..00000000 --- a/src/test/resources/graphml/bugs/Issue_10.graphml +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - Start - - - - - - - - - - - - A - - - - - - - - - - - - B - - - - - - - - - - - - C - - - - - - - - - - - - D - - - - - - - - - - - - a / myString="Forward slash /"; - - - - - - - - - - - - - - - b[myString.equals("Forward slash /")] - - - - - - - - - - - - - - - c [myString.equals("Hello MBT")] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - d[myString.equals("[a string brackets]")]/x[0]="[a string brackets]"; - - - - - - - - - - diff --git a/src/test/resources/graphml/bugs/Issue_9.graphml b/src/test/resources/graphml/bugs/Issue_9.graphml deleted file mode 100644 index 96f6d8f6..00000000 --- a/src/test/resources/graphml/bugs/Issue_9.graphml +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - v_BrowserStarted - - - - - - - - - - - - - v_BaseURL -REQTAG=UC01 2.2.1 - - - - - - - - - - - - - v_SearchResult -REQTAG=UC01 2.2.2 - - - - - - - - - - - - - v_BrowserStopped - - - - - - - - - - - - - v_BookInformation -REQTAG=UC01 2.2.3 - - - - - - - - - - - - - v_OtherBoughtBooks - - - - - - - - - - - - - v_ShoppingCart -REQTAG=UC01 2.3 - - - - - - - - - - - - - e_init / num_of_books = 0; MAX_BOOKS = 5; - - - - - - - - - - - - e_EnterBaseURL - - - - - - - - - - - - e_SearchBook - - - - - - - - - - - - e_StartBrowser - - - - - - - - - - - - e_ClickBook - - - - - - - - - - - - - - - e_AddBookToCart [num_of_books<=MAX_BOOKS] / num_of_books++; - - - - - - - - - - - - - - - - - e_ShoppingCart - - - - - - - - - - - - - - - e_ShoppingCart - - - - - - - - - - - - - - - - - e_ShoppingCart - - - - - - - - - - - - - - - - - e_SearchBook - - - - - - - - - - - - - - - - - e_SearchBook - - - - - - - - - - - - - - - - - e_SearchBook - - - - - - - - - - diff --git a/src/test/resources/graphml/efsm_lables/testMergeEFSM_Lables.graphml b/src/test/resources/graphml/efsm_lables/testMergeEFSM_Lables.graphml deleted file mode 100644 index 4bdb908b..00000000 --- a/src/test/resources/graphml/efsm_lables/testMergeEFSM_Lables.graphml +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - - - - - - - - - - Start - - - - - - - - - - - - V1 - - - - - - - - - - - - V2 - - - - - - - - - - - - V3 - - - - - - - - - - - - V4 - - - - - - - - - - - - V5 - - - - - - - - - - - - V6 - - - - - - - - - - - - V7 - - - - - - - - - - - - V8 - - - - - - - - - - - - V9 - - - - - - - - - - - - V10 - - - - - - - - - - - - V11 - - - - - - - - - - - - V12 - - - - - - - - - - - - V13 - - - - - - - - - - - - Label - - - - - - - - - - - - Label Parameter - - - - - - - - - - - - Label Parameter [x=true] - - - - - - - - - - - - Label Parameter [x=true] / Action1; - - - - - - - - - - - - Label Parameter [x=true] / Action1;Action2; - - - - - - - - - - - - Label Parameter [x=true] / Action1;Action2;Action3; - - - - - - - - - - - - [x=true] - - - - - - - - - - - - / Action1; - - - - - - - - - - - - [x=true] / Action1; - - - - - - - - - - - - Label [x=true] - - - - - - - - - - - - Label / Action1; - - - - - - - - - - - - Label Parameter / Action1; - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/mergeSubgraphs_01/a.graphml b/src/test/resources/graphml/mergeSubgraphs_01/a.graphml deleted file mode 100644 index c9ea74b8..00000000 --- a/src/test/resources/graphml/mergeSubgraphs_01/a.graphml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - A - - - - - - - - - - - B - - - - - - - - - - - C - - - - - - - - - - - - - - - a - - - - - - - - - - - b - - - - - - - - - - - a - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - c - - - - - - - - - - - - - - c - - - - - - diff --git a/src/test/resources/graphml/mergeSubgraphs_01/b.graphml b/src/test/resources/graphml/mergeSubgraphs_01/b.graphml deleted file mode 100644 index af6a6f09..00000000 --- a/src/test/resources/graphml/mergeSubgraphs_01/b.graphml +++ /dev/null @@ -1,278 +0,0 @@ - - - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - B - - - - - - - - - - - - D - - - - - - - - - - - - E - - - - - - - - - - - - Stop - - - - - - - - - - - - - - - d - - - - - - - - - - - - - - - e - - - - - - - - - - - - - - - - - - - d - - - - - - - - - - - - - - - - - d_2 - - - - - - - - - - - - - - - - d_4 - - - - - - - - - - - - - - - - d_3 - - - - - - - - - - - - - - - - - - - - - - - a_3 - - - - - - - - - - - - - - - - - a_2 - - - - - - - - - - - - - - - - - a_1 - - - - - - - - - - - - - - - - - c - - - - - - - - - - - - - - - c - - - - - - - - - - - - - - - c - - - - - - - - - diff --git a/src/test/resources/graphml/mergeSubgraphs_02/a.graphml b/src/test/resources/graphml/mergeSubgraphs_02/a.graphml deleted file mode 100644 index 4241c526..00000000 --- a/src/test/resources/graphml/mergeSubgraphs_02/a.graphml +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - E - - - - - - - - - - - A - - - - - - - - - - - D - - - - - - - - - - - B - - - - - - - - - - - C - - - - - - - - - - - a - - - - - - - - - - - - - - e_2 - - - - - - - - - - - - - - - - e_1 - - - - - - - - - - - - - - - a_1 - - - - - - - - - - - - - - - - d - - - - - - - - - - - - - - - d_1 - - - - - - - - - - - - - - - - a_1 - - - - - - - - - - - - - - - - a_2 - - - - - - - - - - - - - - b - - - - - - - - - - - - - - - c_1 - - - - - - - - - - - - - - - - a - - - - - - - - - - - - - - - - a_1 - - - - - - - - - - - - - - c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e - - - - - - - - - - - - - - e - - - - - - - - - - - - - - e - - - - - - - - - - - - - - e - - - - - - diff --git a/src/test/resources/graphml/mergeSubgraphs_02/b.graphml b/src/test/resources/graphml/mergeSubgraphs_02/b.graphml deleted file mode 100644 index 5faff8e8..00000000 --- a/src/test/resources/graphml/mergeSubgraphs_02/b.graphml +++ /dev/null @@ -1,740 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - F - - - - - - - - - - - O - - - - - - - - - - - G - - - - - - - - - - - I - - - - - - - - - - - B - - - - - - - - - - - N - - - - - - - - - - - Stop - - - - - - - - - - - M - - - - - - - - - - - L - - - - - - - - - - - K - - - - - - - - - - - J - - - - - - - - - - - H - - - - - - - - - - - - - - - f - - - - - - - - - - - - - - o - - - - - - - - - - - - - - h - - - - - - - - - - - - - - g - - - - - - - - - - - - - - - - f - - - - - - - - - - - - - - - - - - f - - - - - - - - - - - - - - - - f - - - - - - - - - - - - - - - g - - - - - - - - - - - - - - - h - - - - - - - - - - - - - - i - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - f - - - - - - - - - - - - - - n - - - - - - - - - - - - - - - - e_2 - - - - - - - - - - - - - - - n - - - - - - - - - - - - - - m - - - - - - - - - - - - - - e_1 - - - - - - - - - - - - - - - l - - - - - - - - - - - - - - l - - - - - - - - - - - - - - - - e_2 - - - - - - - - - - - - - - - k - - - - - - - - - - - k - - - - - - - - - - - - - - e_1 - - - - - - - - - - - - - - - - e_1 - - - - - - - - - - - - - - e_2 - - - - - - - - - - - - - - j - - - - - - - - - - - - - - - - e_1 - - - - - - - - - - - - - - - - e - - - - - - - - - - - - - - - - e_1 - - - - - - - - - - - - - - - - e_2 - - - - - - - - - - - - - - e - - - - - - - - - - - - - - e - - - - - - - - - - - - - - e - - - - - - - - - - - - - - e - - - - - - - - - - - - - - e - - - - - - - - - - - - - - - - e - - - - - - - - - - - - - - - - e - - - - - - - - - - - - - - e - - - - - - - - - - - - - - - - e - - - - - - diff --git a/src/test/resources/graphml/merging/Filter.graphml b/src/test/resources/graphml/merging/Filter.graphml deleted file mode 100644 index 8f475942..00000000 --- a/src/test/resources/graphml/merging/Filter.graphml +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - - - - - - - - - - - - - - - v_A - - - - - - - - - - - v_D - - - - - - - - - - - Start - - - - - - - - - - - v_B - - - - - - - - - - - v_C - - - - - - - - - - - v_E - - - - - - - - - - - - - - e_B - - - - - - - - - - - - - - e_C - - - - - - - - - - - - - - e_E - - - - - - - - - - - e_init - - - - - - - - - - - - - - - - e_A - - - - - - - - - - - - - - - - e_A - - - - - - - - - - - - - - - - e_A - - - - - - - - - - - - - - - - e_A - - - - - - - - - - - - - - e_D - - - - - - - - - diff --git a/src/test/resources/graphml/merging/Filterval5CD.graphml b/src/test/resources/graphml/merging/Filterval5CD.graphml deleted file mode 100644 index 8c981870..00000000 --- a/src/test/resources/graphml/merging/Filterval5CD.graphml +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - v_C3 - - - - - - - - - - v_C4 - - - - - - - - - - v_C6 - - - - - - - - - - - - v_C1 - - - - - - - - - - - - v_C2 - - - - - - - - - - v_C5 - - - - - - - - - - - v_C - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - e_C3 - - - - - - - - - - - - - - - - e_C4 - - - - - - - - - - - - - - e_C5 - - - - - - - - - - - - - - - - e_C6 - - - - - - - - - - - - - - - - e_C3 - - - - - - - - - - - - - - e_C4 - - - - - - - - - - - - - - - - e_C5 - - - - - - - - - - - - - - - - e_C6 - - - - - - - - - - - - - - - - - - - - - - - - e_C1 - - - - - - - - - - - - - - e_C2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/merging/Filterval7CD.graphml b/src/test/resources/graphml/merging/Filterval7CD.graphml deleted file mode 100644 index a137e6d1..00000000 --- a/src/test/resources/graphml/merging/Filterval7CD.graphml +++ /dev/null @@ -1,333 +0,0 @@ - - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - v_E3 - - - - - - - - - - v_E4 - - - - - - - - - - v_E5 - - - - - - - - - - v_E6 - - - - - - - - - - - v_E1 - - - - - - - - - - - - v_E2 - - - - - - - - - - - - v_E - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - e_E3 - - - - - - - - - - - - - - - - e_E6 - - - - - - - - - - - - - - e_E5 - - - - - - - - - - - - - - - - e_E4 - - - - - - - - - - - - - - - - e_E3 - - - - - - - - - - - - - - e_E4 - - - - - - - - - - - - - - - - e_E5 - - - - - - - - - - - - - - - - e_E6 - - - - - - - - - - - - - - - - - - - - - - - - - e_E1 - - - - - - - - - - - - - - e_E2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/merging/FiltervalOH.graphml b/src/test/resources/graphml/merging/FiltervalOH.graphml deleted file mode 100644 index 8053c171..00000000 --- a/src/test/resources/graphml/merging/FiltervalOH.graphml +++ /dev/null @@ -1,501 +0,0 @@ - - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - v_B5 - - - - - - - - - - v_B6 - - - - - - - - - - v_B7 - - - - - - - - - - v_B8 - - - - - - - - - - v_B4 - - - - - - - - - - v_B3 - - - - - - - - - - v_B2 - - - - - - - - - - v_B1 - - - - - - - - - - v_B - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - e_B5 - - - - - - - - - - - - - - - - e_B6 - - - - - - - - - - - - - - e_B7 - - - - - - - - - - - - - - - - e_B7 - - - - - - - - - - - - - - - - e_B5 - - - - - - - - - - - - - - - - e_B6 - - - - - - - - - - - - - - e_B7 - - - - - - - - - - - - - - - - e_B8 - - - - - - - - - - - - - - - - e_B5 - - - - - - - - - - - - - - e_B6 - - - - - - - - - - - - - - - - e_B7 - - - - - - - - - - - - - - - - e_B7 - - - - - - - - - - - - - - - - e_B5 - - - - - - - - - - - - - - e_B6 - - - - - - - - - - - - - - - - e_B7 - - - - - - - - - - - - - - - - e_B7 - - - - - - - - - - - - - - - - - - - - - - - - - e_B1 - - - - - - - - - - - - - - e_B2 - - - - - - - - - - - - - - e_B3 - - - - - - - - - - - - - - e_B4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/merging/FiltervalTH.graphml b/src/test/resources/graphml/merging/FiltervalTH.graphml deleted file mode 100644 index a96b2f05..00000000 --- a/src/test/resources/graphml/merging/FiltervalTH.graphml +++ /dev/null @@ -1,719 +0,0 @@ - - - - - - - - - - - - - - - - - - - v_D4 - - - - - - - - - - - - v_D6 - - - - - - - - - - - v_D5 - - - - - - - - - - - - v_D7 - - - - - - - - - - - v_D1 - - - - - - - - - - - - v_D2 - - - - - - - - - - - v_D3 - - - - - - - - - - - - v_D8 - - - - - - - - - - - - v_D9 - - - - - - - - - - - - v_D11 - - - - - - - - - - - v_D10 - - - - - - - - - - start - - - - - - - - - - - - - - v_D - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - e_D8 - - - - - - - - - - - - - - - - e_D9 - - - - - - - - - - - - - - e_D11 - - - - - - - - - - - - - - - - e_D10 - - - - - - - - - - - - - - - - e_D10 - - - - - - - - - - - - - - - - e_D11 - - - - - - - - - - - - - - - - e_D9 - - - - - - - - - - - - - - e_D8 - - - - - - - - - - - - - - - - e_D9 - - - - - - - - - - - - - - - - e_D11 - - - - - - - - - - - - - - - - e_D10 - - - - - - - - - - - - - - - - e_D9 - - - - - - - - - - - - - - e_D8 - - - - - - - - - - - - - - - - e_D10 - - - - - - - - - - - - - - e_D11 - - - - - - - - - - - - - - - - e_D8 - - - - - - - - - - - - - - - - e_D4 - - - - - - - - - - - - - - e_D6 - - - - - - - - - - - - - - - - e_D5 - - - - - - - - - - - - - - - - e_D7 - - - - - - - - - - - - - - - - e_D4 - - - - - - - - - - - - - - - - e_D6 - - - - - - - - - - - - - - e_D5 - - - - - - - - - - - - - - - - e_D7 - - - - - - - - - - - - - - - - e_D4 - - - - - - - - - - - - - - - - e_D6 - - - - - - - - - - - - - - e_D5 - - - - - - - - - - - - - - - - e_D7 - - - - - - - - - - - - - - - - - - - - - - - - - e_Click_No_limit - - - - - - - - - - - e_Click_Pot_limit - - - - - - - - - - - - - - E_Click_Fixed_Limit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/methods/ExtendedMain.graphml b/src/test/resources/graphml/methods/ExtendedMain.graphml deleted file mode 100644 index 4ea8af8d..00000000 --- a/src/test/resources/graphml/methods/ExtendedMain.graphml +++ /dev/null @@ -1,412 +0,0 @@ - - - - - - - - - - - - - - - Start - - - - - - - - - - - - v_KeePassNotRunning - - - - - - - - - - - - v_MainWindowEmpty - - - - - - - - - - - - v_EnterMasterCompositeMasterKey - - - - - - - - - - - - v_InvalidKey - - - - - - - - - - - - v_MainWindow_DB_Loaded - - - - - - - - - - - - v_SaveBeforeCloseLock - - - - - - - - - - - - v_SaveBeforeCloseLock - - - - - - - - - - - - e_Initialize / incorrect=0; databaseChanged=false - - - - - - - - - - - - - - - - - e_Start - - - - - - - - - - - - - - - e_StartWithDatabase - - - - - - - - - - - - - - - e_EnterInvalidKey/incorrect=incorrect+1 - - - - - - - - - - - - - - - - - e_CloseDialog[incorrect<3] - - - - - - - - - - - - - - - - - e_CloseDialog[incorrect==3]/incorrect=0 - - - - - - - - - - - - - - - e_EnterCorrectKey/incorrect=0 - - - - - - - - - - - - - - - - - e_CloseApp[databaseChanged==false] - - - - - - - - - - - - - - - - - e_CloseApp - - - - - - - - - - - - - - - e_CloseApp[databaseChanged==true&&incorrect==0] - - - - - - - - - - - - - - - - - e_Cancel - - - - - - - - - - - - - - - - - e_Yes - - - - - - - - - - - - - - - - - e_No - - - - - - - - - - - - - - - - - e_CloseDB[databaseChanged==true] - - - - - - - - - - - - - - - e_CloseDB[databaseChanged==false] - - - - - - - - - - - - - - - e_Yes - - - - - - - - - - - - - - - e_No - - - - - - - - - - - - - - - - - e_Cancel - - - - - - - - - - - - - - - - e_ChangeDatabase/databaseChanged=true - - - - - - - - - - diff --git a/src/test/resources/graphml/methods/Main.graphml b/src/test/resources/graphml/methods/Main.graphml deleted file mode 100644 index 54c6267e..00000000 --- a/src/test/resources/graphml/methods/Main.graphml +++ /dev/null @@ -1,421 +0,0 @@ - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - v_KeePassNotRunning - - - - - - - - - - - - - v_MainWindowEmpty - - - - - - - - - - - - - v_EnterMasterCompositeMasterKey - - - - - - - - - - - - - v_InvalidKey - - - - - - - - - - - - - v_MainWindow_DB_Loaded - - - - - - - - - - - - - v_SaveBeforeCloseLock - - - - - - - - - - - - - v_SaveBeforeCloseLock - - - - - - - - - - - - - e_Initialize - - - - - - - - - - - - - - - - - - e_Start - - - - - - - - - - - - - - - - e_StartWithDatabase - - - - - - - - - - - - - e_EnterInvalidKey - - - - - - - - - - - - - - - - - - e_CloseDialog BACKTRACK /* If incorrect < 3 times */ - - - - - - - - - - - - - - - - e_CloseDialog BACKTRACK /* If incorrect key 3 times */ - - - - - - - - - - - - - - - - - - e_EnterCorrectKey - - - - - - - - - - - - - - - - - - - - e_CloseApp BACKTRACK /* If database unchanged */ - - - - - - - - - - - - - - - - - - e_CloseApp - - - - - - - - - - - - - - - - - - e_CloseApp BACKTRACK /* If database changed */ - - - - - - - - - - - - - - - - - - e_Cancel - - - - - - - - - - - - - - - - - - e_Yes - - - - - - - - - - - - - - - - - - e_No - - - - - - - - - - - - - e_CloseDB BACKTRACK /* If database changed */ - - - - - - - - - - - - - - - - e_CloseDB BACKTRACK /* If database unchanged */ - - - - - - - - - - - - - - - - - - e_Yes - - - - - - - - - - - - - - - - e_No - - - - - - - - - - - - - - - - - - - - e_Cancel - - - - - - - - diff --git a/src/test/resources/graphml/misc/missing_inedges.graphml b/src/test/resources/graphml/misc/missing_inedges.graphml deleted file mode 100644 index b987cf04..00000000 --- a/src/test/resources/graphml/misc/missing_inedges.graphml +++ /dev/null @@ -1,389 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_KeePassNotRunning - - - - - - - - - - - v_MainWindowEmpty - - - - - - - - - - - v_EnterMasterCompositeMasterKey - - - - - - - - - - - v_InvalidKey - - - - - - - - - - - v_MainWindow_DB_Loaded - - - - - - - - - - - v_SaveBeforeCloseLock - - - - - - - - - - - v_SaveBeforeCloseLock - - - - - - - - - - - v_InvalidKey - - - - - - - - - - - e_Initialize - - - - - - - - - - - - - - - - e_Start - - - - - - - - - - - - - - e_StartWithDatabase - - - - - - - - - - - e_EnterInvalidKey - - - - - - - - - - - - - - - - e_CloseDialog BACKTRACK /* If incorrect < 3 times */ - - - - - - - - - - - - - - e_CloseDialog BACKTRACK /* If incorrect key 3 times */ - - - - - - - - - - - - - - - - e_EnterCorrectKey - - - - - - - - - - - - - - - - - - e_CloseApp BACKTRACK /* If database unchanged */ - - - - - - - - - - - - - - - - e_CloseApp - - - - - - - - - - - - - - - - e_CloseApp BACKTRACK /* If database changed */ - - - - - - - - - - - - - - - - e_Cancel - - - - - - - - - - - - - - - - e_Yes - - - - - - - - - - - - - - - - e_No - - - - - - - - - - - e_CloseDB BACKTRACK /* If database changed */ - - - - - - - - - - - - - - e_CloseDB BACKTRACK /* If database unchanged */ - - - - - - - - - - - - - - - - e_Yes - - - - - - - - - - - - - - e_No - - - - - - - - - - - - - - - - - - e_Cancel - - - - - - - - - - - - - e_CloseDialog BACKTRACK /* If incorrect key 3 times */ - - - - - - diff --git a/src/test/resources/graphml/misc/no_missing_inedges.graphml b/src/test/resources/graphml/misc/no_missing_inedges.graphml deleted file mode 100644 index e98dfc75..00000000 --- a/src/test/resources/graphml/misc/no_missing_inedges.graphml +++ /dev/null @@ -1,401 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_KeePassNotRunning - - - - - - - - - - - v_MainWindowEmpty - - - - - - - - - - - v_EnterMasterCompositeMasterKey - - - - - - - - - - - v_InvalidKey - - - - - - - - - - - v_MainWindow_DB_Loaded - - - - - - - - - - - v_SaveBeforeCloseLock - - - - - - - - - - - v_SaveBeforeCloseLock - - - - - - - - - - - v_InvalidKey - - - - - - - - - - - e_Initialize - - - - - - - - - - - - - - - - e_Start - - - - - - - - - - - - - - e_StartWithDatabase - - - - - - - - - - - e_EnterInvalidKey - - - - - - - - - - - - - - - - e_CloseDialog BACKTRACK /* If incorrect < 3 times */ - - - - - - - - - - - - - - e_CloseDialog BACKTRACK /* If incorrect key 3 times */ - - - - - - - - - - - - - - - - e_EnterCorrectKey - - - - - - - - - - - - - - - - - - e_CloseApp BACKTRACK /* If database unchanged */ - - - - - - - - - - - - - - - - e_CloseApp - - - - - - - - - - - - - - - - e_CloseApp BACKTRACK /* If database changed */ - - - - - - - - - - - - - - - - e_Cancel - - - - - - - - - - - - - - - - e_Yes - - - - - - - - - - - - - - - - e_No - - - - - - - - - - - e_CloseDB BACKTRACK /* If database changed */ - - - - - - - - - - - - - - e_CloseDB BACKTRACK /* If database unchanged */ - - - - - - - - - - - - - - - - e_Yes - - - - - - - - - - - - - - e_No - - - - - - - - - - - - - - - - - - e_Cancel - - - - - - - - - - - - - e_CloseDialog BACKTRACK /* If incorrect key 3 times */ - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/modelWithDescr.graphml b/src/test/resources/graphml/modelWithDescr.graphml deleted file mode 100644 index de6ba998..00000000 --- a/src/test/resources/graphml/modelWithDescr.graphml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - -A very fine description in a vertex -]]> - - - - - - v_WithDescription - - - - - - - - - - Start - - - - - - - - - - v_WithNoDescription - - - - - - - - - - v_ExtraVertex - - - - - - - - - - e_Init - - - - - - -A very fine description in a edge -]]> - - - - - - e_WithDescription - - - - - - - - - - - e_WithNoDescription - - - - - - - - - diff --git a/src/test/resources/graphml/multiple/A.graphml b/src/test/resources/graphml/multiple/A.graphml deleted file mode 100644 index 40cbab2e..00000000 --- a/src/test/resources/graphml/multiple/A.graphml +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - A - - - - - - - - - - B - - - - - - - - - - C - - - - - - - - - - D - - - - - - - - - - E - - - - - - - - - - F - - - - - - - - - - Start - - - - - - - - - - b - - - - - - - - - - - - - c - - - - - - - - - - - - - d - - - - - - - - - - - - - - - - - - - - - - - - - - - e - - - - - - - - - - - - - f - - - - - - - - - - - - - - - - - - - - - - - a - - - - - - - - diff --git a/src/test/resources/graphml/multiple/B.graphml b/src/test/resources/graphml/multiple/B.graphml deleted file mode 100644 index 9f885db2..00000000 --- a/src/test/resources/graphml/multiple/B.graphml +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - A - - - - - - - - - - B - - - - - - - - - - C - - - - - - - - - - D - - - - - - - - - - Start - - - - - - - - - - b - - - - - - - - - - - - - c - - - - - - - - - - - - - d - - - - - - - - - - - - - - - - - - - - - - a - - - - - - - - diff --git a/src/test/resources/graphml/multiple/switch/A.graphml b/src/test/resources/graphml/multiple/switch/A.graphml deleted file mode 100644 index 58bbd411..00000000 --- a/src/test/resources/graphml/multiple/switch/A.graphml +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - v_ClientNotRunning - - - - - - - - - - v_ClientRunning - - - - - - - - - - v_Login - - - - - - - - - - v_WhatsNew -SWITCH_MODEL - - - - - - - - - - Start - - - - - - - - - - - - - e_Start - - - - - - - - - - - - - [rememberMe==false] - - - - - - - - - - - - - e_ValidLogin - - - - - - - - - - e_Init / rememberMe=false; - - - - - - - - - - - - - [rememberMe==true] - - - - - - - - - - - - - - - e_LogOut - - - - - - - - - - - - - - - e_ExitClient - - - - - - - - - - - - - - e_ToggleRememberMe / rememberMe = !rememberMe; - - - - - - - - diff --git a/src/test/resources/graphml/multiple/switch/A1.graphml b/src/test/resources/graphml/multiple/switch/A1.graphml deleted file mode 100644 index a67b2803..00000000 --- a/src/test/resources/graphml/multiple/switch/A1.graphml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - v_ClientNotRunning - - - - - - - - - - - v_LoginPrompted - - - - - - - - - - - v_WhatsNew -SWITCH_MODEL - - - - - - - - - - - e_Init - - - - - - - - - - e_StartClient - - - - - - - - - - - e_ValidPremiumCredentials - - - - - - - - diff --git a/src/test/resources/graphml/multiple/switch/B1.graphml b/src/test/resources/graphml/multiple/switch/B1.graphml deleted file mode 100644 index e303ad69..00000000 --- a/src/test/resources/graphml/multiple/switch/B1.graphml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - v_ClientNotRunning -SWITCH_MODEL - - - - - - - - - - - v_LoginPrompted - - - - - - - - - - - v_WhatsNew - - - - - - - - - - - e_Init - - - - - - - - - - - - - - e_Logout - - - - - - - - - - - - - - e_ExitClient - - - - - - - - - - - - - e_Close - - - - - - - - - diff --git a/src/test/resources/graphml/multiple/switch/C.graphml b/src/test/resources/graphml/multiple/switch/C.graphml deleted file mode 100644 index 116000cf..00000000 --- a/src/test/resources/graphml/multiple/switch/C.graphml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - v_PaylistCreated - - - - - - - - - - v_WhatsNew - - - - - - - - - - Start - - - - - - - - - - - - - - - e_GotoWhatsNew - - - - - - - - - - e_Init - - - - - - - - - - - - - - - e_ViewPlaylist - - - - - - - - diff --git a/src/test/resources/graphml/org.graphwalker.EventDrivenModels.eventModel.a.graphml b/src/test/resources/graphml/org.graphwalker.EventDrivenModels.eventModel.a.graphml deleted file mode 100644 index fe0d0d23..00000000 --- a/src/test/resources/graphml/org.graphwalker.EventDrivenModels.eventModel.a.graphml +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - A - - - - - - - - - - - B - - - - - - - - - - - C - - - - - - - - - - - b - - - - - - - - - - - a - - - - - - - - - - - - - - c - - - - - - - - - - - - - - - - a - - - - - - - - - diff --git a/src/test/resources/graphml/org.graphwalker.EventDrivenModels.load2Models.1.graphml b/src/test/resources/graphml/org.graphwalker.EventDrivenModels.load2Models.1.graphml deleted file mode 100644 index 96f6d8f6..00000000 --- a/src/test/resources/graphml/org.graphwalker.EventDrivenModels.load2Models.1.graphml +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - v_BrowserStarted - - - - - - - - - - - - - v_BaseURL -REQTAG=UC01 2.2.1 - - - - - - - - - - - - - v_SearchResult -REQTAG=UC01 2.2.2 - - - - - - - - - - - - - v_BrowserStopped - - - - - - - - - - - - - v_BookInformation -REQTAG=UC01 2.2.3 - - - - - - - - - - - - - v_OtherBoughtBooks - - - - - - - - - - - - - v_ShoppingCart -REQTAG=UC01 2.3 - - - - - - - - - - - - - e_init / num_of_books = 0; MAX_BOOKS = 5; - - - - - - - - - - - - e_EnterBaseURL - - - - - - - - - - - - e_SearchBook - - - - - - - - - - - - e_StartBrowser - - - - - - - - - - - - e_ClickBook - - - - - - - - - - - - - - - e_AddBookToCart [num_of_books<=MAX_BOOKS] / num_of_books++; - - - - - - - - - - - - - - - - - e_ShoppingCart - - - - - - - - - - - - - - - e_ShoppingCart - - - - - - - - - - - - - - - - - e_ShoppingCart - - - - - - - - - - - - - - - - - e_SearchBook - - - - - - - - - - - - - - - - - e_SearchBook - - - - - - - - - - - - - - - - - e_SearchBook - - - - - - - - - - diff --git a/src/test/resources/graphml/org.graphwalker.EventDrivenModels.load2Models.2/a.graphml b/src/test/resources/graphml/org.graphwalker.EventDrivenModels.load2Models.2/a.graphml deleted file mode 100644 index 44cb481a..00000000 --- a/src/test/resources/graphml/org.graphwalker.EventDrivenModels.load2Models.2/a.graphml +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - A - - - - - - - - - - - - B - - - - - - - - - - - - C - - - - - - - - - - - - - - - - a - - - - - - - - - - - - b - - - - - - - - - - - - a - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - c - - - - - - - - - - - - - - - c - - - - - - - - - - - - - - - - a - - - - - - - - - diff --git a/src/test/resources/graphml/org.graphwalker.EventDrivenModels.load2Models.2/b.graphml b/src/test/resources/graphml/org.graphwalker.EventDrivenModels.load2Models.2/b.graphml deleted file mode 100644 index af6a6f09..00000000 --- a/src/test/resources/graphml/org.graphwalker.EventDrivenModels.load2Models.2/b.graphml +++ /dev/null @@ -1,278 +0,0 @@ - - - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - B - - - - - - - - - - - - D - - - - - - - - - - - - E - - - - - - - - - - - - Stop - - - - - - - - - - - - - - - d - - - - - - - - - - - - - - - e - - - - - - - - - - - - - - - - - - - d - - - - - - - - - - - - - - - - - d_2 - - - - - - - - - - - - - - - - d_4 - - - - - - - - - - - - - - - - d_3 - - - - - - - - - - - - - - - - - - - - - - - a_3 - - - - - - - - - - - - - - - - - a_2 - - - - - - - - - - - - - - - - - a_1 - - - - - - - - - - - - - - - - - c - - - - - - - - - - - - - - - c - - - - - - - - - - - - - - - c - - - - - - - - - diff --git a/src/test/resources/graphml/org.graphwalker.EventDrivenModels.switchModels.A.graphml b/src/test/resources/graphml/org.graphwalker.EventDrivenModels.switchModels.A.graphml deleted file mode 100644 index 3a11fc7c..00000000 --- a/src/test/resources/graphml/org.graphwalker.EventDrivenModels.switchModels.A.graphml +++ /dev/null @@ -1,276 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Start - - - - - - - - - - A - - - - - - - - - - A_1 - - - - - - - - - - A_2 - - - - - - - - - - A_3 - - - - - - - - - - A_4 - - - - - - - - - - A_5 - - - - - - - - - - A_6 - - - - - - - - - - - a - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/org.graphwalker.EventDrivenModels.switchModels.B.graphml b/src/test/resources/graphml/org.graphwalker.EventDrivenModels.switchModels.B.graphml deleted file mode 100644 index a395e1b1..00000000 --- a/src/test/resources/graphml/org.graphwalker.EventDrivenModels.switchModels.B.graphml +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Start - - - - - - - - - - B - - - - - - - - - - B_1 - - - - - - - - - - B_2 - - - - - - - - - - B_4 - - - - - - - - - - B_5 - - - - - - - - - - B_6 - - - - - - - - - - B_3 - - - - - - - - - - b - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/org.graphwalker.EventDrivenModels.switchModels.C.graphml b/src/test/resources/graphml/org.graphwalker.EventDrivenModels.switchModels.C.graphml deleted file mode 100644 index 5d71bb5d..00000000 --- a/src/test/resources/graphml/org.graphwalker.EventDrivenModels.switchModels.C.graphml +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Start - - - - - - - - - - C - - - - - - - - - - C_1 - - - - - - - - - - C_2 - - - - - - - - - - C_4 - - - - - - - - - - C_5 - - - - - - - - - - C_6 - - - - - - - - - - C_3 - - - - - - - - - - c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/permutations/simple.graphml b/src/test/resources/graphml/permutations/simple.graphml deleted file mode 100644 index 297ad91c..00000000 --- a/src/test/resources/graphml/permutations/simple.graphml +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - v1 - - - - - - - - - - - v2 - - - - - - - - - - - v3 - - - - - - - - - - - start - - - - - - - - - - - - - e1a - - - - - - - - - - - - - e1b - - - - - - - - - - - - - e2a - - - - - - - - - - - - - e2b - - - - - - - - - - - - - - e3a - - - - - - - - - diff --git a/src/test/resources/graphml/reqtags/execAction.graphml b/src/test/resources/graphml/reqtags/execAction.graphml deleted file mode 100644 index c6361a02..00000000 --- a/src/test/resources/graphml/reqtags/execAction.graphml +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - Start - - - - - - - - - - - - e_A - - - - - - - - - - - - e_B - - - - - - - - - - - - e_C - - - - - - - - - - - - e_a/String str="abc"; - - - - - - - - - - - - e_b - - - - - - - - - - - - e_c - - - - - - - - - - - - - - - - - e_a - - - - - - - - - - diff --git a/src/test/resources/graphml/test01/graph1.graphml b/src/test/resources/graphml/test01/graph1.graphml deleted file mode 100644 index 806e2899..00000000 --- a/src/test/resources/graphml/test01/graph1.graphml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - A - - - - - - - - - - - B - - - - - - - - - - - C - - - - - - - - - - - doA - - - - - - - - - - - - - - doB - - - - - - - - - - - - - - doC - - - - - - - - - - - - - - - - doA - - - - - - diff --git a/src/test/resources/graphml/test01/graph2.graphml b/src/test/resources/graphml/test01/graph2.graphml deleted file mode 100644 index 2341d4fd..00000000 --- a/src/test/resources/graphml/test01/graph2.graphml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - B - - - - - - - - - - - D - - - - - - - - - - - E - - - - - - - - - - - C - - - - - - - - - - - - - - - - - - - - - doD - - - - - - - - - - - doE - - - - - - - - - - - - - - - - doD - - - - - - - - - - - - - - - - doB - - - - - - - - - - - doC - - - - - - diff --git a/src/test/resources/graphml/test02/graph1.graphml b/src/test/resources/graphml/test02/graph1.graphml deleted file mode 100644 index 2cc8751d..00000000 --- a/src/test/resources/graphml/test02/graph1.graphml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - A - - - - - - - - - - - B - - - - - - - - - - - C - - - - - - - - - - - C NO_MERGE - - - - - - - - - - - doA - - - - - - - - - - - doB - - - - - - - - - - - - - - doC - - - - - - - - - - - - - - - - doA - - - - - - - - - - - - - - doCSpecial - - - - - - - - - - - - - - - - doA - - - - - - diff --git a/src/test/resources/graphml/test02/graph2.graphml b/src/test/resources/graphml/test02/graph2.graphml deleted file mode 100644 index 2341d4fd..00000000 --- a/src/test/resources/graphml/test02/graph2.graphml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - B - - - - - - - - - - - D - - - - - - - - - - - E - - - - - - - - - - - C - - - - - - - - - - - - - - - - - - - - - doD - - - - - - - - - - - doE - - - - - - - - - - - - - - - - doD - - - - - - - - - - - - - - - - doB - - - - - - - - - - - doC - - - - - - diff --git a/src/test/resources/graphml/test03/Graph001.graphml b/src/test/resources/graphml/test03/Graph001.graphml deleted file mode 100644 index a510e1e2..00000000 --- a/src/test/resources/graphml/test03/Graph001.graphml +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph001 - - - - - - - - - - - v_Node059 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph163 MERGE - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph002.graphml b/src/test/resources/graphml/test03/Graph002.graphml deleted file mode 100644 index 9f69838c..00000000 --- a/src/test/resources/graphml/test03/Graph002.graphml +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph002 - - - - - - - - - - - v_Node059 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph163 MERGE - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph003.graphml b/src/test/resources/graphml/test03/Graph003.graphml deleted file mode 100644 index 8e8a7af4..00000000 --- a/src/test/resources/graphml/test03/Graph003.graphml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph003 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph004.graphml b/src/test/resources/graphml/test03/Graph004.graphml deleted file mode 100644 index c0f1f4e4..00000000 --- a/src/test/resources/graphml/test03/Graph004.graphml +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph004 - - - - - - - - - - - v_Graph070 NO_MERGE - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge164 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge163 BLOCKED Felrapport 1995 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph005.graphml b/src/test/resources/graphml/test03/Graph005.graphml deleted file mode 100644 index 2e078ca6..00000000 --- a/src/test/resources/graphml/test03/Graph005.graphml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph005 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph006.graphml b/src/test/resources/graphml/test03/Graph006.graphml deleted file mode 100644 index 703d11a8..00000000 --- a/src/test/resources/graphml/test03/Graph006.graphml +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph006 - - - - - - - - - - - v_Graph050 NO_MERGE - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge095 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge096 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph007.graphml b/src/test/resources/graphml/test03/Graph007.graphml deleted file mode 100644 index 14505332..00000000 --- a/src/test/resources/graphml/test03/Graph007.graphml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph007 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph008.graphml b/src/test/resources/graphml/test03/Graph008.graphml deleted file mode 100644 index fda1c4c0..00000000 --- a/src/test/resources/graphml/test03/Graph008.graphml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph008 - - - - - - - - - - - v_Graph052 NO_MERGE - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge090 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph009.graphml b/src/test/resources/graphml/test03/Graph009.graphml deleted file mode 100644 index 847b93ac..00000000 --- a/src/test/resources/graphml/test03/Graph009.graphml +++ /dev/null @@ -1,252 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph009 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node053 BLOCKED Felrapport 2020 - - - - - - - - - - - v_Node013 BLOCKED Felrapport 2020 - - - - - - - - - - - v_Node012 BLOCKED Felrapport 2020 - - - - - - - - - - - v_Graph165 MERGE BLOCKED Felrapport 2020 - - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge062 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - - e_Edge050 BLOCKED Felrapport 2020 - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph010.graphml b/src/test/resources/graphml/test03/Graph010.graphml deleted file mode 100644 index baf8d093..00000000 --- a/src/test/resources/graphml/test03/Graph010.graphml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph010 - - - - - - - - - - - v_Node017 - - - - - - - - - - - v_Node018 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node018 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge162 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge161 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph011.graphml b/src/test/resources/graphml/test03/Graph011.graphml deleted file mode 100644 index 7b5db6f5..00000000 --- a/src/test/resources/graphml/test03/Graph011.graphml +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph011 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node025 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - - - e_Edge105 - - - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - - - e_Edge079 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph012.graphml b/src/test/resources/graphml/test03/Graph012.graphml deleted file mode 100644 index b67d96b8..00000000 --- a/src/test/resources/graphml/test03/Graph012.graphml +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph012 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node025 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - - - e_Edge105 - - - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - - - e_Edge079 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph013.graphml b/src/test/resources/graphml/test03/Graph013.graphml deleted file mode 100644 index 5f58cfa9..00000000 --- a/src/test/resources/graphml/test03/Graph013.graphml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph013 - - - - - - - - - - - v_Node058 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Graph013 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph014.graphml b/src/test/resources/graphml/test03/Graph014.graphml deleted file mode 100644 index 70dc6885..00000000 --- a/src/test/resources/graphml/test03/Graph014.graphml +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph014 - - - - - - - - - - - v_Node058 - - - - - - - - - - - v_Graph015 NO_MERGE - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node052 BLOCKED Felrapport 2011 - - - - - - - - - - - v_Node054 BLOCKED Felrapport 2011 - - - - - - - - - - - v_Node046 BLOCKED Felrapport 2011 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - - e_Graph014 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - - - e_Graph014 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - - - e_Graph014 - - - - - - - - - - - - - - - - e_Graph014 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Graph014 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph015.graphml b/src/test/resources/graphml/test03/Graph015.graphml deleted file mode 100644 index 2ca75d6a..00000000 --- a/src/test/resources/graphml/test03/Graph015.graphml +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph015 - - - - - - - - - - - v_Node058 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node052 - - - - - - - - - - - v_Node046 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Graph015 - - - - - - - - - - - e_Graph015 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph016.graphml b/src/test/resources/graphml/test03/Graph016.graphml deleted file mode 100644 index 0390c2ba..00000000 --- a/src/test/resources/graphml/test03/Graph016.graphml +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph016 - - - - - - - - - - - v_Node058 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node052 - - - - - - - - - - - v_Node046 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Graph016 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Graph016 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph017.graphml b/src/test/resources/graphml/test03/Graph017.graphml deleted file mode 100644 index 1c5763de..00000000 --- a/src/test/resources/graphml/test03/Graph017.graphml +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph017 - - - - - - - - - - - v_Node058 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node052 - - - - - - - - - - - v_Node046 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph015 MERGE - - - - - - - - - - - - - - - - - - - - - e_Edge158 - - - - - - - - - - - - - - e_Edge159 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge158 - - - - - - - - - - - - - - e_Edge158 - - - - - - - - - - - - - - - e_Edge156 - - - - - - - - - - - - - - e_Edge160 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Graph015 - - - - - - - - - - - e_Graph017 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph018.graphml b/src/test/resources/graphml/test03/Graph018.graphml deleted file mode 100644 index 8f3dfb19..00000000 --- a/src/test/resources/graphml/test03/Graph018.graphml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph018 - - - - - - - - - - - v_Node052 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge158 - - - - - - - - - - - - - - e_Edge157 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Graph018 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph019.graphml b/src/test/resources/graphml/test03/Graph019.graphml deleted file mode 100644 index e858b196..00000000 --- a/src/test/resources/graphml/test03/Graph019.graphml +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph019 - - - - - - - - - - - v_Node052 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Graph020 NO_MERGE - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Graph019 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - - e_Graph019 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph020.graphml b/src/test/resources/graphml/test03/Graph020.graphml deleted file mode 100644 index 63bf2519..00000000 --- a/src/test/resources/graphml/test03/Graph020.graphml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph020 - - - - - - - - - - - v_Node052 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge158 - - - - - - - - - - - - - - e_Edge159 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - e_Edge156 - - - - - - - - - - - e_Graph020 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph021.graphml b/src/test/resources/graphml/test03/Graph021.graphml deleted file mode 100644 index fb90a303..00000000 --- a/src/test/resources/graphml/test03/Graph021.graphml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph021 - - - - - - - - - - - v_Node052 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - e_Graph021 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph022.graphml b/src/test/resources/graphml/test03/Graph022.graphml deleted file mode 100644 index 71a3798e..00000000 --- a/src/test/resources/graphml/test03/Graph022.graphml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph022 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - e_Edge157 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph023.graphml b/src/test/resources/graphml/test03/Graph023.graphml deleted file mode 100644 index a6e8ffd3..00000000 --- a/src/test/resources/graphml/test03/Graph023.graphml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph023 - - - - - - - - - - - v_Graph054 NO_MERGE - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge086 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph024.graphml b/src/test/resources/graphml/test03/Graph024.graphml deleted file mode 100644 index 7c137d0b..00000000 --- a/src/test/resources/graphml/test03/Graph024.graphml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph024 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - e_Edge157 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph025.graphml b/src/test/resources/graphml/test03/Graph025.graphml deleted file mode 100644 index 07b18c93..00000000 --- a/src/test/resources/graphml/test03/Graph025.graphml +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph025 - - - - - - - - - - - v_Graph112 NO_MERGE - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph026.graphml b/src/test/resources/graphml/test03/Graph026.graphml deleted file mode 100644 index 923038cd..00000000 --- a/src/test/resources/graphml/test03/Graph026.graphml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph026 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node051 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Graph026 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph027.graphml b/src/test/resources/graphml/test03/Graph027.graphml deleted file mode 100644 index 0dd60639..00000000 --- a/src/test/resources/graphml/test03/Graph027.graphml +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph027 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Graph029 NO_MERGE - - - - - - - - - - - v_Graph070 NO_MERGE - - - - - - - - - - - v_Node051 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph027 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Graph027 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph028.graphml b/src/test/resources/graphml/test03/Graph028.graphml deleted file mode 100644 index 9fa007ee..00000000 --- a/src/test/resources/graphml/test03/Graph028.graphml +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph028 - - - - - - - - - - - v_Graph070 NO_MERGE - - - - - - - - - - - v_Node051 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge100 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - - e_Edge150 - - - - - - - - - - - - - - - - e_Edge149 BLOCKED Felrapport XXXX - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - e_Graph026 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph029.graphml b/src/test/resources/graphml/test03/Graph029.graphml deleted file mode 100644 index 530f772b..00000000 --- a/src/test/resources/graphml/test03/Graph029.graphml +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph029 - - - - - - - - - - - v_Graph070 NO_MERGE - - - - - - - - - - - v_Node051 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge098 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - - e_Edge147 - - - - - - - - - - - - - - e_Edge146 BLOCKED - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - e_Graph026 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph030.graphml b/src/test/resources/graphml/test03/Graph030.graphml deleted file mode 100644 index 7776845a..00000000 --- a/src/test/resources/graphml/test03/Graph030.graphml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph030 - - - - - - - - - - - v_Node055 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge155 - - - - - - - - - - - - - - e_Edge154 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph031.graphml b/src/test/resources/graphml/test03/Graph031.graphml deleted file mode 100644 index 47169bff..00000000 --- a/src/test/resources/graphml/test03/Graph031.graphml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph031 - - - - - - - - - - - v_Node055 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge153 - - - - - - - - - - - - - - e_Edge128 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph032.graphml b/src/test/resources/graphml/test03/Graph032.graphml deleted file mode 100644 index 27b0399a..00000000 --- a/src/test/resources/graphml/test03/Graph032.graphml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph032 - - - - - - - - - - - v_Node050 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Graph032 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph033.graphml b/src/test/resources/graphml/test03/Graph033.graphml deleted file mode 100644 index 850afa0e..00000000 --- a/src/test/resources/graphml/test03/Graph033.graphml +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph033 - - - - - - - - - - - v_Node050 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Graph034 NO_MERGE - - - - - - - - - - - v_Node049 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph033 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Graph033 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph034.graphml b/src/test/resources/graphml/test03/Graph034.graphml deleted file mode 100644 index c0dc2569..00000000 --- a/src/test/resources/graphml/test03/Graph034.graphml +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph034 - - - - - - - - - - - v_Node050 - - - - - - - - - - - v_Node049 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge077 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Graph034 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph035.graphml b/src/test/resources/graphml/test03/Graph035.graphml deleted file mode 100644 index 05712577..00000000 --- a/src/test/resources/graphml/test03/Graph035.graphml +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph035 - - - - - - - - - - - v_Node050 - - - - - - - - - - - v_Node049 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - e_Edge076 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Graph035 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph036.graphml b/src/test/resources/graphml/test03/Graph036.graphml deleted file mode 100644 index 6cb2f91a..00000000 --- a/src/test/resources/graphml/test03/Graph036.graphml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph036 - - - - - - - - - - - v_Node048 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Graph036 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph037.graphml b/src/test/resources/graphml/test03/Graph037.graphml deleted file mode 100644 index 80393958..00000000 --- a/src/test/resources/graphml/test03/Graph037.graphml +++ /dev/null @@ -1,265 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph037 - - - - - - - - - - - v_Node048 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node057 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph037 - - - - - - - - - - - - - - e_Edge148 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Graph037 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph038.graphml b/src/test/resources/graphml/test03/Graph038.graphml deleted file mode 100644 index 5f52abd4..00000000 --- a/src/test/resources/graphml/test03/Graph038.graphml +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph038 - - - - - - - - - - - v_Node048 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge152 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Graph038 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph039.graphml b/src/test/resources/graphml/test03/Graph039.graphml deleted file mode 100644 index edaf17b6..00000000 --- a/src/test/resources/graphml/test03/Graph039.graphml +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph039 - - - - - - - - - - - v_Node048 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - e_Edge151 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Graph039 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph040.graphml b/src/test/resources/graphml/test03/Graph040.graphml deleted file mode 100644 index ca424ada..00000000 --- a/src/test/resources/graphml/test03/Graph040.graphml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph040 - - - - - - - - - - - v_Node019 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Graph040 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph041.graphml b/src/test/resources/graphml/test03/Graph041.graphml deleted file mode 100644 index 68032761..00000000 --- a/src/test/resources/graphml/test03/Graph041.graphml +++ /dev/null @@ -1,309 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph041 - - - - - - - - - - - v_Node019 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Graph042 NO_MERGE - - - - - - - - - - - v_Node056 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph041 - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge071 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Graph041 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph042.graphml b/src/test/resources/graphml/test03/Graph042.graphml deleted file mode 100644 index c1e39d69..00000000 --- a/src/test/resources/graphml/test03/Graph042.graphml +++ /dev/null @@ -1,242 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph042 - - - - - - - - - - - v_Node019 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge067 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Graph042 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph043.graphml b/src/test/resources/graphml/test03/Graph043.graphml deleted file mode 100644 index fd3c577e..00000000 --- a/src/test/resources/graphml/test03/Graph043.graphml +++ /dev/null @@ -1,242 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph043 - - - - - - - - - - - v_Node019 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - e_Edge062 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Graph043 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph044.graphml b/src/test/resources/graphml/test03/Graph044.graphml deleted file mode 100644 index 80aa1c48..00000000 --- a/src/test/resources/graphml/test03/Graph044.graphml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph044 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node018 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - e_Edge061 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - - e_Edge145 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph045.graphml b/src/test/resources/graphml/test03/Graph045.graphml deleted file mode 100644 index d8bf8ebd..00000000 --- a/src/test/resources/graphml/test03/Graph045.graphml +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph045 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node060 - - - - - - - - - - - v_Node044 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node025 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph170 MERGE - - - - - - - - - - - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge100 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - - - - - - e_Edge102 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge101 - - - - - - - - - - - - - - e_Edge082 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph046.graphml b/src/test/resources/graphml/test03/Graph046.graphml deleted file mode 100644 index d884d574..00000000 --- a/src/test/resources/graphml/test03/Graph046.graphml +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph046 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node060 - - - - - - - - - - - v_Node044 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node025 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph170 MERGE - - - - - - - - - - - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge098 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - - - e_Edge099 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge097 - - - - - - - - - - - - - - e_Edge079 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph047.graphml b/src/test/resources/graphml/test03/Graph047.graphml deleted file mode 100644 index 7ffb8ce8..00000000 --- a/src/test/resources/graphml/test03/Graph047.graphml +++ /dev/null @@ -1,425 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph047 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node060 - - - - - - - - - - - v_Node044 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node025 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph170 MERGE - - - - - - - - - - - v_Graph030 - - - - - - - - - - - v_Graph031 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge098 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - e_Edge099 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - - - e_Edge097 - - - - - - - - - - - - - - e_Edge079 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Graph030 - - - - - - - - - - - - - - e_Graph031 - - - - - - - - - - - - - - - - e_Graph047 - - - - - - - - - - - - - - - - e_Graph047 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph050.graphml b/src/test/resources/graphml/test03/Graph050.graphml deleted file mode 100644 index aae0f40e..00000000 --- a/src/test/resources/graphml/test03/Graph050.graphml +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph050 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node041 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node025 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph175 MERGE - - - - - - - - - - - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - - - - e_Edge094 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge082 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - - e_Edge094 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph051.graphml b/src/test/resources/graphml/test03/Graph051.graphml deleted file mode 100644 index 5b32ef09..00000000 --- a/src/test/resources/graphml/test03/Graph051.graphml +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph051 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node041 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node025 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph175 MERGE - - - - - - - - - - - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - e_Edge092 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge079 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - - e_Edge091 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph052.graphml b/src/test/resources/graphml/test03/Graph052.graphml deleted file mode 100644 index 1d29f778..00000000 --- a/src/test/resources/graphml/test03/Graph052.graphml +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph052 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node047 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node025 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph168 MERGE - - - - - - - - - - - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - - - - e_Edge089 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge082 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph053.graphml b/src/test/resources/graphml/test03/Graph053.graphml deleted file mode 100644 index b674bbbb..00000000 --- a/src/test/resources/graphml/test03/Graph053.graphml +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph053 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node047 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node025 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph168 MERGE - - - - - - - - - - - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - e_Edge088 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge079 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph054.graphml b/src/test/resources/graphml/test03/Graph054.graphml deleted file mode 100644 index ee37ee7c..00000000 --- a/src/test/resources/graphml/test03/Graph054.graphml +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph054 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node046 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node025 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph167 MERGE - - - - - - - - - - - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - e_Edge081 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge079 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph055.graphml b/src/test/resources/graphml/test03/Graph055.graphml deleted file mode 100644 index 96e052f7..00000000 --- a/src/test/resources/graphml/test03/Graph055.graphml +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph055 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node046 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node025 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Graph167 MERGE - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - - - - e_Edge084 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge082 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph070.graphml b/src/test/resources/graphml/test03/Graph070.graphml deleted file mode 100644 index 8d0d7b41..00000000 --- a/src/test/resources/graphml/test03/Graph070.graphml +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph070 - - - - - - - - - - - v_Node043 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - - - - e_Edge150 - - - - - - - - - - - - - - e_Edge149 BLOCKED - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph071.graphml b/src/test/resources/graphml/test03/Graph071.graphml deleted file mode 100644 index 1d069ac7..00000000 --- a/src/test/resources/graphml/test03/Graph071.graphml +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph071 - - - - - - - - - - - v_Node043 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - e_Edge147 - - - - - - - - - - - - - - e_Edge146 BLOCKED - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph072.graphml b/src/test/resources/graphml/test03/Graph072.graphml deleted file mode 100644 index eafe942d..00000000 --- a/src/test/resources/graphml/test03/Graph072.graphml +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph072 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - - - e_Edge147 - - - - - - - - - - - - - - e_Edge146 BLOCKED - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph073.graphml b/src/test/resources/graphml/test03/Graph073.graphml deleted file mode 100644 index 19b28bbf..00000000 --- a/src/test/resources/graphml/test03/Graph073.graphml +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph073 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - - - e_Edge147 - - - - - - - - - - - - - - e_Edge146 BLOCKED - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph074.graphml b/src/test/resources/graphml/test03/Graph074.graphml deleted file mode 100644 index 1e55e761..00000000 --- a/src/test/resources/graphml/test03/Graph074.graphml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph074 - - - - - - - - - - - v_Node045 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Graph074 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph075.graphml b/src/test/resources/graphml/test03/Graph075.graphml deleted file mode 100644 index 74d93599..00000000 --- a/src/test/resources/graphml/test03/Graph075.graphml +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph075 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node045 - - - - - - - - - - - v_Graph076 NO_MERGE - - - - - - - - - - - v_Graph001 NO_MERGE - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph075 - - - - - - - - - - - - - - e_Edge044KoppladAdress - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Graph075 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph076.graphml b/src/test/resources/graphml/test03/Graph076.graphml deleted file mode 100644 index 02aae100..00000000 --- a/src/test/resources/graphml/test03/Graph076.graphml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph076 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node045 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - e_Graph076 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph077.graphml b/src/test/resources/graphml/test03/Graph077.graphml deleted file mode 100644 index c4087921..00000000 --- a/src/test/resources/graphml/test03/Graph077.graphml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph077 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node045 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - e_Graph077 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph078.graphml b/src/test/resources/graphml/test03/Graph078.graphml deleted file mode 100644 index af76409f..00000000 --- a/src/test/resources/graphml/test03/Graph078.graphml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph078 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node042 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Graph078 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph079.graphml b/src/test/resources/graphml/test03/Graph079.graphml deleted file mode 100644 index 699f2cc8..00000000 --- a/src/test/resources/graphml/test03/Graph079.graphml +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph079 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node042 - - - - - - - - - - - v_Graph080 NO_MERGE - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph079 - - - - - - - - - - - e_Graph079 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph080.graphml b/src/test/resources/graphml/test03/Graph080.graphml deleted file mode 100644 index 29f4d827..00000000 --- a/src/test/resources/graphml/test03/Graph080.graphml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph080 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node042 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - e_Graph080 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph081.graphml b/src/test/resources/graphml/test03/Graph081.graphml deleted file mode 100644 index a22badaf..00000000 --- a/src/test/resources/graphml/test03/Graph081.graphml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph081 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node042 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - e_Graph081 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph082.graphml b/src/test/resources/graphml/test03/Graph082.graphml deleted file mode 100644 index 4baa3560..00000000 --- a/src/test/resources/graphml/test03/Graph082.graphml +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph082 - - - - - - - - - - - v_Node044 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node041 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph083.graphml b/src/test/resources/graphml/test03/Graph083.graphml deleted file mode 100644 index b44391bb..00000000 --- a/src/test/resources/graphml/test03/Graph083.graphml +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph083 - - - - - - - - - - - v_Node017 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph084.graphml b/src/test/resources/graphml/test03/Graph084.graphml deleted file mode 100644 index 9bb04a17..00000000 --- a/src/test/resources/graphml/test03/Graph084.graphml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph084 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph085.graphml b/src/test/resources/graphml/test03/Graph085.graphml deleted file mode 100644 index 32cb27ca..00000000 --- a/src/test/resources/graphml/test03/Graph085.graphml +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph085 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Graph112 NO_MERGE - - - - - - - - - - - v_Node006 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge145 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph086.graphml b/src/test/resources/graphml/test03/Graph086.graphml deleted file mode 100644 index 8a63c013..00000000 --- a/src/test/resources/graphml/test03/Graph086.graphml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph086 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph087.graphml b/src/test/resources/graphml/test03/Graph087.graphml deleted file mode 100644 index a9e7abe2..00000000 --- a/src/test/resources/graphml/test03/Graph087.graphml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph087 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Graph148 NO_MERGE - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge145 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph088.graphml b/src/test/resources/graphml/test03/Graph088.graphml deleted file mode 100644 index e1e94db9..00000000 --- a/src/test/resources/graphml/test03/Graph088.graphml +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph088 - - - - - - - - - - - v_Node040 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph172 MERGE - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph089.graphml b/src/test/resources/graphml/test03/Graph089.graphml deleted file mode 100644 index 8d05d6d2..00000000 --- a/src/test/resources/graphml/test03/Graph089.graphml +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph089 - - - - - - - - - - - v_Node040 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph172 MERGE - - - - - - - - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph092.graphml b/src/test/resources/graphml/test03/Graph092.graphml deleted file mode 100644 index 4a38037b..00000000 --- a/src/test/resources/graphml/test03/Graph092.graphml +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph092 - - - - - - - - - - - v_Node039 BLOCKED - - - - - - - - - - - v_Node013 BLOCKED - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 BLOCKED - - - - - - - - - - - v_Graph171 MERGE BLOCKED - - - - - - - - - - - - - - - - - - - - - e_Edge052 BLOCKED Felrapport 2023 - - - - - - - - - - - - - - e_Edge049 BLOCKED Felrapport 2023 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge050 BLOCKED Felrapport 2023 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph093.graphml b/src/test/resources/graphml/test03/Graph093.graphml deleted file mode 100644 index 0f4c4144..00000000 --- a/src/test/resources/graphml/test03/Graph093.graphml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph093 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Graph148 NO_MERGE - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge145 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph094.graphml b/src/test/resources/graphml/test03/Graph094.graphml deleted file mode 100644 index 26386ec6..00000000 --- a/src/test/resources/graphml/test03/Graph094.graphml +++ /dev/null @@ -1,189 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph094 - - - - - - - - - - - v_Node038 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph173 MERGE - - - - - - - - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph095.graphml b/src/test/resources/graphml/test03/Graph095.graphml deleted file mode 100644 index d492572c..00000000 --- a/src/test/resources/graphml/test03/Graph095.graphml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph095 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge144 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph096.graphml b/src/test/resources/graphml/test03/Graph096.graphml deleted file mode 100644 index a2116dd3..00000000 --- a/src/test/resources/graphml/test03/Graph096.graphml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph096 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node006 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge143 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph097.graphml b/src/test/resources/graphml/test03/Graph097.graphml deleted file mode 100644 index 83d530cc..00000000 --- a/src/test/resources/graphml/test03/Graph097.graphml +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph097 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node035 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node018 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - - e_Edge142 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge141 - - - - - - - - - - - - - - - - e_Edge140 - - - - - - - - - - - - - - e_Edge139 - - - - - - - - - - - - - - e_Edge138 - - - - - - - - - - - - - - - - e_Edge108 - - - - - - - - - - - e_Edge119 - - - - - - - - - - - - - - e_Edge078 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph098.graphml b/src/test/resources/graphml/test03/Graph098.graphml deleted file mode 100644 index 0bb1737f..00000000 --- a/src/test/resources/graphml/test03/Graph098.graphml +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph098 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node035 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node018 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - - e_Edge137 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge136 - - - - - - - - - - - - - - - - e_Edge135 - - - - - - - - - - - - - - e_Edge134 - - - - - - - - - - - - - - e_Edge133 - - - - - - - - - - - - - - - - e_Edge108 - - - - - - - - - - - e_Edge119 - - - - - - - - - - - - - - e_Edge087 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph099.graphml b/src/test/resources/graphml/test03/Graph099.graphml deleted file mode 100644 index b155816e..00000000 --- a/src/test/resources/graphml/test03/Graph099.graphml +++ /dev/null @@ -1,376 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph099 - - - - - - - - - - - v_Graph140 NO_MERGE - - - - - - - - - - - v_Graph094 NO_MERGE - - - - - - - - - - - v_Node023 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node022 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node019 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - - - e_Graph099 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Graph099 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Graph099 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph099 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph100.graphml b/src/test/resources/graphml/test03/Graph100.graphml deleted file mode 100644 index 1afb202a..00000000 --- a/src/test/resources/graphml/test03/Graph100.graphml +++ /dev/null @@ -1,517 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph100 - - - - - - - - - - - v_Graph070 NO_MERGE - - - - - - - - - - - v_Node037 - - - - - - - - - - - v_Node033 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node029 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node015 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node026 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node028 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node024 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge132 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge131 - - - - - - - - - - - - - - e_Edge130 - - - - - - - - - - - - - - e_Edge129 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge128 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Edge126 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge127 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Graph100 - - - - - - - - - - - - - - e_Edge125 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge124 - - - - - - - - - - - - - - e_Graph100 - - - - - - - - - - - - - - e_Graph100 - - - - - - - - - - - - - - e_Graph100 - - - - - - - - - - - - - - e_Graph100 - - - - - - - - - - - - - - e_Graph100 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph101.graphml b/src/test/resources/graphml/test03/Graph101.graphml deleted file mode 100644 index 089ea72d..00000000 --- a/src/test/resources/graphml/test03/Graph101.graphml +++ /dev/null @@ -1,457 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph101 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node035 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node034 - - - - - - - - - - - v_Node025 - - - - - - - - - - - v_Graph097 NO_MERGE - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge119 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - e_Edge123 - - - - - - - - - - - - - - - - e_Edge117 - - - - - - - - - - - - - - - - e_Edge116 - - - - - - - - - - - - - - - - e_Edge115 - - - - - - - - - - - - - - - - e_Edge114 - - - - - - - - - - - - - - - - e_Edge113 - - - - - - - - - - - - - - - - e_Edge112 - - - - - - - - - - - - - - e_Edge111 - - - - - - - - - - - - - - e_Edge110 - - - - - - - - - - - - - - - - e_Edge122 - - - - - - - - - - - - - - e_Edge082 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge108 - - - - - - - - - - - - - - - - e_Graph101 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph102.graphml b/src/test/resources/graphml/test03/Graph102.graphml deleted file mode 100644 index 69bd178f..00000000 --- a/src/test/resources/graphml/test03/Graph102.graphml +++ /dev/null @@ -1,457 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph102 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node035 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node034 - - - - - - - - - - - v_Node025 - - - - - - - - - - - v_Graph097 NO_MERGE - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - e_Edge119 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - e_Edge118 - - - - - - - - - - - - - - - - e_Edge117 - - - - - - - - - - - - - - - - e_Edge116 - - - - - - - - - - - - - - - - e_Edge115 - - - - - - - - - - - - - - - - e_Edge114 - - - - - - - - - - - - - - - - e_Edge113 - - - - - - - - - - - - - - - - e_Edge112 - - - - - - - - - - - - - - e_Edge111 - - - - - - - - - - - - - - e_Edge110 - - - - - - - - - - - - - - - - e_Edge109 - - - - - - - - - - - - - - e_Edge079 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge108 - - - - - - - - - - - - - - - - e_Graph102 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph103.graphml b/src/test/resources/graphml/test03/Graph103.graphml deleted file mode 100644 index eeb415ec..00000000 --- a/src/test/resources/graphml/test03/Graph103.graphml +++ /dev/null @@ -1,457 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph103 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node035 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node034 - - - - - - - - - - - v_Node025 - - - - - - - - - - - v_Graph097 NO_MERGE - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - e_Edge119 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - e_Edge118 - - - - - - - - - - - - - - - - e_Edge117 - - - - - - - - - - - - - - - - e_Edge116 - - - - - - - - - - - - - - - - e_Edge115 - - - - - - - - - - - - - - - - e_Edge114 - - - - - - - - - - - - - - - - e_Edge113 - - - - - - - - - - - - - - - - e_Edge112 - - - - - - - - - - - - - - e_Edge111 - - - - - - - - - - - - - - e_Edge110 - - - - - - - - - - - - - - - - e_Edge109 - - - - - - - - - - - - - - e_Edge079 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge108 - - - - - - - - - - - - - - - - e_Graph103 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph104.graphml b/src/test/resources/graphml/test03/Graph104.graphml deleted file mode 100644 index 3a12c76e..00000000 --- a/src/test/resources/graphml/test03/Graph104.graphml +++ /dev/null @@ -1,307 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph104 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node029 - - - - - - - - - - - v_Node028 - - - - - - - - - - - v_Node027 - - - - - - - - - - - v_Node026 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node018 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Graph104 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge078 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Graph104 - - - - - - - - - - - - - - e_Graph104 - - - - - - - - - - - - - - e_Graph104 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph105.graphml b/src/test/resources/graphml/test03/Graph105.graphml deleted file mode 100644 index e317fdd8..00000000 --- a/src/test/resources/graphml/test03/Graph105.graphml +++ /dev/null @@ -1,477 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph105 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node029 - - - - - - - - - - - v_Node028 - - - - - - - - - - - v_Node027 - - - - - - - - - - - v_Node026 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Graph118 NO_MERGE - - - - - - - - - - - v_Graph011 NO_MERGE - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node016 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Graph105 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph105 - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Graph105 - - - - - - - - - - - - - - e_Graph105 - - - - - - - - - - - - - - e_Graph105 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph106.graphml b/src/test/resources/graphml/test03/Graph106.graphml deleted file mode 100644 index f81460de..00000000 --- a/src/test/resources/graphml/test03/Graph106.graphml +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph106 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node032 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph106 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph107.graphml b/src/test/resources/graphml/test03/Graph107.graphml deleted file mode 100644 index 5617499f..00000000 --- a/src/test/resources/graphml/test03/Graph107.graphml +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph107 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node032 - - - - - - - - - - - v_Node026 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Graph108 NO_MERGE - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node033 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Graph107 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph107 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Graph107 - - - - - - - - - - - - - - e_Graph107 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph108.graphml b/src/test/resources/graphml/test03/Graph108.graphml deleted file mode 100644 index eb273a04..00000000 --- a/src/test/resources/graphml/test03/Graph108.graphml +++ /dev/null @@ -1,366 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph108 - - - - - - - - - - - v_Node032 - - - - - - - - - - - v_Node026 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node033 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node036 - - - - - - - - - - - v_Node013 - - - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Graph108 - - - - - - - - - - - - - - e_Graph108 - - - - - - - - - - - - - - e_Graph108 - - - - - - - - - - - - - - e_Graph108 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph109.graphml b/src/test/resources/graphml/test03/Graph109.graphml deleted file mode 100644 index 213d5f81..00000000 --- a/src/test/resources/graphml/test03/Graph109.graphml +++ /dev/null @@ -1,366 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph109 - - - - - - - - - - - v_Node032 - - - - - - - - - - - v_Node026 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node033 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node036 - - - - - - - - - - - v_Node013 - - - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - e_Graph108 - - - - - - - - - - - - - - e_Graph109 - - - - - - - - - - - - - - e_Graph109 - - - - - - - - - - - - - - e_Graph109 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph110.graphml b/src/test/resources/graphml/test03/Graph110.graphml deleted file mode 100644 index b0eafcf0..00000000 --- a/src/test/resources/graphml/test03/Graph110.graphml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph110 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node033 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Graph110 - - - - - - - - - - - - - - e_Edge058 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph111.graphml b/src/test/resources/graphml/test03/Graph111.graphml deleted file mode 100644 index e254bb70..00000000 --- a/src/test/resources/graphml/test03/Graph111.graphml +++ /dev/null @@ -1,267 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph111 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node033 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Graph112 NO_MERGE - - - - - - - - - - - v_Node031 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Graph111 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph111 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - e_Graph111 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph112.graphml b/src/test/resources/graphml/test03/Graph112.graphml deleted file mode 100644 index 0189a8b2..00000000 --- a/src/test/resources/graphml/test03/Graph112.graphml +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph112 - - - - - - - - - - - v_Node033 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node031 - - - - - - - - - - - - - - - - - - - - - - - - - e_Graph112 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Graph112 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph113.graphml b/src/test/resources/graphml/test03/Graph113.graphml deleted file mode 100644 index 239b889d..00000000 --- a/src/test/resources/graphml/test03/Graph113.graphml +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph113 - - - - - - - - - - - v_Node033 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node031 - - - - - - - - - - - - - - - - - - - - - - - - - e_Graph113 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - e_Graph113 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph114.graphml b/src/test/resources/graphml/test03/Graph114.graphml deleted file mode 100644 index b94413a9..00000000 --- a/src/test/resources/graphml/test03/Graph114.graphml +++ /dev/null @@ -1,450 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph114 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node029 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node026 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node028 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node024 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node027 - - - - - - - - - - - v_Node018 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - e_Graph114 - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - - - - e_Edge078 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph115.graphml b/src/test/resources/graphml/test03/Graph115.graphml deleted file mode 100644 index 73c0a382..00000000 --- a/src/test/resources/graphml/test03/Graph115.graphml +++ /dev/null @@ -1,576 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph115 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node029 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node026 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node028 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node024 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node027 - - - - - - - - - - - v_Node018 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node030 - - - - - - - - - - - v_Node017 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Graph115 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - e_Graph115 - - - - - - - - - - - - - - e_Graph115 - - - - - - - - - - - e_Graph115 - - - - - - - - - - - - - - e_Graph115 - - - - - - - - - - - - - - e_Edge061 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph115 - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph116.graphml b/src/test/resources/graphml/test03/Graph116.graphml deleted file mode 100644 index b86d51d4..00000000 --- a/src/test/resources/graphml/test03/Graph116.graphml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph116 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph117.graphml b/src/test/resources/graphml/test03/Graph117.graphml deleted file mode 100644 index 30ad1882..00000000 --- a/src/test/resources/graphml/test03/Graph117.graphml +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph117 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Graph118 NO_MERGE - - - - - - - - - - - v_Node017 - - - - - - - - - - - v_Node011 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph117 - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge106 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph118.graphml b/src/test/resources/graphml/test03/Graph118.graphml deleted file mode 100644 index 00add318..00000000 --- a/src/test/resources/graphml/test03/Graph118.graphml +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph118 - - - - - - - - - - - v_Node025 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge082 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge107 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - - e_Edge057 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph119.graphml b/src/test/resources/graphml/test03/Graph119.graphml deleted file mode 100644 index d71d810d..00000000 --- a/src/test/resources/graphml/test03/Graph119.graphml +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph119 - - - - - - - - - - - v_Node025 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge079 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge105 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph120.graphml b/src/test/resources/graphml/test03/Graph120.graphml deleted file mode 100644 index 44e34d6f..00000000 --- a/src/test/resources/graphml/test03/Graph120.graphml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph120 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node029 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node018 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph120 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Edge078 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph121.graphml b/src/test/resources/graphml/test03/Graph121.graphml deleted file mode 100644 index 652bd00a..00000000 --- a/src/test/resources/graphml/test03/Graph121.graphml +++ /dev/null @@ -1,428 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph121 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Graph122 NO_MERGE - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node029 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph045 NO_MERGE - - - - - - - - - - - v_Node018 - - - - - - - - - - - v_Node005 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph121 - - - - - - - - - - - - - - e_Edge104 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph121 - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge103 - - - - - - - - - - - - - - e_Edge061 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge085 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph122.graphml b/src/test/resources/graphml/test03/Graph122.graphml deleted file mode 100644 index 86287f8b..00000000 --- a/src/test/resources/graphml/test03/Graph122.graphml +++ /dev/null @@ -1,404 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph122 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node029 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph070 NO_MERGE - - - - - - - - - - - v_Node005 - - - - - - - - - - - v_Node025 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge102 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph122 - - - - - - - - - - - - - - e_Edge100 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - - - e_Edge101 - - - - - - - - - - - - - - e_Edge083 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - - - - e_Edge082 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph123.graphml b/src/test/resources/graphml/test03/Graph123.graphml deleted file mode 100644 index e53555f4..00000000 --- a/src/test/resources/graphml/test03/Graph123.graphml +++ /dev/null @@ -1,404 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph123 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node029 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph070 NO_MERGE - - - - - - - - - - - v_Node005 - - - - - - - - - - - v_Node025 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge099 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph123 - - - - - - - - - - - - - - e_Edge098 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - - - e_Edge097 - - - - - - - - - - - - - - e_Edge080 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - e_Edge079 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph124.graphml b/src/test/resources/graphml/test03/Graph124.graphml deleted file mode 100644 index b37aadd2..00000000 --- a/src/test/resources/graphml/test03/Graph124.graphml +++ /dev/null @@ -1,404 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph124 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node029 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph070 NO_MERGE - - - - - - - - - - - v_Node005 - - - - - - - - - - - v_Node025 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge099 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph124 - - - - - - - - - - - - - - e_Edge098 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - - - e_Edge097 - - - - - - - - - - - - - - e_Edge080 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - e_Edge079 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph125.graphml b/src/test/resources/graphml/test03/Graph125.graphml deleted file mode 100644 index bdbb6828..00000000 --- a/src/test/resources/graphml/test03/Graph125.graphml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph125 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node028 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node018 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph125 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Edge078 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph126.graphml b/src/test/resources/graphml/test03/Graph126.graphml deleted file mode 100644 index a630fba2..00000000 --- a/src/test/resources/graphml/test03/Graph126.graphml +++ /dev/null @@ -1,428 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph126 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Graph127 NO_MERGE - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node028 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph050 NO_MERGE - - - - - - - - - - - v_Node018 - - - - - - - - - - - v_Node005 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph126 - - - - - - - - - - - - - - e_Edge096 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph126 - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge095 - - - - - - - - - - - - - - e_Edge061 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge085 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph127.graphml b/src/test/resources/graphml/test03/Graph127.graphml deleted file mode 100644 index a6ed3818..00000000 --- a/src/test/resources/graphml/test03/Graph127.graphml +++ /dev/null @@ -1,360 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph127 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node028 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node005 - - - - - - - - - - - v_Node025 - - - - - - - - - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - - e_Edge094 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph127 - - - - - - - - - - - - - - e_Edge093 - - - - - - - - - - - - - - e_Edge083 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - - - - e_Edge082 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph128.graphml b/src/test/resources/graphml/test03/Graph128.graphml deleted file mode 100644 index b4fd7a42..00000000 --- a/src/test/resources/graphml/test03/Graph128.graphml +++ /dev/null @@ -1,360 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph128 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node028 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node005 - - - - - - - - - - - v_Node025 - - - - - - - - - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - - e_Edge092 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph128 - - - - - - - - - - - - - - e_Edge091 - - - - - - - - - - - - - - e_Edge080 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - e_Edge079 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph129.graphml b/src/test/resources/graphml/test03/Graph129.graphml deleted file mode 100644 index faccf80c..00000000 --- a/src/test/resources/graphml/test03/Graph129.graphml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph129 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node027 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node018 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph129 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Edge078 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph130.graphml b/src/test/resources/graphml/test03/Graph130.graphml deleted file mode 100644 index 751f6ca1..00000000 --- a/src/test/resources/graphml/test03/Graph130.graphml +++ /dev/null @@ -1,414 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph130 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Graph131 NO_MERGE - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node027 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph052 NO_MERGE - - - - - - - - - - - v_Node018 - - - - - - - - - - - v_Node005 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph130 - - - - - - - - - - - - - - e_Edge090 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph130 - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge061 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge085 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph131.graphml b/src/test/resources/graphml/test03/Graph131.graphml deleted file mode 100644 index d40e97f6..00000000 --- a/src/test/resources/graphml/test03/Graph131.graphml +++ /dev/null @@ -1,385 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph131 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node027 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node005 - - - - - - - - - - - v_Node025 - - - - - - - - - - - v_Node018 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge089 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph131 - - - - - - - - - - - - - - e_Edge083 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - - - - e_Edge082 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge078 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph132.graphml b/src/test/resources/graphml/test03/Graph132.graphml deleted file mode 100644 index fd91e0bb..00000000 --- a/src/test/resources/graphml/test03/Graph132.graphml +++ /dev/null @@ -1,385 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph132 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node027 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node005 - - - - - - - - - - - v_Node025 - - - - - - - - - - - v_Node018 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph132 - - - - - - - - - - - - - - e_Edge088 - - - - - - - - - - - - - - e_Edge080 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - e_Edge079 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge087 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph133.graphml b/src/test/resources/graphml/test03/Graph133.graphml deleted file mode 100644 index 0f65bd8e..00000000 --- a/src/test/resources/graphml/test03/Graph133.graphml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph133 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node026 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node018 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph133 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Edge078 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph134.graphml b/src/test/resources/graphml/test03/Graph134.graphml deleted file mode 100644 index 33de2be8..00000000 --- a/src/test/resources/graphml/test03/Graph134.graphml +++ /dev/null @@ -1,414 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph134 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Graph135 NO_MERGE - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node026 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph054 NO_MERGE - - - - - - - - - - - v_Node018 - - - - - - - - - - - v_Node005 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph134 - - - - - - - - - - - - - - e_Edge086 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph134 - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge061 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge085 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph135.graphml b/src/test/resources/graphml/test03/Graph135.graphml deleted file mode 100644 index 1da00b51..00000000 --- a/src/test/resources/graphml/test03/Graph135.graphml +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph135 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node026 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node005 - - - - - - - - - - - v_Node025 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge084 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph135 - - - - - - - - - - - - - - e_Edge083 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - - - - e_Edge082 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph136.graphml b/src/test/resources/graphml/test03/Graph136.graphml deleted file mode 100644 index f1e72139..00000000 --- a/src/test/resources/graphml/test03/Graph136.graphml +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph136 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node026 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node005 - - - - - - - - - - - v_Node025 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph136 - - - - - - - - - - - - - - e_Edge081 - - - - - - - - - - - - - - e_Edge080 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - e_Edge079 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph137.graphml b/src/test/resources/graphml/test03/Graph137.graphml deleted file mode 100644 index a60c7978..00000000 --- a/src/test/resources/graphml/test03/Graph137.graphml +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph137 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node024 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node018 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph137 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge078 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph138.graphml b/src/test/resources/graphml/test03/Graph138.graphml deleted file mode 100644 index b6cce081..00000000 --- a/src/test/resources/graphml/test03/Graph138.graphml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph138 - - - - - - - - - - - v_Node023 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - - e_Graph138 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge058 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph139.graphml b/src/test/resources/graphml/test03/Graph139.graphml deleted file mode 100644 index c405c3ca..00000000 --- a/src/test/resources/graphml/test03/Graph139.graphml +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph139 - - - - - - - - - - - v_Graph140 NO_MERGE - - - - - - - - - - - v_Graph094 NO_MERGE - - - - - - - - - - - v_Node023 - - - - - - - - - - - v_Node022 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node019 - - - - - - - - - - - v_Node007 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - - - e_Graph099 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - e_Graph139 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Graph139 - - - - - - - - - - - e_Graph139 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph140.graphml b/src/test/resources/graphml/test03/Graph140.graphml deleted file mode 100644 index bcdc9485..00000000 --- a/src/test/resources/graphml/test03/Graph140.graphml +++ /dev/null @@ -1,246 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph140 - - - - - - - - - - - v_Graph094 NO_MERGE - - - - - - - - - - - v_Node023 - - - - - - - - - - - v_Node022 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node019 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge077 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - e_Graph140 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Graph140 - - - - - - - - - - - e_Graph140 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph141.graphml b/src/test/resources/graphml/test03/Graph141.graphml deleted file mode 100644 index 97a2f264..00000000 --- a/src/test/resources/graphml/test03/Graph141.graphml +++ /dev/null @@ -1,246 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph141 - - - - - - - - - - - v_Graph094 NO_MERGE - - - - - - - - - - - v_Node023 - - - - - - - - - - - v_Node022 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node019 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge076 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - e_Graph141 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Graph141 - - - - - - - - - - - e_Graph141 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph142.graphml b/src/test/resources/graphml/test03/Graph142.graphml deleted file mode 100644 index 82a389ef..00000000 --- a/src/test/resources/graphml/test03/Graph142.graphml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph142 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node022 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Graph142 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph143.graphml b/src/test/resources/graphml/test03/Graph143.graphml deleted file mode 100644 index c37e2faf..00000000 --- a/src/test/resources/graphml/test03/Graph143.graphml +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph143 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node022 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph144 NO_MERGE - - - - - - - - - - - v_Node006 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Graph143 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph143 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph144.graphml b/src/test/resources/graphml/test03/Graph144.graphml deleted file mode 100644 index 87215507..00000000 --- a/src/test/resources/graphml/test03/Graph144.graphml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph144 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node022 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Graph144 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph145.graphml b/src/test/resources/graphml/test03/Graph145.graphml deleted file mode 100644 index 48b6944d..00000000 --- a/src/test/resources/graphml/test03/Graph145.graphml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph145 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node022 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - e_Graph145 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph146.graphml b/src/test/resources/graphml/test03/Graph146.graphml deleted file mode 100644 index 8a3940df..00000000 --- a/src/test/resources/graphml/test03/Graph146.graphml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph146 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node021 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Graph146 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph147.graphml b/src/test/resources/graphml/test03/Graph147.graphml deleted file mode 100644 index 872e5196..00000000 --- a/src/test/resources/graphml/test03/Graph147.graphml +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph147 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node021 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph148 NO_MERGE - - - - - - - - - - - v_Graph092 NO_MERGE - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge070 - - - - - - - - - - - e_Graph147 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph147 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge044 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph148.graphml b/src/test/resources/graphml/test03/Graph148.graphml deleted file mode 100644 index 0d0e3140..00000000 --- a/src/test/resources/graphml/test03/Graph148.graphml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph148 - - - - - - - - - - - v_Node021 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Graph092 NO_MERGE - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Graph148 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge074 - - - - - - - - - - - - - - - e_Edge057 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph149.graphml b/src/test/resources/graphml/test03/Graph149.graphml deleted file mode 100644 index c9ec36b6..00000000 --- a/src/test/resources/graphml/test03/Graph149.graphml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph149 - - - - - - - - - - - v_Node021 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Graph092 NO_MERGE - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - e_Graph149 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge073 - - - - - - - - - - - - - - - e_Edge050 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph150.graphml b/src/test/resources/graphml/test03/Graph150.graphml deleted file mode 100644 index e455ce0a..00000000 --- a/src/test/resources/graphml/test03/Graph150.graphml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph150 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node019 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node020 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Graph150 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - - - - e_Edge072 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph151.graphml b/src/test/resources/graphml/test03/Graph151.graphml deleted file mode 100644 index 86016982..00000000 --- a/src/test/resources/graphml/test03/Graph151.graphml +++ /dev/null @@ -1,370 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph151 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Graph152 NO_MERGE - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node019 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Graph009 NO_MERGE - - - - - - - - - - - v_Node020 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph151 - - - - - - - - - - - - - - e_Edge071 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - e_Edge070 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph151 - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge069 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph152.graphml b/src/test/resources/graphml/test03/Graph152.graphml deleted file mode 100644 index 334ab992..00000000 --- a/src/test/resources/graphml/test03/Graph152.graphml +++ /dev/null @@ -1,303 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph152 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node019 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node005 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge067 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - e_Edge058 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph152 - - - - - - - - - - - - - - e_Edge066 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge057 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph153.graphml b/src/test/resources/graphml/test03/Graph153.graphml deleted file mode 100644 index 68dd4309..00000000 --- a/src/test/resources/graphml/test03/Graph153.graphml +++ /dev/null @@ -1,265 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph153 - - - - - - - - - - - v_Node013 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node019 - - - - - - - - - - - v_Node012 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge062 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph153 - - - - - - - - - - - - - - - e_Edge050 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph154.graphml b/src/test/resources/graphml/test03/Graph154.graphml deleted file mode 100644 index d15f9ac3..00000000 --- a/src/test/resources/graphml/test03/Graph154.graphml +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph154 - - - - - - - - - - - v_Node018 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node017 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge061 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph155.graphml b/src/test/resources/graphml/test03/Graph155.graphml deleted file mode 100644 index 388b0e60..00000000 --- a/src/test/resources/graphml/test03/Graph155.graphml +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph155 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node015 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node016 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - e_Graph155 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge051 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph156.graphml b/src/test/resources/graphml/test03/Graph156.graphml deleted file mode 100644 index 2e3b04b2..00000000 --- a/src/test/resources/graphml/test03/Graph156.graphml +++ /dev/null @@ -1,220 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph156 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Graph157 NO_MERGE - - - - - - - - - - - v_Node011 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph156 - - - - - - - - - - - - - - e_Edge065 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge064 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph157.graphml b/src/test/resources/graphml/test03/Graph157.graphml deleted file mode 100644 index 9086353c..00000000 --- a/src/test/resources/graphml/test03/Graph157.graphml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph157 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node015 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node013 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge063 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge060 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge059 - - - - - - - - - - - - - - e_Edge058 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph157 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge057 - - - - - - - - - - - - - - e_Edge056 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph158.graphml b/src/test/resources/graphml/test03/Graph158.graphml deleted file mode 100644 index c9c05d2a..00000000 --- a/src/test/resources/graphml/test03/Graph158.graphml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph158 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node011 - - - - - - - - - - - v_Node016 - - - - - - - - - - - v_Node015 - - - - - - - - - - - v_Node012 - - - - - - - - - - - v_Node013 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge055 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge054 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - - - - - - - - - e_Edge053 - - - - - - - - - - - - - - e_Edge052 - - - - - - - - - - - e_Edge051 - - - - - - - - - - - e_Graph158 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - - - - - - - - - - e_Edge050 - - - - - - - - - - - - - - e_Edge049 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph159.graphml b/src/test/resources/graphml/test03/Graph159.graphml deleted file mode 100644 index 2268e11e..00000000 --- a/src/test/resources/graphml/test03/Graph159.graphml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph159 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node011 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge047 - - - - - - - - - - - - - - e_Edge046 - - - - - - - - - - - - - - - - e_Edge045 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph160.graphml b/src/test/resources/graphml/test03/Graph160.graphml deleted file mode 100644 index 8c7032a4..00000000 --- a/src/test/resources/graphml/test03/Graph160.graphml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph160 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Node014 - - - - - - - - - - - v_Node010 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge044 - - - - - - - - - - - - - - - - e_Graph160 - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph161.graphml b/src/test/resources/graphml/test03/Graph161.graphml deleted file mode 100644 index 684e8623..00000000 --- a/src/test/resources/graphml/test03/Graph161.graphml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph161 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node009 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge043 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge042 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph162.graphml b/src/test/resources/graphml/test03/Graph162.graphml deleted file mode 100644 index a0ac8f49..00000000 --- a/src/test/resources/graphml/test03/Graph162.graphml +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph162 - - - - - - - - - - - v_Node007 - - - - - - - - - - - v_Node006 - - - - - - - - - - - v_Graph097 NO_MERGE - - - - - - - - - - - v_Node009 - - - - - - - - - - - v_Node005 - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge041 - - - - - - - - - - - - - - - - e_Edge040 - - - - - - - - - - - - - - e_Edge039 - - - - - - - - - - - - - - - - e_Edge002 - - - - - - - - - - - - - - e_Edge038 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge037 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge036 - - - - - - - - - - - - - - - - e_Edge035 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph163.graphml b/src/test/resources/graphml/test03/Graph163.graphml deleted file mode 100644 index 6d5a553c..00000000 --- a/src/test/resources/graphml/test03/Graph163.graphml +++ /dev/null @@ -1,523 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph001 - - - - - - - - - - - v_Graph163 - - - - - - - - - - - v_Graph002 - - - - - - - - - - - v_Graph003 - - - - - - - - - - - v_Graph007 - - - - - - - - - - - v_Graph005 - - - - - - - - - - - v_Graph004 - - - - - - - - - - - v_Graph008 - - - - - - - - - - - v_Graph006 - - - - - - - - - - - - - - - - - - - - - - e_Edge034 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Graph002 - - - - - - - - - - - - - - e_Graph003 - - - - - - - - - - - e_Graph004 - - - - - - - - - - - e_Graph005 - - - - - - - - - - - e_Graph006 - - - - - - - - - - - - - - e_Graph007 - - - - - - - - - - - e_Graph008 - - - - - - - - - - - - - - - - e_Graph001 - - - - - - - - - - - - - - - - e_Graph001 - - - - - - - - - - - - - - - - e_Graph002 - - - - - - - - - - - - - - - - - - e_Graph003 - - - - - - - - - - - - - - - - e_Graph004 - - - - - - - - - - - - - - - - - - e_Graph005 - - - - - - - - - - - - - - - - e_Graph006 - - - - - - - - - - - - - - - - e_Graph007 - - - - - - - - - - - - - - e_Graph003 - - - - - - - - - - - - - - - - e_Graph003 - - - - - - - - - - - - - - - - e_Graph003 - - - - - - - - - - - - - - - - - - - - e_Graph001 - - - - - - - - - - - - - - - - - - e_Graph001 - - - - - - - - - - - - - - - - e_Graph001 - - - - - - - - - - - - - - - - e_Graph007 - - - - - - - - - - - - - - - - e_Graph007 - - - - - - - - - - - - - - - - e_Graph007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph164.graphml b/src/test/resources/graphml/test03/Graph164.graphml deleted file mode 100644 index 719094c0..00000000 --- a/src/test/resources/graphml/test03/Graph164.graphml +++ /dev/null @@ -1,264 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph075 - - - - - - - - - - - v_Graph164 - - - - - - - - - - - v_Graph076 - - - - - - - - - - - v_Graph077 - - - - - - - - - - - - - - - - e_Graph075 - - - - - - - - - - - - - - - - - - e_Graph074 - - - - - - - - - - - - - - - - - - e_Graph074 - - - - - - - - - - - - - - - - e_Graph075 - - - - - - - - - - - - - - e_Graph076 - - - - - - - - - - - - - - e_Graph076 - - - - - - - - - - - - - - - - e_Graph074 - - - - - - - - - - - - - - - - e_Graph075 - - - - - - - - - - - - - - - - e_Graph076 - - - - - - - - - - - - - - e_Graph077 - - - - - - - - - - - - - - - - e_Graph077 - - - - - - - - - - - - - - - - e_Graph077 - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/test03/Graph165.graphml b/src/test/resources/graphml/test03/Graph165.graphml deleted file mode 100644 index 3b9dafed..00000000 --- a/src/test/resources/graphml/test03/Graph165.graphml +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph009 - - - - - - - - - - - v_Graph165 - - - - - - - - - - - v_Graph010 - - - - - - - - - - - - - - - - - - - - - - e_Edge033 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Graph010 - - - - - - - - - - - - - - - - e_Graph009 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph166.graphml b/src/test/resources/graphml/test03/Graph166.graphml deleted file mode 100644 index 0e81c11f..00000000 --- a/src/test/resources/graphml/test03/Graph166.graphml +++ /dev/null @@ -1,769 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph011 - - - - - - - - - - - v_Graph166 - - - - - - - - - - - v_Graph012 - - - - - - - - - - - v_Graph013 - - - - - - - - - - - v_Graph014 - - - - - - - - - - - v_Graph015 - - - - - - - - - - - v_Graph016 - - - - - - - - - - - v_Graph017 - - - - - - - - - - - v_Graph018 - - - - - - - - - - - v_Graph019 - - - - - - - - - - - v_Graph020 - - - - - - - - - - - v_Graph021 - - - - - - - - - - - v_Graph022 - - - - - - - - - - - v_Graph023 - - - - - - - - - - - v_Graph024 - - - - - - - - - - - v_Graph025 - - - - - - - - - - - - - - - - - - - - - - e_Edge031 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Graph012 - - - - - - - - - - - - - - - - e_Graph011 - - - - - - - - - - - - - - - - - - e_Graph012 - - - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Graph013 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Graph014 - - - - - - - - - - - - - - - - e_Graph013 - - - - - - - - - - - e_Graph015 - - - - - - - - - - - - - - - - e_Graph014 - - - - - - - - - - - e_Graph016 - - - - - - - - - - - - - - - - e_Graph015 - - - - - - - - - - - e_Graph017 - - - - - - - - - - - e_Graph018 - - - - - - - - - - - e_Graph019 - - - - - - - - - - - e_Graph020 - - - - - - - - - - - e_Graph021 - - - - - - - - - - - e_Graph022 - - - - - - - - - - - e_Graph023 - - - - - - - - - - - - - - e_Graph024 - - - - - - - - - - - e_Graph025 - - - - - - - - - - - - - - - - e_Graph018 - - - - - - - - - - - - - - - - e_Graph017 - - - - - - - - - - - - - - - - e_Graph019 - - - - - - - - - - - - - - - - e_Graph020 - - - - - - - - - - - - - - - - e_Graph021 - - - - - - - - - - - - - - - - e_Graph022 - - - - - - - - - - - - - - - - - - e_Graph023 - - - - - - - - - - - - - - - - e_Graph024 - - - - - - - - - - - - - - - - - - e_Graph011 - - - - - - - - - - - - - - - - e_Graph011 - - - - - - - - - - - - - - - - e_Graph011 - - - - - - - - - - - - - - - - e_Graph011 - - - - - - - - - - - - - - - - - - e_Graph011 - - - - - - - - - - - - - - - - e_Graph016 - - - - - - - - - - - - - - - - e_Graph016 - - - - - - - - - - - - - - - - e_Graph016 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph167.graphml b/src/test/resources/graphml/test03/Graph167.graphml deleted file mode 100644 index db4868a7..00000000 --- a/src/test/resources/graphml/test03/Graph167.graphml +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph055 - - - - - - - - - - - v_Graph167 - - - - - - - - - - - v_Graph054 - - - - - - - - - - - v_Graph026 - - - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge032 - - - - - - - - - - - - - - e_Graph055 - - - - - - - - - - - - - - - - e_Graph054 - - - - - - - - - - - - - - e_Graph026 - - - - - - - - - - - - - - - - e_Graph054 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph168.graphml b/src/test/resources/graphml/test03/Graph168.graphml deleted file mode 100644 index 82d05d71..00000000 --- a/src/test/resources/graphml/test03/Graph168.graphml +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph053 - - - - - - - - - - - v_Graph168 - - - - - - - - - - - v_Graph052 - - - - - - - - - - - v_Graph026 - - - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge030 - - - - - - - - - - - - - - e_Graph053 - - - - - - - - - - - - - - - - e_Graph052 - - - - - - - - - - - - - - e_Graph026 - - - - - - - - - - - - - - - - e_Graph052 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph169.graphml b/src/test/resources/graphml/test03/Graph169.graphml deleted file mode 100644 index 4aa8b433..00000000 --- a/src/test/resources/graphml/test03/Graph169.graphml +++ /dev/null @@ -1,687 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph071 - - - - - - - - - - - v_Graph169 - - - - - - - - - - - v_Graph070 - - - - - - - - - - - v_Graph072 - - - - - - - - - - - v_Graph073 - - - - - - - - - - - v_Graph074 - - - - - - - - - - - v_Graph078 - - - - - - - - - - - v_Graph082 - - - - - - - - - - - v_Graph083 - - - - - - - - - - - v_Graph084 - - - - - - - - - - - v_Graph085 - - - - - - - - - - - v_Graph086 - - - - - - - - - - - v_Graph087 - - - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge029 - - - - - - - - - - - - - - - - e_Graph071 - - - - - - - - - - - - - - - - e_Graph070 - - - - - - - - - - - - - - - - - - e_Graph070 - - - - - - - - - - - - - - - - - - - - e_Graph071 - - - - - - - - - - - - - - - - e_Graph072 - - - - - - - - - - - - - - - - e_Graph072 - - - - - - - - - - - - - - - - e_Graph070 - - - - - - - - - - - - - - - - e_Graph071 - - - - - - - - - - - - - - - - e_Graph072 - - - - - - - - - - - - - - e_Graph073 - - - - - - - - - - - - - - e_Graph073 - - - - - - - - - - - - - - - - e_Graph073 - - - - - - - - - - - - - - e_Graph074 - - - - - - - - - - - - - - - - - - e_Graph070 - - - - - - - - - - - - - - e_Graph078 - - - - - - - - - - - - - - - - e_Graph070 - - - - - - - - - - - - - - - - e_Graph070 - - - - - - - - - - - - - - - - e_Graph070 - - - - - - - - - - - - - - - - e_Graph070 - - - - - - - - - - - - - - - - e_Graph070 - - - - - - - - - - - - - - - - e_Graph070 - - - - - - - - - - - - - - - - e_Graph070 - - - - - - - - - - - - - - - - - - e_Graph082 - - - - - - - - - - - - - - e_Graph083 - - - - - - - - - - - - - - - - e_Graph084 - - - - - - - - - - - e_Graph085 - - - - - - - - - - - - - - - - e_Graph086 - - - - - - - - - - - e_Graph087 - - - - - - - - - - - - - - - - e_Graph082 - - - - - - - - - - - - - - - - e_Graph084 - - - - - - - - - - - - - - - - e_Graph086 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph170.graphml b/src/test/resources/graphml/test03/Graph170.graphml deleted file mode 100644 index 9fcc504e..00000000 --- a/src/test/resources/graphml/test03/Graph170.graphml +++ /dev/null @@ -1,216 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph046 - - - - - - - - - - - v_Graph170 - - - - - - - - - - - v_Graph045 - - - - - - - - - - - v_Graph047 - - - - - - - - - - - v_Graph026 - - - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge028 - - - - - - - - - - - e_Graph046 - - - - - - - - - - - - - - - - e_Graph045 - - - - - - - - - - - - - - - - e_Graph047 - - - - - - - - - - - - - - e_Graph047 - - - - - - - - - - - - - - - - e_Graph045 - - - - - - - - - - - - - - e_Graph026 - - - - - - - - - - - - - - - - e_Graph045 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph171.graphml b/src/test/resources/graphml/test03/Graph171.graphml deleted file mode 100644 index 132e0c7a..00000000 --- a/src/test/resources/graphml/test03/Graph171.graphml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph093 - - - - - - - - - - - v_Graph171 - - - - - - - - - - - v_Graph092 - - - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge026 - - - - - - - - - - - e_Graph093 - - - - - - - - - - - - - - - - e_Graph092 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph172.graphml b/src/test/resources/graphml/test03/Graph172.graphml deleted file mode 100644 index 9639b701..00000000 --- a/src/test/resources/graphml/test03/Graph172.graphml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph089 - - - - - - - - - - - v_Graph172 - - - - - - - - - - - v_Graph088 - - - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge027 - - - - - - - - - - - e_Graph089 - - - - - - - - - - - - - - - - e_Graph088 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph173.graphml b/src/test/resources/graphml/test03/Graph173.graphml deleted file mode 100644 index ea310bed..00000000 --- a/src/test/resources/graphml/test03/Graph173.graphml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph173 - - - - - - - - - - - v_Graph094 - - - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge025 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph174.graphml b/src/test/resources/graphml/test03/Graph174.graphml deleted file mode 100644 index a934e4af..00000000 --- a/src/test/resources/graphml/test03/Graph174.graphml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph096 - - - - - - - - - - - v_Graph174 - - - - - - - - - - - v_Graph095 - - - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge024 - - - - - - - - - - - e_Graph096 - - - - - - - - - - - - - - - - e_Graph095 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph175.graphml b/src/test/resources/graphml/test03/Graph175.graphml deleted file mode 100644 index 62c4f28d..00000000 --- a/src/test/resources/graphml/test03/Graph175.graphml +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph051 - - - - - - - - - - - v_Graph175 - - - - - - - - - - - v_Graph050 - - - - - - - - - - - v_Graph026 - - - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge023 - - - - - - - - - - - - - - e_Graph051 - - - - - - - - - - - - - - - - e_Graph050 - - - - - - - - - - - - - - e_Graph026 - - - - - - - - - - - - - - - - e_Graph050 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph176.graphml b/src/test/resources/graphml/test03/Graph176.graphml deleted file mode 100644 index 3088df91..00000000 --- a/src/test/resources/graphml/test03/Graph176.graphml +++ /dev/null @@ -1,264 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph079 - - - - - - - - - - - v_Graph176 - - - - - - - - - - - v_Graph080 - - - - - - - - - - - v_Graph081 - - - - - - - - - - - - - - - - e_Graph079 - - - - - - - - - - - - - - - - - - e_Graph078 - - - - - - - - - - - - - - - - - - e_Graph078 - - - - - - - - - - - - - - - - e_Graph079 - - - - - - - - - - - - - - e_Graph080 - - - - - - - - - - - - - - e_Graph080 - - - - - - - - - - - - - - - - e_Graph078 - - - - - - - - - - - - - - - - e_Graph079 - - - - - - - - - - - - - - - - e_Graph080 - - - - - - - - - - - - - - e_Graph081 - - - - - - - - - - - - - - - - e_Graph081 - - - - - - - - - - - - - - - - e_Graph081 - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/test03/Graph177.graphml b/src/test/resources/graphml/test03/Graph177.graphml deleted file mode 100644 index 6a259840..00000000 --- a/src/test/resources/graphml/test03/Graph177.graphml +++ /dev/null @@ -1,1111 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph177 - - - - - - - - - - - v_Graph027 - - - - - - - - - - - v_Graph029 - - - - - - - - - - - v_Graph028 - - - - - - - - - - - v_Graph030 - - - - - - - - - - - v_Graph031 - - - - - - - - - - - v_Graph032 - - - - - - - - - - - v_Graph033 - - - - - - - - - - - v_Graph035 - - - - - - - - - - - v_Graph034 - - - - - - - - - - - v_Graph036 - - - - - - - - - - - v_Graph037 - - - - - - - - - - - v_Graph039 - - - - - - - - - - - v_Graph038 - - - - - - - - - - - v_Graph040 - - - - - - - - - - - v_Graph041 - - - - - - - - - - - v_Graph043 - - - - - - - - - - - v_Graph042 - - - - - - - - - - - v_Graph044 - - - - - - - - - - - - - - - - e_Graph027 - - - - - - - - - - - e_Graph028 - - - - - - - - - - - e_Graph029 - - - - - - - - - - - - - - - - - - e_Graph028 - - - - - - - - - - - - - - - - e_Graph027 - - - - - - - - - - - - - - - - e_Graph026 - - - - - - - - - - - - - - - - e_Graph031 - - - - - - - - - - - - - - - - - - e_Graph029 - - - - - - - - - - - e_Graph030 - - - - - - - - - - - - - - - - e_Graph029 - - - - - - - - - - - - - - - - e_Graph033 - - - - - - - - - - - e_Graph034 - - - - - - - - - - - e_Graph035 - - - - - - - - - - - - - - - - e_Graph034 - - - - - - - - - - - - - - - - e_Graph033 - - - - - - - - - - - - - - - - - - e_Graph032 - - - - - - - - - - - - - - - - e_Graph032 - - - - - - - - - - - - - - e_Graph037 - - - - - - - - - - - e_Graph038 - - - - - - - - - - - e_Graph039 - - - - - - - - - - - - - - - - e_Graph038 - - - - - - - - - - - - - - - - e_Graph037 - - - - - - - - - - - - - - - - e_Graph036 - - - - - - - - - - - - - - e_Graph036 - - - - - - - - - - - e_Graph041 - - - - - - - - - - - - - - - - e_Graph042 - - - - - - - - - - - e_Graph043 - - - - - - - - - - - - - - - - e_Graph042 - - - - - - - - - - - - - - - - e_Graph041 - - - - - - - - - - - - - - - - e_Graph040 - - - - - - - - - - - - - - - - e_Graph043 - - - - - - - - - - - e_Graph044 - - - - - - - - - - - - - - e_Graph040 - - - - - - - - - - - - - - - - - - e_Graph026 - - - - - - - - - - - - - - - - - - e_Graph026 - - - - - - - - - - - - - - - - e_Graph026 - - - - - - - - - - - - - - - - - - - - e_Graph026 - - - - - - - - - - - - - - - - e_Graph032 - - - - - - - - - - - - - - - - e_Graph032 - - - - - - - - - - - - - - - - e_Graph036 - - - - - - - - - - - - - - - - e_Graph036 - - - - - - - - - - - - - - - - - - e_Graph040 - - - - - - - - - - - - - - - - e_Graph040 - - - - - - - - - - - - - - - - e_Graph040 - - - - - - - - - - - - - - - - - - e_Graph040 - - - - - - - - - - - - - - e_Graph040 - - - - - - - - - - - - - - - - - - e_Graph040 - - - - - - - - - - - - - - - - v_Graph032 - - - - - - - - - - - - - - - - - - - - v_Graph032 - - - - - - - - - - - - - - - - - - - - v_Graph032 - - - - - - - - - - - - - - - - - - e_Graph026 - - - - - - - - - - - - - - - - e_Graph026 - - - - - - - - - - - - - - - - - - e_Graph036 - - - - - - - - - - - - - - - - e_Graph036 - - - - - - - - - - - - - - - - - - e_Graph036 - - - - - - - - - - - - - - - - e_Graph026 - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/test03/Graph178.graphml b/src/test/resources/graphml/test03/Graph178.graphml deleted file mode 100644 index c47ea8c1..00000000 --- a/src/test/resources/graphml/test03/Graph178.graphml +++ /dev/null @@ -1,3020 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph098 - - - - - - - - - - - v_Graph178 - - - - - - - - - - - v_Graph097 - - - - - - - - - - - v_Graph099 - - - - - - - - - - - v_Graph100 - - - - - - - - - - - v_Graph101 - - - - - - - - - - - v_Graph102 - - - - - - - - - - - v_Graph103 - - - - - - - - - - - v_Graph104 - - - - - - - - - - - v_Graph105 - - - - - - - - - - - v_Graph106 - - - - - - - - - - - v_Graph107 - - - - - - - - - - - v_Graph108 - - - - - - - - - - - v_Graph109 - - - - - - - - - - - v_Graph110 - - - - - - - - - - - v_Graph111 - - - - - - - - - - - v_Graph112 - - - - - - - - - - - v_Graph113 - - - - - - - - - - - v_Graph114 - - - - - - - - - - - v_Graph115 - - - - - - - - - - - v_Graph116 - - - - - - - - - - - v_Graph117 - - - - - - - - - - - v_Graph118 - - - - - - - - - - - v_Graph119 - - - - - - - - - - - v_Graph120 - - - - - - - - - - - v_Graph122 - - - - - - - - - - - v_Graph123 - - - - - - - - - - - v_Graph124 - - - - - - - - - - - v_Graph125 - - - - - - - - - - - v_Graph126 - - - - - - - - - - - v_Graph127 - - - - - - - - - - - v_Graph128 - - - - - - - - - - - v_Graph129 - - - - - - - - - - - v_Graph130 - - - - - - - - - - - v_Graph131 - - - - - - - - - - - v_Graph132 - - - - - - - - - - - v_Graph133 - - - - - - - - - - - v_Graph134 - - - - - - - - - - - v_Graph135 - - - - - - - - - - - v_Graph136 - - - - - - - - - - - v_Graph137 - - - - - - - - - - - v_Graph138 - - - - - - - - - - - v_Graph139 - - - - - - - - - - - v_Graph140 - - - - - - - - - - - v_Graph141 - - - - - - - - - - - v_Graph142 - - - - - - - - - - - v_Graph143 - - - - - - - - - - - v_Graph144 - - - - - - - - - - - v_Graph145 - - - - - - - - - - - v_Graph146 - - - - - - - - - - - v_Graph147 - - - - - - - - - - - v_Graph148 - - - - - - - - - - - v_Graph149 - - - - - - - - - - - v_Graph150 - - - - - - - - - - - v_Graph151 - - - - - - - - - - - v_Graph152 - - - - - - - - - - - v_Graph153 - - - - - - - - - - - v_Graph154 - - - - - - - - - - - v_Graph155 - - - - - - - - - - - v_Graph156 - - - - - - - - - - - v_Graph157 - - - - - - - - - - - v_Graph158 - - - - - - - - - - - v_Graph159 - - - - - - - - - - - v_Graph160 - - - - - - - - - - - v_Graph161 - - - - - - - - - - - v_Graph162 - - - - - - - - - - - v_Node008 - - - - - - - - - - - v_Graph121 - - - - - - - - - - - - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - e_Edge022 - - - - - - - - - - - e_Graph098 - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - - - - e_Graph099 - - - - - - - - - - - - - - e_Graph100 - - - - - - - - - - - - - - - - e_Graph098 - - - - - - - - - - - - - - e_Graph100 - - - - - - - - - - - - - - - - e_Graph098 - - - - - - - - - - - - - - - - e_Graph099 - - - - - - - - - - - - - - e_Graph101 - - - - - - - - - - - - - - e_Graph102 - - - - - - - - - - - e_Graph103 - - - - - - - - - - - - - - - - - - e_Graph102 - - - - - - - - - - - - - - - - - - e_Graph101 - - - - - - - - - - - - - - - - e_Graph098 - - - - - - - - - - - e_Graph104 - - - - - - - - - - - - - - - - e_Graph101 - - - - - - - - - - - - - - e_Graph105 - - - - - - - - - - - - - - - - e_Graph104 - - - - - - - - - - - - - - - - e_Graph106 - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - e_Graph107 - - - - - - - - - - - - - - - - e_Graph106 - - - - - - - - - - - e_Graph108 - - - - - - - - - - - e_Graph109 - - - - - - - - - - - - - - - - - - e_Graph108 - - - - - - - - - - - - - - - - - - - - e_Graph107 - - - - - - - - - - - - - - - - e_Graph110 - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - e_Graph111 - - - - - - - - - - - e_Graph112 - - - - - - - - - - - - - - e_Graph113 - - - - - - - - - - - - - - - - e_Graph112 - - - - - - - - - - - - - - - - - - - - e_Graph111 - - - - - - - - - - - - - - - - - - - - e_Graph110 - - - - - - - - - - - - - - - - e_Graph110 - - - - - - - - - - - - - - - - - - - - e_Graph106 - - - - - - - - - - - - - - - - e_Graph101 - - - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - e_Graph115 - - - - - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - e_Graph116 - - - - - - - - - - - e_Graph117 - - - - - - - - - - - e_Graph118 - - - - - - - - - - - e_Graph119 - - - - - - - - - - - - - - - - e_Graph118 - - - - - - - - - - - - - - - - e_Graph117 - - - - - - - - - - - - - - - - e_Graph116 - - - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - - - - - - e_Graph115 - - - - - - - - - - - - - - - - e_Graph120 - - - - - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - e_Graph123 - - - - - - - - - - - e_Graph124 - - - - - - - - - - - - - - - - e_Graph123 - - - - - - - - - - - - - - - - e_Graph122 - - - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - - - - - - e_Graph125 - - - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - e_Graph126 - - - - - - - - - - - - - - - - - - - - e_Graph125 - - - - - - - - - - - e_Graph127 - - - - - - - - - - - - - - e_Graph128 - - - - - - - - - - - - - - - - e_Graph127 - - - - - - - - - - - - - - - - - - - - e_Graph126 - - - - - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - - - - - - e_Graph129 - - - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - e_Graph130 - - - - - - - - - - - e_Graph131 - - - - - - - - - - - e_Graph132 - - - - - - - - - - - - - - - - e_Graph131 - - - - - - - - - - - - - - - - e_Graph130 - - - - - - - - - - - - - - - - e_Graph129 - - - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - - - - - - e_Graph133 - - - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - e_Graph134 - - - - - - - - - - - e_Graph135 - - - - - - - - - - - e_Graph136 - - - - - - - - - - - - - - - - e_Graph135 - - - - - - - - - - - - - - - - e_Graph134 - - - - - - - - - - - - - - - - e_Graph133 - - - - - - - - - - - - - - - - e_Graph137 - - - - - - - - - - - - - - - - - - e_Graph114 - - - - - - - - - - - - - - e_Graph139 - - - - - - - - - - - - - - - - e_Graph140 - - - - - - - - - - - e_Graph141 - - - - - - - - - - - - - - - - e_Graph140 - - - - - - - - - - - - - - - - - - e_Graph139 - - - - - - - - - - - - - - - - - - e_Graph138 - - - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - e_Graph143 - - - - - - - - - - - e_Graph144 - - - - - - - - - - - e_Graph145 - - - - - - - - - - - - - - - - e_Graph144 - - - - - - - - - - - - - - - - e_Graph143 - - - - - - - - - - - - - - - - e_Graph142 - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - e_Graph147 - - - - - - - - - - - e_Graph148 - - - - - - - - - - - - - - e_Graph149 - - - - - - - - - - - - - - - - e_Graph148 - - - - - - - - - - - - - - - - e_Graph147 - - - - - - - - - - - - - - - - e_Graph146 - - - - - - - - - - - e_Graph151 - - - - - - - - - - - e_Graph152 - - - - - - - - - - - e_Graph153 - - - - - - - - - - - e_Graph154 - - - - - - - - - - - - - - - - e_Graph153 - - - - - - - - - - - - - - - - e_Graph152 - - - - - - - - - - - - - - - - e_Graph151 - - - - - - - - - - - - - - - - e_Graph150 - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - e_Graph156 - - - - - - - - - - - e_Graph157 - - - - - - - - - - - - - - e_Graph158 - - - - - - - - - - - - - - - - e_Graph157 - - - - - - - - - - - - - - - - e_Graph156 - - - - - - - - - - - - - - - - e_Graph155 - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - - - - e_Graph162 - - - - - - - - - - - - - - - - e_Graph161 - - - - - - - - - - - e_Graph160 - - - - - - - - - - - - - - - - - - e_Graph159 - - - - - - - - - - - - - - - - e_Graph159 - - - - - - - - - - - - - - - - e_Graph161 - - - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - - - - - - e_Graph097 - - - - - - - - - - - - - - - - e_Graph138 - - - - - - - - - - - - - - - - e_Graph142 - - - - - - - - - - - - - - e_Graph146 - - - - - - - - - - - - - - - - e_Graph150 - - - - - - - - - - - - - - - - e_Graph155 - - - - - - - - - - - - - - - - e_Edge021 - - - - - - - - - - - - - - - - - - - - e_Graph120 - - - - - - - - - - - - - - - - e_Graph121 - - - - - - - - - - - - - - - - e_Graph121 - - - - - - - - - - - - - - - - e_Graph122 - - - - - - diff --git a/src/test/resources/graphml/test03/Graph179.graphml b/src/test/resources/graphml/test03/Graph179.graphml deleted file mode 100644 index 84bc26b3..00000000 --- a/src/test/resources/graphml/test03/Graph179.graphml +++ /dev/null @@ -1,599 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Graph179 - - - - - - - - - - - v_Graph163 - - - - - - - - - - - v_Node004 MERGE - - - - - - - - - - - v_Graph165 - - - - - - - - - - - v_Graph166 - - - - - - - - - - - v_Graph170 - - - - - - - - - - - v_Graph178 - - - - - - - - - - - v_Graph175 - - - - - - - - - - - v_Graph168 - - - - - - - - - - - v_Graph167 - - - - - - - - - - - v_Graph169 - - - - - - - - - - - v_Graph172 - - - - - - - - - - - v_Graph171 - - - - - - - - - - - v_Graph173 - - - - - - - - - - - v_Graph174 - - - - - - - - - - - - - - - - - - - - - - - - e_Edge020 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge019 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge015 - - - - - - - - - - - - - - e_Edge018 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge017 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge014 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge013 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge016 - - - - - - - - - - - - - - e_Edge012 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge010 - - - - - - - - - - - - - - e_Edge011 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge009 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge008 - - - - - - - - - - - - - - - - e_Edge007 - - - - - - - - - - - - - - e_Edge006 - - - - - - diff --git a/src/test/resources/graphml/test03/Start.graphml b/src/test/resources/graphml/test03/Start.graphml deleted file mode 100644 index c12393c8..00000000 --- a/src/test/resources/graphml/test03/Start.graphml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Node004 - - - - - - - - - - - v_Node003 - - - - - - - - - - - v_Node002 - - - - - - - - - - - v_Node001 - - - - - - - - - - - v_Graph179 - - - - - - - - - - - e_Edge001 - - - - - - - - - - - e_Edge004 - - - - - - - - - - - e_Edge003 - - - - - - - - - - - e_Edge002 - - - - - - - - - - - e_Edge001 - - - - - - diff --git a/src/test/resources/graphml/test09/B.graphml b/src/test/resources/graphml/test09/B.graphml deleted file mode 100644 index 2341d4fd..00000000 --- a/src/test/resources/graphml/test09/B.graphml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - B - - - - - - - - - - - D - - - - - - - - - - - E - - - - - - - - - - - C - - - - - - - - - - - - - - - - - - - - - doD - - - - - - - - - - - doE - - - - - - - - - - - - - - - - doD - - - - - - - - - - - - - - - - doB - - - - - - - - - - - doC - - - - - - diff --git a/src/test/resources/graphml/test09/C.graphml b/src/test/resources/graphml/test09/C.graphml deleted file mode 100644 index 2341d4fd..00000000 --- a/src/test/resources/graphml/test09/C.graphml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - B - - - - - - - - - - - D - - - - - - - - - - - E - - - - - - - - - - - C - - - - - - - - - - - - - - - - - - - - - doD - - - - - - - - - - - doE - - - - - - - - - - - - - - - - doD - - - - - - - - - - - - - - - - doB - - - - - - - - - - - doC - - - - - - diff --git a/src/test/resources/graphml/test09/Start.graphml b/src/test/resources/graphml/test09/Start.graphml deleted file mode 100644 index 2cc8751d..00000000 --- a/src/test/resources/graphml/test09/Start.graphml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - A - - - - - - - - - - - B - - - - - - - - - - - C - - - - - - - - - - - C NO_MERGE - - - - - - - - - - - doA - - - - - - - - - - - doB - - - - - - - - - - - - - - doC - - - - - - - - - - - - - - - - doA - - - - - - - - - - - - - - doCSpecial - - - - - - - - - - - - - - - - doA - - - - - - diff --git a/src/test/resources/graphml/test10/B.graphml b/src/test/resources/graphml/test10/B.graphml deleted file mode 100644 index 627a6e89..00000000 --- a/src/test/resources/graphml/test10/B.graphml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - B - - - - - - - - - - - - - - - - - - - - - - E - - - - - - - - - - - C - - - - - - - - - - - - - - - - - - - - - doD - - - - - - - - - - - doE - - - - - - - - - - - - - - - - doD - - - - - - - - - - - - - - - - doB - - - - - - - - - - - doC - - - - - - diff --git a/src/test/resources/graphml/test10/C.graphml b/src/test/resources/graphml/test10/C.graphml deleted file mode 100644 index 88ad2230..00000000 --- a/src/test/resources/graphml/test10/C.graphml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - C - - - - - - - - - - - D - - - - - - - - - - - E - - - - - - - - - - - G - - - - - - - - - - - - - - - - - - - - - doD - - - - - - - - - - - doE - - - - - - - - - - - - - - - - doD - - - - - - - - - - - - - - - - doB - - - - - - - - - - - doC - - - - - - diff --git a/src/test/resources/graphml/test10/Start.graphml b/src/test/resources/graphml/test10/Start.graphml deleted file mode 100644 index 2cc8751d..00000000 --- a/src/test/resources/graphml/test10/Start.graphml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - A - - - - - - - - - - - B - - - - - - - - - - - C - - - - - - - - - - - C NO_MERGE - - - - - - - - - - - doA - - - - - - - - - - - doB - - - - - - - - - - - - - - doC - - - - - - - - - - - - - - - - doA - - - - - - - - - - - - - - doCSpecial - - - - - - - - - - - - - - - - doA - - - - - - diff --git a/src/test/resources/graphml/test11/B.graphml b/src/test/resources/graphml/test11/B.graphml deleted file mode 100644 index 59db437f..00000000 --- a/src/test/resources/graphml/test11/B.graphml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - B - - - - - - - - - - - D - - - - - - - - - - - E - - - - - - - - - - - C - - - - - - - - - - - - - - - - - - - - - doD - - - - - - - - - - - doE - - - - - - - - - - - - - - - - doD - - - - - - - - - - - - - - - - doB - - - - - - - - - - - doC - - - - - - diff --git a/src/test/resources/graphml/test11/C.graphml b/src/test/resources/graphml/test11/C.graphml deleted file mode 100644 index 7a2c993d..00000000 --- a/src/test/resources/graphml/test11/C.graphml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - C - - - - - - - - - - - D - - - - - - - - - - - E - - - - - - - - - - - C - - - - - - - - - - - - - - - - - - - - - doD - - - - - - - - - - - doE - - - - - - - - - - - - - - - - doD - - - - - - - - - - - - - - - - doB - - - - - - - - - - - doC - - - - - - diff --git a/src/test/resources/graphml/test11/Start.graphml b/src/test/resources/graphml/test11/Start.graphml deleted file mode 100644 index 2cc8751d..00000000 --- a/src/test/resources/graphml/test11/Start.graphml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - A - - - - - - - - - - - B - - - - - - - - - - - C - - - - - - - - - - - C NO_MERGE - - - - - - - - - - - doA - - - - - - - - - - - doB - - - - - - - - - - - - - - doC - - - - - - - - - - - - - - - - doA - - - - - - - - - - - - - - doCSpecial - - - - - - - - - - - - - - - - doA - - - - - - diff --git a/src/test/resources/graphml/test13/B.graphml b/src/test/resources/graphml/test13/B.graphml deleted file mode 100644 index 59db437f..00000000 --- a/src/test/resources/graphml/test13/B.graphml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - B - - - - - - - - - - - D - - - - - - - - - - - E - - - - - - - - - - - C - - - - - - - - - - - - - - - - - - - - - doD - - - - - - - - - - - doE - - - - - - - - - - - - - - - - doD - - - - - - - - - - - - - - - - doB - - - - - - - - - - - doC - - - - - - diff --git a/src/test/resources/graphml/test13/C.graphml b/src/test/resources/graphml/test13/C.graphml deleted file mode 100644 index 3ef9efa8..00000000 --- a/src/test/resources/graphml/test13/C.graphml +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - Start - - - - - - - - - - - - C - - - - - - - - - - - - D - - - - - - - - - - - - E - - - - - - - - - - - - G - - - - - - - - - - - - - - - - - - - - - - - doD - - - - - - - - - - - - doE - - - - - - - - - - - - - - - - - doD - - - - - - - - - - - - - - - - - doB - - - - - - - - - - - - -BACKTRACK - - - - - - - - - - diff --git a/src/test/resources/graphml/test13/Start.graphml b/src/test/resources/graphml/test13/Start.graphml deleted file mode 100644 index 2cc8751d..00000000 --- a/src/test/resources/graphml/test13/Start.graphml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - A - - - - - - - - - - - B - - - - - - - - - - - C - - - - - - - - - - - C NO_MERGE - - - - - - - - - - - doA - - - - - - - - - - - doB - - - - - - - - - - - - - - doC - - - - - - - - - - - - - - - - doA - - - - - - - - - - - - - - doCSpecial - - - - - - - - - - - - - - - - doA - - - - - - diff --git a/src/test/resources/graphml/test14/B.graphml b/src/test/resources/graphml/test14/B.graphml deleted file mode 100644 index 657ed320..00000000 --- a/src/test/resources/graphml/test14/B.graphml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - B - - - - - - - - - - - D - - - - - - - - - - - E - - - - - - - - - - - G - - - - - - - - - - - - - - - - - - - - - doD - - - - - - - - - - - doE - - - - - - - - - - - - - - - - doD - - - - - - - - - - - - - - - - doB - - - - - - - - - - - doC - - - - - - diff --git a/src/test/resources/graphml/test14/C.graphml b/src/test/resources/graphml/test14/C.graphml deleted file mode 100644 index 02012f18..00000000 --- a/src/test/resources/graphml/test14/C.graphml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - C - - - - - - - - - - - D - - - - - - - - - - - E - - - - - - - - - - - Containing a whitespace - - - - - - - - - - - - - - - - - - - - - doD - - - - - - - - - - - doE - - - - - - - - - - - - - - - - doD - - - - - - - - - - - - - - - - doB - - - - - - - - - - - doG - - - - - - diff --git a/src/test/resources/graphml/test14/Start.graphml b/src/test/resources/graphml/test14/Start.graphml deleted file mode 100644 index 4d6ab311..00000000 --- a/src/test/resources/graphml/test14/Start.graphml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - A - - - - - - - - - - - B - - - - - - - - - - - C - - - - - - - - - - - C NO_MERGE - - - - - - - - - - - doA - - - - - - - - - - - doB - - - - - - - - - - - - - - doC - - - - - - - - - - - - - - - - doA - - - - - - - - - - - - - - doCSpecial - - - - - - - - - - - - - - - - doA - - - - - - diff --git a/src/test/resources/graphml/test15/test15.graphml b/src/test/resources/graphml/test15/test15.graphml deleted file mode 100644 index c6df8d20..00000000 --- a/src/test/resources/graphml/test15/test15.graphml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - A - - - - - - - - - - - B - - - - - - - - - - - C - - - - - - - - - - - C NO_MERGE - - - - - - - - - - - - - - - - - - - - - - doB - - - - - - - - - - - - - - doC - - - - - - - - - - - - - - - - doA - - - - - - - - - - - - - - doCSpecial - - - - - - - - - - - - - - - - doA - - - - - - diff --git a/src/test/resources/graphml/test17/test17.graphml b/src/test/resources/graphml/test17/test17.graphml deleted file mode 100644 index 49a1b60d..00000000 --- a/src/test/resources/graphml/test17/test17.graphml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - A - - - - - - - - - - - - - B - - - - - - - - - - - - - C - - - - - - - - - - - - - C NO_MERGE - - - - - - - - - - - - - Start - - - - - - - - - - - - - e_Init - - - - - - - - - - - - - doB - - - - - - - - - - - - - - - - doC - - - - - - - - - - - - - - - - - - doA - - - - - - - - - - - - - - - - doCSpecial - - - - - - - - - - - - - - - - - - doA - - - - - - - - - - - - - - - e_Init - - - - - - - - diff --git a/src/test/resources/graphml/test18/test18.graphml b/src/test/resources/graphml/test18/test18.graphml deleted file mode 100644 index 0a37169d..00000000 --- a/src/test/resources/graphml/test18/test18.graphml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - A - - - - - - - - - - - - - B - - - - - - - - - - - - - C - - - - - - - - - - - - - C NO_MERGE - - - - - - - - - - - - - Start - - - - - - - - - - - - - e_Init - - - - - - - - - - - - - doB - - - - - - - - - - - - - - - - doC - - - - - - - - - - - - - - - - - - doA - - - - - - - - - - - - - - - - doCSpecial - - - - - - - - - - - - - - - - - - doA - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/test19/test19.graphml b/src/test/resources/graphml/test19/test19.graphml deleted file mode 100644 index fbab2939..00000000 --- a/src/test/resources/graphml/test19/test19.graphml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - A - - - - - - - - - - - - - B - - - - - - - - - - - - - C - - - - - - - - - - - - - C NO_MERGE - - - - - - - - - - - - - Start - - - - - - - - - - - - - - - - - - - - - - - - - - doB - - - - - - - - - - - - - - - - doC - - - - - - - - - - - - - - - - - - doA - - - - - - - - - - - - - - - - doCSpecial - - - - - - - - - - - - - - - - - - doA - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/test20/test20.graphml b/src/test/resources/graphml/test20/test20.graphml deleted file mode 100644 index a8704230..00000000 --- a/src/test/resources/graphml/test20/test20.graphml +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - - - - - - - - - - Start - - - - - - - - - - - - A - - - - - - - - - - - - B - - - - - - - - - - - - C - - - - - - - - - - - - C -NO_MERGE - - - - - - - - - - - - - - - - - - - - - - - - doB - - - - - - - - - - - - - - - doC - - - - - - - - - - - - - - - - - doA - - - - - - - - - - - - - - - doCSpecial - - - - - - - - - - - - - - - - - doA - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/test22/1.graphml b/src/test/resources/graphml/test22/1.graphml deleted file mode 100644 index 68f6e1f6..00000000 --- a/src/test/resources/graphml/test22/1.graphml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - v_1 - - - - - - - - - - - - - v_1_1 - - - - - - - - - - - - - Nil admirari - - - - - - - - - - - - Stop - - - - - - - - - - - - - e_1_1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/test22/2.graphml b/src/test/resources/graphml/test22/2.graphml deleted file mode 100644 index 877952e0..00000000 --- a/src/test/resources/graphml/test22/2.graphml +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - Quidquid id est timeo Danaos et dona ferentes - - - - - - - - - - - - v_2_1 - - - - - - - - - - - - - v_2_2 - - - - - - - - - - - - - v_2_3 - - - - - - - - - - - - - v_2_4 - - - - - - - - - - - - - v_2 - - - - - - - - - - - - - e_2_2 - - - - - - - - - - - - - e_2_3 - - - - - - - - - - - - - e_2_4 - - - - - - - - - - - - - - - - - - e_2 - - - - - - - - - - - - - - - - - - - - - - - - - - e_2_1 - - - - - - - - diff --git a/src/test/resources/graphml/test22/main.graphml b/src/test/resources/graphml/test22/main.graphml deleted file mode 100644 index 56357010..00000000 --- a/src/test/resources/graphml/test22/main.graphml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - v_1 - - - - - - - - - - - - - O sancta simplícitas - - - - - - - - - - - - v_2 - - - - - - - - - - - - - e_noAction - - - - - - - - - - - - - e_noAction - - - - - - - - diff --git a/src/test/resources/graphml/test23/AddressBook.graphml b/src/test/resources/graphml/test23/AddressBook.graphml deleted file mode 100644 index c994f11b..00000000 --- a/src/test/resources/graphml/test23/AddressBook.graphml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_AddressBook - - - - - - - - - - - v_ContactTapToSelectNumber SUBGRAPH - - - - - - - - - - - Stop - - - - - - - - - - - e_TapRandomListItem BACKTRACKING /* If an item exists in the list. */ - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp BACKTRACKING /* If sending a SMS, and close app was called, we gor here */ - - - - - - diff --git a/src/test/resources/graphml/test23/ContactTapToSelectNumber.graphml b/src/test/resources/graphml/test23/ContactTapToSelectNumber.graphml deleted file mode 100644 index e22c397f..00000000 --- a/src/test/resources/graphml/test23/ContactTapToSelectNumber.graphml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_ContactTapToSelectNumber - - - - - - - - - - - v_AddressBook_Contact_ToolsMenu - - - - - - - - - - - Stop - - - - - - - - - - - v_SendVCard SUBGRAPH - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - e_TapIcon_5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/test23/Contacts.graphml b/src/test/resources/graphml/test23/Contacts.graphml deleted file mode 100644 index dccc0de5..00000000 --- a/src/test/resources/graphml/test23/Contacts.graphml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_AddressBook SUBGRAPH - - - - - - - - - - - v_Contacts - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/test23/Main.graphml b/src/test/resources/graphml/test23/Main.graphml deleted file mode 100644 index 699279d7..00000000 --- a/src/test/resources/graphml/test23/Main.graphml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Contacts SUBGRAPH - - - - - - - - - - - v_StatusScreen - - - - - - - - - - - v_StartMenu - - - - - - - - - - - e_Init - - - - - - - - - - - e_TapIcon_2 - - - - - - - - - - - e_SweepShowStartMenu - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/test23/SendVCard.graphml b/src/test/resources/graphml/test23/SendVCard.graphml deleted file mode 100644 index d3c4a7da..00000000 --- a/src/test/resources/graphml/test23/SendVCard.graphml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - v_SendVCard - - - - - - - - - - - Start - - - - - - - - - - - Stop - - - - - - - - - - - v_MessagingInbox NO_MERGE - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepAccept BACKTRACK /* If recipient exists */ - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - diff --git a/src/test/resources/graphml/test24/AddressBook.graphml b/src/test/resources/graphml/test24/AddressBook.graphml deleted file mode 100644 index 0a483c30..00000000 --- a/src/test/resources/graphml/test24/AddressBook.graphml +++ /dev/null @@ -1,1459 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_AddressBook - - - - - - - - - - - v_AddressBook_ToolsMenu_1 - - - - - - - - - - - v_AddressBook_AddContact SUBGRAPH - - - - - - - - - - - v_DeleteItems SUBGRAPH - - - - - - - - - - - v_KeyboardText SUBGRAPH - - - - - - - - - - - v_AddressBook_AddFavorite - - - - - - - - - - - v_ContactTapToSelectNumber SUBGRAPH - - - - - - - - - - - v_AddressBook_ToolsMenu_2 - - - - - - - - - - - v_AddressBook_ContactSettings - - - - - - - - - - - Stop - - - - - - - - - - - v_SelectNameFormat - - - - - - - - - - - v_Prefer - - - - - - - - - - - v_BirthdayReminderSettingsEnabled - - - - - - - - - - - v_BirthdayReminderSettingsDisabled - - - - - - - - - - - v_DefaultValues SUBGRAPH - - - - - - - - - - - v_DefaultValues SUBGRAPH - - - - - - - - - - - v_DefaultValues SUBGRAPH - - - - - - - - - - - v_ReminderWhen - - - - - - - - - - - v_Time SUBGRAPH - - - - - - - - - - - v_Audio SUBGRAPH - - - - - - - - - - - v_SendVCard SUBGRAPH - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - e_TapIcon_1 - - - - - - - - - - - - - - e_TapIcon_2 BACKTRACKING /* If Icon 2 is enabled. */ - - - - - - - - - - - - - - e_SweepShowKeyboard - - - - - - - - - - - e_TapIcon_4 BACKTRACKING /* If Icon 4 is enabled. */ - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_TapRandomListItem BACKTRACKING /* If an item exists in the list. */ - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - e_TapIcon_5 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - - - e_TapItem1 - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - - - e_TapScreen - - - - - - - - - - - - - - - - e_TapItem2 - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - - - - - e_TapScreen - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_TapItem1 - - - - - - - - - - - - - - - - - - e_TapItem1 - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - e_TapItem2 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_TapScreen - - - - - - - - - - - - - - - - e_TapItem3 - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - e_TapItem4 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_TapIcon_3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_TapIcon_5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp BACKTRACKING /* If sending a SMS, and close app was called, we gor here */ - - - - - - - - - - - - - - e_TapItem3 - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - BACKTRACK - - - - - - diff --git a/src/test/resources/graphml/test24/AddressBookContact.graphml b/src/test/resources/graphml/test24/AddressBookContact.graphml deleted file mode 100644 index 8de79cbb..00000000 --- a/src/test/resources/graphml/test24/AddressBookContact.graphml +++ /dev/null @@ -1,600 +0,0 @@ - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - v_AddressBook_AddContact - - - - - - - - - - - - - v_ContactMustHaveName - - - - - - - - - - - - - v_KeyboardText SUBGRAPH - - - - - - - - - - - - - v_Camera SUBGRAPH - - - - - - - - - - - - - v_AudioTone - - - - - - - - - - - - - v_KeyboardNumeric SUBGRAPH - - - - - - - - - - - - - Stop - - - - - - - - - - - - - v_ContactHasChanged - - - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_TapInListStringFirst_name - - - - - - - - - - - - - - - - e_TapInListStringPicture - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_TapInListStringRing_tone - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_TapInListStringMobile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp - - - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - e_SweepCloseApp - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - BACKTRACK /* No name set */ - - - - - - - - - - - - - - - - - - BACKTRACK /* Mandatory fields OK */ - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - BACKTRACK /* Fields OK */ - - - - - - - - - - - - - - - - - - BACKTRACK /* No name set */ - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - diff --git a/src/test/resources/graphml/test24/AddressBookReadOnly.graphml b/src/test/resources/graphml/test24/AddressBookReadOnly.graphml deleted file mode 100644 index a5d0b79a..00000000 --- a/src/test/resources/graphml/test24/AddressBookReadOnly.graphml +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_AddressBookReadOnly - - - - - - - - - - - v_KeyboardText SUBGRAPH - - - - - - - - - - - v_ContactTapToSelectNumber NO_MERGE - - - - - - - - - - - Stop - - - - - - - - - - - - - - e_SweepShowKeyboard - - - - - - - - - - - - - - e_TapRandomListItem BACKTRACK /* If an item exists in the list. */ - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_TapRandomListItem BACKTRACK /* Only allowed when there are numbers in the list */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - diff --git a/src/test/resources/graphml/test24/Alarm.graphml b/src/test/resources/graphml/test24/Alarm.graphml deleted file mode 100644 index 643a24df..00000000 --- a/src/test/resources/graphml/test24/Alarm.graphml +++ /dev/null @@ -1,818 +0,0 @@ - - - - - - - - - - - - - v_Audio SUBGRAPH - - - - - - - - - - - v_AlarmHistory_ToolsMenu - - - - - - - - - - - v_AlarmHistory - - - - - - - - - - - v_Audio SUBGRAPH - - - - - - - - - - - v_AlarmEdit SUBGRAPH - - - - - - - - - - - v_DeleteItems SUBGRAPH - - - - - - - - - - - v_AlarmToolsMenu - - - - - - - - - - - v_AlarmDateAlreadyOccured - - - - - - - - - - - v_AlarmEdit SUBGRAPH - - - - - - - - - - - v_Date SUBGRAPH - - - - - - - - - - - v_Time SUBGRAPH - - - - - - - - - - - v_Alarm - - - - - - - - - - - Start - - - - - - - - - - - Stop - - - - - - - - - - - v_Dummy - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_TapListItemFirst - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - e_TapIcon_1 - - - - - - - - - - - - - - e_TapIcon_2 BACKTRACK /* If an alarm exists in the list. */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_TapIcon_3 BACKTRACK /* If an alarm exists in the list. */ - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - e_TapIcon_5 - - - - - - - - - - - - - - - e_SelectRandomListItem /* 'Add Alarm...' do always exist. New Alarms gets added to the list. */ - - - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - e_SelectRandomListItem /* Listan kan vara tom */ - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - e_TapIcon_5 - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_TryTapListItemNotFirst BACKTRACK /* If a Alarm is selected from the list. */ - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseView BACKTRACK - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - BACKTRACK - - - - - - diff --git a/src/test/resources/graphml/test24/AlarmEdit.graphml b/src/test/resources/graphml/test24/AlarmEdit.graphml deleted file mode 100644 index ac02274e..00000000 --- a/src/test/resources/graphml/test24/AlarmEdit.graphml +++ /dev/null @@ -1,714 +0,0 @@ - - - - - - - - - - - - - v_KeyboardText SUBGRAPH - - - - - - - - - - - v_AlarmEdit - - - - - - - - - - - Start - - - - - - - - - - - v_Time SUBGRAPH - - - - - - - - - - - v_Date SUBGRAPH - - - - - - - - - - - v_AlarmAction - - - - - - - - - - - v_AlarmDateAlreadyOccured - - - - - - - - - - - Stop - - - - - - - - - - - v_EditAlarmChanged - - - - - - - - - - - v_AlarmDateAlreadyOccured - - - - - - - - - - - v_Dummy - - - - - - - - - - - v_Dummy - - - - - - - - - - - v_Dummy - - - - - - - - - - - v_Dummy - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - e_TapItem3 - - - - - - - - - - - - - - - - e_TapItem1 - - - - - - - - - - - - - - e_TapItem2 - - - - - - - - - - - - - - - - e_TapItem4 - - - - - - - - - - - - - - - - e_TapRandomListItem - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepAccept BACKTRACK - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - diff --git a/src/test/resources/graphml/test24/Audio.graphml b/src/test/resources/graphml/test24/Audio.graphml deleted file mode 100644 index e53e523f..00000000 --- a/src/test/resources/graphml/test24/Audio.graphml +++ /dev/null @@ -1,411 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Audio - - - - - - - - - - - v_AudioAction - - - - - - - - - - - v_AudioTone /* TODO: Implement selection of audio file.*/ - - - - - - - - - - - v_AudioTone_ToolsMenu - - - - - - - - - - - v_ChangeVolume - - - - - - - - - - - v_DefaultValues SUBGRAPH - - - - - - - - - - - Stop - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - e_TapItem1 - - - - - - - - - - - - - - e_TapItem2 - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - e_TapIcon_4 - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_TapRandomListItem - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - diff --git a/src/test/resources/graphml/test24/Calculator.graphml b/src/test/resources/graphml/test24/Calculator.graphml deleted file mode 100644 index c1c3f1d8..00000000 --- a/src/test/resources/graphml/test24/Calculator.graphml +++ /dev/null @@ -1,234 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Calculator - - - - - - - - - - - v_KeyboardNumeric SUBGRAPH - - - - - - - - - - - v_Calculator_Error - - - - - - - - - - - Stop - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView weight=0.05 - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView weight=0.05 - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp BACKTRACK - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - diff --git a/src/test/resources/graphml/test24/Calendar.graphml b/src/test/resources/graphml/test24/Calendar.graphml deleted file mode 100644 index e50f307b..00000000 --- a/src/test/resources/graphml/test24/Calendar.graphml +++ /dev/null @@ -1,760 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_CalendarMonthView - - - - - - - - - - - v_Calendar_ToolsMenu SUBGRAPH - - - - - - - - - - - v_CalendarWeekView - - - - - - - - - - - v_CalendarDayView - - - - - - - - - - - v_Calendar_ToolsMenu SUBGRAPH - - - - - - - - - - - v_Calendar_ToolsMenu SUBGRAPH - - - - - - - - - - - v_CalendarAppointment SUBGRAPH - - - - - - - - - - - v_Calendar SUBGRAPH - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_TapCalendarItem - - - - - - - - - - - - - - - - e_TapCalendarItem - - - - - - - - - - - - - - e_TryTapRandomListItem BACKTRACK - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - e_LeftKey - - - - - - - - - - - - - - - e_RightKey - - - - - - - - - - - - - - - e_UpKey - - - - - - - - - - - - - - - e_DownKey - - - - - - - - - - - - - - - e_LeftKey - - - - - - - - - - - - - - - e_RightKey - - - - - - - - - - - - - - - e_UpKey - - - - - - - - - - - - - - - e_DownKey - - - - - - - - - - - - - - - e_LeftKey - - - - - - - - - - - - - - - e_RightKey - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp BACKTRACK weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - diff --git a/src/test/resources/graphml/test24/CalendarAppointment.graphml b/src/test/resources/graphml/test24/CalendarAppointment.graphml deleted file mode 100644 index d624c0a6..00000000 --- a/src/test/resources/graphml/test24/CalendarAppointment.graphml +++ /dev/null @@ -1,976 +0,0 @@ - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - v_CalendarAppointment - - - - - - - - - - - - - v_KeyboardText SUBGRAPH - - - - - - - - - - - - - v_Date SUBGRAPH - - - - - - - - - - - - - v_Time SUBGRAPH - - - - - - - - - - - - - v_CalendarAppointmentStatus - - - - - - - - - - - - - v_CalendarAppointmentReminder - - - - - - - - - - - - - v_CalendarAppointmentReminderCustom - - - - - - - - - - - - - v_Time SUBGRAPH - - - - - - - - - - - - - v_Date SUBGRAPH - - - - - - - - - - - - - Stop - - - - - - - - - - - - - v_CalendarAppointmentSaveChanges - - - - - - - - - - - - - v_TimeMustBeLess - - - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - - - - e_TapInListStringSubject BACKTRACK - - - - - - - - - - - - - - - - - e_SelectRandomListItem BACKTRACK - - - - - - - - - - - - - - - - - - e_SweepCloseView BACKTRACK - - - - - - - - - - - - - - - - - - e_SweepAccept BACKTRACK - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_TapInListStringStart_date BACKTRACK - - - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_TapInListStringStart_time BACKTRACK - - - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_TapInListStringStatus BACKTRACK - - - - - - - - - - - - - - - - - - e_TapRandomListItem - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_TapInListStringReminder BACKTRACK - - - - - - - - - - - - - - - - - - e_TapRandomListItemNotLast BACKTRACK /* If not 'Custom...' is selected. */ - - - - - - - - - - - - - - - - e_TapListItemLast - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepCloseView BACKTRACK - - - - - - - - - - - - - - - - - - e_TapItem2 BACKTRACK /* If 'Time:' is selected. */ - - - - - - - - - - - - - - - - - - e_TapItem1 BACKTRACK /* If 'Date:' is selected. */ - - - - - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - - - e_SweepAccept BACKTRACK - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepCloseApp BACKTRACK weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseApp BACKTRACK weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - diff --git a/src/test/resources/graphml/test24/Calendar_ToolsMenu.graphml b/src/test/resources/graphml/test24/Calendar_ToolsMenu.graphml deleted file mode 100644 index eb81ddcb..00000000 --- a/src/test/resources/graphml/test24/Calendar_ToolsMenu.graphml +++ /dev/null @@ -1,267 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Calendar_ToolsMenu - - - - - - - - - - - v_CalendarAppointment SUBGRAPH - - - - - - - - - - - Stop - - - - - - - - - - - v_DeleteItems SUBGRAPH - - - - - - - - - - - v_Date SUBGRAPH - - - - - - - - - - - v_Audio SUBGRAPH - - - - - - - - - - - - - - e_TapIcon_1 - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_TapIcon_2 BACKTRACK /* If Icon 2 is enabled. */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_TapIcon_3 - - - - - - - - - - - - - - e_TapIcon_4 - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - e_TapIcon_5 - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - diff --git a/src/test/resources/graphml/test24/CallHistory.graphml b/src/test/resources/graphml/test24/CallHistory.graphml deleted file mode 100644 index 8292ff5c..00000000 --- a/src/test/resources/graphml/test24/CallHistory.graphml +++ /dev/null @@ -1,313 +0,0 @@ - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - v_CallHistory - - - - - - - - - - - - - v_CallHistory_ToolsMenu - - - - - - - - - - - - - v_DeleteItems SUBGRAPH - - - - - - - - - - - - - v_AddressBook_AddContact SUBGRAPH - - - - - - - - - - - - - v_ContactTapToSelectNumber SUBGRAPH - - - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_TapIcon_2 BACKTRACK /* Only if enabled */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_TapIcon_1 BACKTRACK /* Only if enabled */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_TapIcon_4 BACKTRACK /* Only if enabled */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - diff --git a/src/test/resources/graphml/test24/Camera.graphml b/src/test/resources/graphml/test24/Camera.graphml deleted file mode 100644 index e724e867..00000000 --- a/src/test/resources/graphml/test24/Camera.graphml +++ /dev/null @@ -1,871 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_CameraViewFinder - - - - - - - - - - - v_Camera_ToolsMenu - - - - - - - - - - - v_Camera_Settings - - - - - - - - - - - v_Camera_Settings_Resolution - - - - - - - - - - - v_Camera_ResetDefaultValues - - - - - - - - - - - v_Camera_ToolsMenu_Reset - - - - - - - - - - - v_Camera_Settings_WhiteBalance - - - - - - - - - - - v_Camera_Settings_Brightness - - - - - - - - - - - v_SavingImage - - - - - - - - - - - v_SavingImage - - - - - - - - - - - v_SendPictureAsMMS SUBGRAPH - - - - - - - - - - - v_ImageViewer SUBGRAPH - - - - - - - - - - - v_Camera_Settings_ColorSaturation - - - - - - - - - - - v_Camera - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_TapItem1 - - - - - - - - - - - - - - e_TapIcon_2 BACKTRACK /* If Icon 2 is enabled. */ - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - e_TapIcon_5 - - - - - - - - - - - - - - e_TapTakePicture - - - - - - - - - - - - - - - - e_Wait_2s - - - - - - - - - - - - - - - - - - e_Wait_4s - - - - - - - - - - - - - - - - - - e_TapRandomListItem - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - e_SweepCloseApp BLOCKED weight=0.05 - - - - - - - - - - - - - - e_TapIcon_1 BACKTRACK /* If enabled */ - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_TapItem2 - - - - - - - - - - - e_TapItem3 - - - - - - - - - - - - - - e_TapItem4 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - e_SweepAccept BACKTRACK - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepAccept BACKTRACK - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/test24/ContactFavorites.graphml b/src/test/resources/graphml/test24/ContactFavorites.graphml deleted file mode 100644 index 2dfeb832..00000000 --- a/src/test/resources/graphml/test24/ContactFavorites.graphml +++ /dev/null @@ -1,579 +0,0 @@ - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - v_ContactFavorites - - - - - - - - - - - - - v_ContactFavorites_ToolsMenu_1 - - - - - - - - - - - - - v_ContactFavorites_ToolsMenu_2 - - - - - - - - - - - - - v_AddressBook_AddContact SUBGRAPH - - - - - - - - - - - - - v_ContactFavorite_DeleteFavorite - - - - - - - - - - - - - v_AddressBook_ImportFromSIM - - - - - - - - - - - - - v_AddressBook_ExportToSIM - - - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_TapIcon_1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_TapIcon_2 BACKTRACK - - - - - - - - - - - - - - - - e_TapIcon_3 - - - - - - - - - - - - - - - - e_TapIcon_4 - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - diff --git a/src/test/resources/graphml/test24/ContactFavoritesReadOnly.graphml b/src/test/resources/graphml/test24/ContactFavoritesReadOnly.graphml deleted file mode 100644 index 9e860bcd..00000000 --- a/src/test/resources/graphml/test24/ContactFavoritesReadOnly.graphml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_ContactFavoritesReadOnly SUBGRAPH - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseApp - - - - - - diff --git a/src/test/resources/graphml/test24/ContactTapToSelectNumber.graphml b/src/test/resources/graphml/test24/ContactTapToSelectNumber.graphml deleted file mode 100644 index 34757f09..00000000 --- a/src/test/resources/graphml/test24/ContactTapToSelectNumber.graphml +++ /dev/null @@ -1,480 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_ContactTapToSelectNumber - - - - - - - - - - - v_AddressBook_Contact_ToolsMenu - - - - - - - - - - - v_SendMessage SUBGRAPH - - - - - - - - - - - Stop - - - - - - - - - - - v_KeyboardNumeric SUBGRAPH - - - - - - - - - - - v_AddressBook_AddContact SUBGRAPH - - - - - - - - - - - v_AddressBook_AddContact SUBGRAPH - - - - - - - - - - - v_SendVCard SUBGRAPH - - - - - - - - - - - v_MessagingInbox NO_MERGE - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_TapIcon_1 BACKTRACK /* If Icon 1 is enabled. */ - - - - - - - - - - - - - - e_TapIcon_3 - - - - - - - - - - - - - - e_TapIcon_5 - - - - - - - - - - - - - - e_SweepShowKeyboard BACKTRACK /* Only if contact has a number */ - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseApp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseApp - - - - - - - - - - - - - - - - e_SweepCloseApp - - - - - - - - - - - - - - - - e_SweepCloseApp - - - - - - - - - - - - - - - - e_SweepClose - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - diff --git a/src/test/resources/graphml/test24/Contacts.graphml b/src/test/resources/graphml/test24/Contacts.graphml deleted file mode 100644 index d127a7c7..00000000 --- a/src/test/resources/graphml/test24/Contacts.graphml +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_AddressBook SUBGRAPH - - - - - - - - - - - v_ContactFavorites SUBGRAPH - - - - - - - - - - - v_Contacts - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepCloseApp - - - - - - - - - - - - - - - - e_SweepCloseApp - - - - - - diff --git a/src/test/resources/graphml/test24/ContactsReadOnly.graphml b/src/test/resources/graphml/test24/ContactsReadOnly.graphml deleted file mode 100644 index a0bb43e9..00000000 --- a/src/test/resources/graphml/test24/ContactsReadOnly.graphml +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_AddressBookReadOnly SUBGRAPH - - - - - - - - - - - v_ContactFavoritesReadOnly SUBGRAPH - - - - - - - - - - - v_ContactsReadOnly - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/test24/Date.graphml b/src/test/resources/graphml/test24/Date.graphml deleted file mode 100644 index 96e909be..00000000 --- a/src/test/resources/graphml/test24/Date.graphml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - v_Date - - - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_PressRandomKey - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - diff --git a/src/test/resources/graphml/test24/DefaultValues.graphml b/src/test/resources/graphml/test24/DefaultValues.graphml deleted file mode 100644 index 4b8ed698..00000000 --- a/src/test/resources/graphml/test24/DefaultValues.graphml +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_DefaultValues - - - - - - - - - - - v_ResetDefaultValues - - - - - - - - - - - v_SelectItems - - - - - - - - - - - Stop - - - - - - - - - - - - - - e_TapIcon_2 BACKTRACK /* If Icon 2 is enabled. */ - - - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - e_TapIcon_1 BACKTRACK /* If Icon 1 is enabled. */ - - - - - - - - - - - - - - - - e_TapIcon_2 BACKTRACK /* If Icon 2 is enabled. */ - - - - - - - - - - - - - - - e_SelectRandomListItem /* Values different from default, will be listed. */ - - - - - - - - - - - - - - - e_TapRandomListItem - - - - - - - - - - - - - - - - - - - - - - - - e_SweepAccept BACKTRACK - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - diff --git a/src/test/resources/graphml/test24/DeleteItems.graphml b/src/test/resources/graphml/test24/DeleteItems.graphml deleted file mode 100644 index d1651024..00000000 --- a/src/test/resources/graphml/test24/DeleteItems.graphml +++ /dev/null @@ -1,253 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_DeleteItems - - - - - - - - - - - v_SelectItems - - - - - - - - - - - Stop - - - - - - - - - - - v_ConfirmDeleteItem - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - e_TapIcon_1 BACKTRACK /* If Icon 1 is enabled */ - - - - - - - - - - - - - - - - e_TapIcon_2 BACKTRACK /* If Icon 2 is enabled */ - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - e_SweepAccept BACKTRACK /* If any items is selected */ - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - e_TryTapRandomListItem BACKTRACK - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - e_SweepCloseApp BLOCKED weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp BLOCKED weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp BLOCKED weight=0.05 - - - - - - diff --git a/src/test/resources/graphml/test24/GlobalSettings.graphml b/src/test/resources/graphml/test24/GlobalSettings.graphml deleted file mode 100644 index 1269b901..00000000 --- a/src/test/resources/graphml/test24/GlobalSettings.graphml +++ /dev/null @@ -1,466 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_GlobalSettings - - - - - - - - - - - Stop - - - - - - - - - - - v_DisplaySettings - - - - - - - - - - - v_SystemSettings - - - - - - - - - - - v_CommunicationSettings - - - - - - - - - - - v_AudioSettings - - - - - - - - - - - v_GPRSSettings - - - - - - - - - - - v_GPRSSettingsToolsMenu - - - - - - - - - - - v_GPRSAddAPN - - - - - - - - - - - v_KeyboardText SUBGRAPH - - - - - - - - - - - v_Dummy - - - - - - - - - - - v_TheNameAlreadyExists - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_TapIcon_1 - - - - - - - - - - - e_TapIcon_2 - - - - - - - - - - - - - - e_TapIcon_3 - - - - - - - - - - - - - - e_TapIcon_4 - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView weight=0.05 - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_TapItem2 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - e_TapItem1 - - - - - - - - - - - e_TapIcon_1 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - BACKTRACK - - - - - - diff --git a/src/test/resources/graphml/test24/ImageViewer.graphml b/src/test/resources/graphml/test24/ImageViewer.graphml deleted file mode 100644 index b9882ced..00000000 --- a/src/test/resources/graphml/test24/ImageViewer.graphml +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_ImageViewer - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepAccept BACKTRACK - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - diff --git a/src/test/resources/graphml/test24/KeyboardNumeric.graphml b/src/test/resources/graphml/test24/KeyboardNumeric.graphml deleted file mode 100644 index 9fc8a618..00000000 --- a/src/test/resources/graphml/test24/KeyboardNumeric.graphml +++ /dev/null @@ -1,250 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - Stop - - - - - - - - - - - v_KeyboardNumeric - - - - - - - - - - - v_PasteText - - - - - - - - - - - v_KeyboardToolsMenu SUBGRAPH - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepAccept BACKTRACK - - - - - - - - - - - e_SweepCloseView BACKTRACK weight=0.05 - - - - - - - - - - - - - - - e_PressRandomKey BACKTRACK weight=0.8 - - - - - - - - - - - - - - e_SweepShowKeyboard BACKTRACK /* If text exists in the clipboard. */ - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - - - e_TapRandomListItem - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepShowTools BACKTRACK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseApp BACKTRACK weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - diff --git a/src/test/resources/graphml/test24/KeyboardText.graphml b/src/test/resources/graphml/test24/KeyboardText.graphml deleted file mode 100644 index eeebb502..00000000 --- a/src/test/resources/graphml/test24/KeyboardText.graphml +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - Stop - - - - - - - - - - - v_KeyboardText - - - - - - - - - - - v_PasteText - - - - - - - - - - - v_KeyboardToolsMenu SUBGRAPH - - - - - - - - - - - v_KeyboardSelectWord - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - - - - - - - - - e_SweepAccept BACKTRACK - - - - - - - - - - - - - - - - - - e_SweepCloseView BACKTRACK weight=0.25 - - - - - - - - - - - - - - - e_PressRandomKey BACKTRACK weight=0.5 - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - - - e_TryTapRandomListItem - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepShowTools BACKTRACK - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - - - - - e_TapScreen - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp BLOCKED BACKTRACK weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepShowKeyboard BACKTRACK - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - BACKTRACK - - - - - - diff --git a/src/test/resources/graphml/test24/KeyboardToolsMenu.graphml b/src/test/resources/graphml/test24/KeyboardToolsMenu.graphml deleted file mode 100644 index 21171880..00000000 --- a/src/test/resources/graphml/test24/KeyboardToolsMenu.graphml +++ /dev/null @@ -1,752 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_KeyboardSettings - - - - - - - - - - - v_SelectFavoriteKeyboards - - - - - - - - - - - v_SelectKeyboardSpeed - - - - - - - - - - - v_ChangeButtonVibration - - - - - - - - - - - v_DefaultValues SUBGRAPH - - - - - - - - - - - v_KeyboardToolsMenu - - - - - - - - - - - v_SelectKeyboard - - - - - - - - - - - Stop - - - - - - - - - - - v_ConfirmClear - - - - - - - - - - - v_CopyTo - - - - - - - - - - - v_PasteText - - - - - - - - - - - v_Preview - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - e_TapItem1 - - - - - - - - - - - - - - e_TapItem2 - - - - - - - - - - - - - - e_TapItem3 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - e_MoveSliderRandom - - - - - - - - - - - - - - - e_MoveSliderRandom - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - - - - - - - e_TapIcon_5 - - - - - - - - - - - - - - e_TapIcon_1 BACKTRACK /* If Icon 1 is enabled */ - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - e_TapIcon_2 BACKTRACK /* If Icon 2 is enabled */ - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - e_TapIcon_3 BACKTRACK /* If Icon 3 is enabled */ - - - - - - - - - - - - - - - - e_TapRandomListItem - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - e_TapIcon_4 BACKTRACK /* If Icon 4 is enabled */ - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_TryTapRandomListItem - - - - - - - - - - - - - - e_TapIcon_6 BACKTRACK /* If Icon 6 is enabled */ - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - diff --git a/src/test/resources/graphml/test24/Main.graphml b/src/test/resources/graphml/test24/Main.graphml deleted file mode 100644 index b97a7f85..00000000 --- a/src/test/resources/graphml/test24/Main.graphml +++ /dev/null @@ -1,925 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Contacts SUBGRAPH - - - - - - - - - - - v_StatusScreen - - - - - - - - - - - v_StartMenu - - - - - - - - - - - v_Camera SUBGRAPH - - - - - - - - - - - v_MessagingInbox SUBGRAPH - - - - - - - - - - - v_MediaPlayer SUBGRAPH - - - - - - - - - - - v_StartMenu_2 - - - - - - - - - - - v_StartMenu_3 - - - - - - - - - - - v_ShortCuts - - - - - - - - - - - v_SysFiles SUBGRAPH - - - - - - - - - - - v_RunningApplications SUBGRAPH - - - - - - - - - - - v_Calendar SUBGRAPH - - - - - - - - - - - v_Notes SUBGRAPH - - - - - - - - - - - v_Tetris SUBGRAPH - - - - - - - - - - - v_Alarm SUBGRAPH - - - - - - - - - - - v_NeoBrowser SUBGRAPH - - - - - - - - - - - v_Calculator SUBGRAPH - - - - - - - - - - - v_NumberToDial SUBGRAPH - - - - - - - - - - - v_GlobalSettings SUBGRAPH - - - - - - - - - - - e_Init - - - - - - - - - - - - - - e_TapIcon_2 - - - - - - - - - - - - - - - - e_SweepShowStartMenu - - - - - - - - - - - - - - - - e_TapIcon_5 - - - - - - - - - - - - - - - - e_TapIcon_6 - - - - - - - - - - - - - - e_TapIcon_1 - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - e_SweepTabLeft weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepTabLeft weight=0.05 - - - - - - - - - - - - - - - - e_SweepTabLeft weight=0.05 - - - - - - - - - - - - - - - - e_SweepTabLeft weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseView weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepCloseView weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseView weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseView weight=0.05 - - - - - - - - - - - - - - - - e_TapIcon_2 - - - - - - - - - - - - - - e_TapIcon_3 - - - - - - - - - - - - - - e_TapIcon_4 - - - - - - - - - - - - - - e_TapIcon_5 - - - - - - - - - - - - - - e_TapIcon_6 - - - - - - - - - - - - - - e_TapIcon_1 - - - - - - - - - - - - - - e_TapIcon_2 - - - - - - - - - - - - - - e_TapIcon_3 - - - - - - - - - - - - - - e_SweepShowKeyboard - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/test24/MakeCall.graphml b/src/test/resources/graphml/test24/MakeCall.graphml deleted file mode 100644 index 98bf9575..00000000 --- a/src/test/resources/graphml/test24/MakeCall.graphml +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_MakeCall - - - - - - - - - - - v_OutgoingCall - - - - - - - - - - - v_NoSIMCard - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - - - - - - - e_NoSIMCard BACKTRACK /* If no SIM card inserted in the phone */ - - - - - - - - - - - - - - - - e_Wait_5s - - - - - - - - - - - - - - e_SweepCloseView - - - - - - diff --git a/src/test/resources/graphml/test24/MediaPlayer.graphml b/src/test/resources/graphml/test24/MediaPlayer.graphml deleted file mode 100644 index cfa9757f..00000000 --- a/src/test/resources/graphml/test24/MediaPlayer.graphml +++ /dev/null @@ -1,854 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_MediaPlayerChoose - - - - - - - - - - - v_MediaPlayerPlayList - - - - - - - - - - - v_MediaPlayerToolsMenu1 - - - - - - - - - - - v_MediaPlayerVolume - - - - - - - - - - - v_MediaPlayerToolsMenu2 - - - - - - - - - - - v_MediaPlayerToolsMenu - - - - - - - - - - - v_MediaPlayerPlayer - - - - - - - - - - - v_MediaPlayerSettings - - - - - - - - - - - v_CreatePlaylist - - - - - - - - - - - v_MediaPlayerAddFile - - - - - - - - - - - v_KeyboardText SUBGRAPH - - - - - - - - - - - v_MediaPlayerPosition - - - - - - - - - - - v_EditPlaylist - - - - - - - - - - - v_MediaPlayer - - - - - - - - - - - Stop - - - - - - - - - - - v_Dummy - - - - - - - - - - - v_SavePlaylistError - - - - - - - - - - - - - - e_TapIcon_4 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - e_TapIcon_5 - - - - - - - - - - - - - - - e_TapItem1 - - - - - - - - - - - - - - - e_TapItem2 - - - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - e_SweepShowTools BACKTRACK - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_TapIcon_1 - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - e_TapIcon_3 - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_TapIcon_4 - - - - - - - - - - - - - - - e_MoveSliderRandom - - - - - - - - - - - - - - e_TapIcon_3 BACKTRACK - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - e_MoveSliderRandom - - - - - - - - - - - - - - - - e_TapIcon_1 BACKTRACK - - - - - - - - - - - - - - - - e_TapIcon_2 BACKTRACK - - - - - - - - - - - - - - - - e_TapIcon_5 BACKTRACK - - - - - - - - - - - - - - - - e_TapIcon_6 BACKTRACK - - - - - - - - - - - - - - - - e_TapIcon_2 BACKTRACK - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - e_SweepCloseApp - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView weight=0.1 - - - - - - - - - - - - - - - - e_SweepCloseView weight=0.1 - - - - - - diff --git a/src/test/resources/graphml/test24/MessagingCompose.graphml b/src/test/resources/graphml/test24/MessagingCompose.graphml deleted file mode 100644 index 29d25974..00000000 --- a/src/test/resources/graphml/test24/MessagingCompose.graphml +++ /dev/null @@ -1,466 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_MessagingCompose - - - - - - - - - - - v_MessagingCompose_ToolsMenu - - - - - - - - - - - v_ContactsReadOnly SUBGRAPH - - - - - - - - - - - v_KeyboardText SUBGRAPH - - - - - - - - - - - Stop - - - - - - - - - - - v_MessageEmpty - - - - - - - - - - - v_NoRecipient - - - - - - - - - - - v_SendFailed - - - - - - - - - - - v_SendingMessage - - - - - - - - - - - v_Dummy - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_TapInListStringTo - - - - - - - - - - - - - - - - e_TapInListStringText - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_Wait_5s - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - e_Wait_5s - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - BACKTRACK - - - - - - diff --git a/src/test/resources/graphml/test24/MessagingDrafts.graphml b/src/test/resources/graphml/test24/MessagingDrafts.graphml deleted file mode 100644 index 1ab48945..00000000 --- a/src/test/resources/graphml/test24/MessagingDrafts.graphml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_MessagingInbox MERGE - - - - - - - - - - - v_MessagingDrafts - - - - - - - - - - - v_MessagingSent MERGE - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - diff --git a/src/test/resources/graphml/test24/MessagingInbox.graphml b/src/test/resources/graphml/test24/MessagingInbox.graphml deleted file mode 100644 index 24980d58..00000000 --- a/src/test/resources/graphml/test24/MessagingInbox.graphml +++ /dev/null @@ -1,233 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_MessagingInbox - - - - - - - - - - - v_MessagingDrafts SUBGRAPH - - - - - - - - - - - v_MessagingSent SUBGRAPH - - - - - - - - - - - v_MessagingInbox_ToolsMenu - - - - - - - - - - - v_MessagingCompose SUBGRAPH - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - e_TapIcon_1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/graphml/test24/MessagingSent.graphml b/src/test/resources/graphml/test24/MessagingSent.graphml deleted file mode 100644 index 249a9191..00000000 --- a/src/test/resources/graphml/test24/MessagingSent.graphml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_MessagingInbox MERGE - - - - - - - - - - - v_MessagingSent - - - - - - - - - - - v_MessagingDrafts MERGE - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - e_SweepTabRight - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - diff --git a/src/test/resources/graphml/test24/NeoBrowser.graphml b/src/test/resources/graphml/test24/NeoBrowser.graphml deleted file mode 100644 index a4822855..00000000 --- a/src/test/resources/graphml/test24/NeoBrowser.graphml +++ /dev/null @@ -1,951 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_NeoBrowser - - - - - - - - - - - v_NeoBrowserToolsMenu_1 - - - - - - - - - - - v_URLEntered - - - - - - - - - - - v_NoPageToDisplay - - - - - - - - - - - v_QuitBrowser - - - - - - - - - - - v_InternetConnErr - - - - - - - - - - - v_EnterURL - - - - - - - - - - - v_SelectFontSize - - - - - - - - - - - v_Favorites - - - - - - - - - - - v_NeoBrowserToolsMenu_2 - - - - - - - - - - - v_NeoBrowserSettings - - - - - - - - - - - v_KeyboardText - - - - - - - - - - - v_SelectWWWAPN - - - - - - - - - - - v_NeoBrowserWin - - - - - - - - - - - v_NoInternetConnErr - - - - - - - - - - - Stop - - - - - - - - - - - v_BrowserStatusScreen - - - - - - - - - - - v_Dummy - - - - - - - - - - - v_Dummy - - - - - - - - - - - v_Dummy - - - - - - - - - - - v_Dummy - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_TapItem1 - - - - - - - - - - - - - - e_EnterValidURL - - - - - - - - - - - - - - - - e_TapIcon_3 - - - - - - - - - - - e_TapIcon_6 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_TapRandomListItem - - - - - - - - - - - - - - e_TapIcon_5 - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - - - e_SweepTabLeft - - - - - - - - - - - - - - - - e_TapIcon_5 - - - - - - - - - - - - - - - e_TapItem1 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_TapIcon_1 - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - - - e_TapItem1 - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - e_SweepShowKeyboard - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - e_EnterInvalidURL - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - e_SweepCloseApp - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - e_SweepCloseApp - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - e_TryTapRandomListItem BACKTRACK - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - diff --git a/src/test/resources/graphml/test24/Notes.graphml b/src/test/resources/graphml/test24/Notes.graphml deleted file mode 100644 index 8a45f8af..00000000 --- a/src/test/resources/graphml/test24/Notes.graphml +++ /dev/null @@ -1,440 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Notes - - - - - - - - - - - v_KeyboardText SUBGRAPH - - - - - - - - - - - v_NoteHasChanged - - - - - - - - - - - v_Notes_View - - - - - - - - - - - v_Notes_ToolsMenu - - - - - - - - - - - v_DeleteItems SUBGRAPH - - - - - - - - - - - Stop - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - - - - - - - - e_SweepCloseView weight=0.05 - - - - - - - - - - - - - - - - - - - - e_SweepCloseApp - - - - - - - - - - - - - - - - e_SweepAccept BACKTRACK - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_TapIcon_1 - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - e_TryTapListItemNotFirst BACKTRACK /* If note exists */ - - - - - - - - - - - - - - - - - - - - - - e_TapIcon_2 BACKTRACK /* If icon enabled */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_TapListItemFirst - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - e_SweepCloseView BLOCKED weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - BACKTRACK - - - - - - diff --git a/src/test/resources/graphml/test24/NumberToDial.graphml b/src/test/resources/graphml/test24/NumberToDial.graphml deleted file mode 100644 index 273f4634..00000000 --- a/src/test/resources/graphml/test24/NumberToDial.graphml +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_NumberToDial - - - - - - - - - - - Stop - - - - - - - - - - - v_PasteText - - - - - - - - - - - v_KeyboardToolsMenu SUBGRAPH - - - - - - - - - - - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - e_SweepShowKeyboard BACKTRACK /* If text exists in the clipboard. */ - - - - - - - - - - - - - - - - e_TryTapRandomListItem BACKTRACK - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - diff --git a/src/test/resources/graphml/test24/RunningApplications.graphml b/src/test/resources/graphml/test24/RunningApplications.graphml deleted file mode 100644 index 5492292d..00000000 --- a/src/test/resources/graphml/test24/RunningApplications.graphml +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_RunningApplications - - - - - - - - - - - v_RunningApplicationsToolMenu - - - - - - - - - - - v_RunningApplicationsSettings - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - e_SweepShowTools - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_TapIcon_1 - - - - - - - - - - - - - - e_TapIcon_5 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - e_TapItem1 - - - - - - - - - - - - - - - - e_TapIcon_3 BACKTRACK - - - - - - diff --git a/src/test/resources/graphml/test24/SendMessage.graphml b/src/test/resources/graphml/test24/SendMessage.graphml deleted file mode 100644 index bacc8f4e..00000000 --- a/src/test/resources/graphml/test24/SendMessage.graphml +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - v_MessagingCompose SUBGRAPH - - - - - - - - - - - - - v_KeyboardText SUBGRAPH - - - - - - - - - - - - - Stop - - - - - - - - - - - - - v_SendMessage. - - - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - BACKTRACK /* No text entered */ - - - - - - - - - - - - - - - - BACKTRACK /* Text entered */ - - - - - - - - diff --git a/src/test/resources/graphml/test24/SendPictureAsMMS.graphml b/src/test/resources/graphml/test24/SendPictureAsMMS.graphml deleted file mode 100644 index 119fa590..00000000 --- a/src/test/resources/graphml/test24/SendPictureAsMMS.graphml +++ /dev/null @@ -1,448 +0,0 @@ - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - v_SendPictureAsMMS - - - - - - - - - - - - - v_ConfirmResize - - - - - - - - - - - - - v_EditSlide - - - - - - - - - - - - - v_SaveSlideChanges - - - - - - - - - - - - - v_ComposeMMS MERGE - - - - - - - - - - - - - v_Slides - - - - - - - - - - - - - Stop - - - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - e_TapScreen - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - BACKTRACK /* Image resized */ - - - - - - - - diff --git a/src/test/resources/graphml/test24/SendVCard.graphml b/src/test/resources/graphml/test24/SendVCard.graphml deleted file mode 100644 index e1dbeb94..00000000 --- a/src/test/resources/graphml/test24/SendVCard.graphml +++ /dev/null @@ -1,589 +0,0 @@ - - - - - - - - - - - - - - - - - v_SendVCard - - - - - - - - - - - - - Start - - - - - - - - - - - - - Stop - - - - - - - - - - - - - v_MessagingInbox NO_MERGE - - - - - - - - - - - - - v_KeyboardNumeric SUBGRAPH - - - - - - - - - - - - - v_EditTo - - - - - - - - - - - - - v_NoRecipient - - - - - - - - - - - - - v_ContactsReadOnly - - - - - - - - - - - - - v_ContactTapToSelectNumber NO_MERGE - - - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - v_Dummy - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepShowKeyboard BACKTRACK /* Only contact has a number */ - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - e_SelectRandomListItem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - - - - - - - e_TapRandomListItem BACKTRACK /* Only allowed when there are numbers in the list */ - - - - - - - - - - - - - - - - e_TapScreen - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - - - - - - - - - BACKTRACK /* Recipient dose no exist */ - - - - - - - - - - - - - BACKTRACK /* Recipient exists */ - - - - - - - - - - - - - - - - e_TapScreen - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - diff --git a/src/test/resources/graphml/test24/SysFiles.graphml b/src/test/resources/graphml/test24/SysFiles.graphml deleted file mode 100644 index 0adaa6f2..00000000 --- a/src/test/resources/graphml/test24/SysFiles.graphml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - v_SysFiles - - - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - diff --git a/src/test/resources/graphml/test24/Tetris.graphml b/src/test/resources/graphml/test24/Tetris.graphml deleted file mode 100644 index 9fb3fec2..00000000 --- a/src/test/resources/graphml/test24/Tetris.graphml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - - - - - - - - - Start - - - - - - - - - - - - - v_Tetris - - - - - - - - - - - - - v_QuitTetris - - - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - e_SweepCloseView - - - - - - - - - - - - - - - - - - e_SweepAccept - - - - - - - - diff --git a/src/test/resources/graphml/test24/Time.graphml b/src/test/resources/graphml/test24/Time.graphml deleted file mode 100644 index 9b2b3d7f..00000000 --- a/src/test/resources/graphml/test24/Time.graphml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - Start - - - - - - - - - - - v_Time - - - - - - - - - - - Stop - - - - - - - - - - - - - - - - - - - - - - - - - e_PressRandomKey - - - - - - - - - - - - - - - - BACKTRACK - - - - - - - - - - - - - - - - e_SweepCloseApp weight=0.05 - - - - - - diff --git a/src/test/resources/graphml/weight/FSM.graphml b/src/test/resources/graphml/weight/FSM.graphml deleted file mode 100644 index bcbff1c7..00000000 --- a/src/test/resources/graphml/weight/FSM.graphml +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - - - - - - - - Start - - - - - - - - - - - - S2 - - - - - - - - - - - - S3 - - - - - - - - - - - - S4 - - - - - - - - - - - - S5 - - - - - - - - - - - - - - - S5_1_10 - - - - - - - - - - - - - - S2_1_100 - - - - - - - - - - - - S3_1_100 - - - - - - - - - - - - - - S5_3_80 -weight=0.8 - - - - - - - - - - - - S5_2_10 - - - - - - - - - - - - - - - S4_2_90 -weight=0.9 - - - - - - - - - - - - S4_1_10 -weight=0.1 - - - - - - - - - - - - Start_1_100 - - - - - - - - - - diff --git a/src/test/resources/lib/small_jar.jar b/src/test/resources/lib/small_jar.jar deleted file mode 100644 index 33562b6d..00000000 Binary files a/src/test/resources/lib/small_jar.jar and /dev/null differ diff --git a/src/test/resources/templates/junit.template b/src/test/resources/templates/junit.template deleted file mode 100644 index 80df344c..00000000 --- a/src/test/resources/templates/junit.template +++ /dev/null @@ -1,19 +0,0 @@ -HEADER<{{ -import junit.framework.TestCase; - -public class MyMBTJUnitTestCase extends TestCase { -}}>HEADER - - /** - * This method implements the {EDGE_VERTEX} '{LABEL}' - * {DESCRIPTION} - */ - public void {LABEL}() - { - log.info( "{EDGE_VERTEX}: {LABEL}" ); - throw new RuntimeException( "The {EDGE_VERTEX}: {LABEL} is not implemented yet!" ); - } - -FOOTER<{{ -} -}}>FOOTER diff --git a/src/test/resources/templates/perl.template b/src/test/resources/templates/perl.template deleted file mode 100644 index 401b77da..00000000 --- a/src/test/resources/templates/perl.template +++ /dev/null @@ -1,42 +0,0 @@ -HEADER<{{ -use strict; -use warnings; - -use SOAP::Lite; - -# Connect to the MBT web-service -my $MBTService = SOAP::Lite->service($ARGV[0]); - -# Load MBT with a new xml -my $arg = SOAP::Data->new(name => 'arg0', value => $ARGV[1]); -my $res = $MBTService->Load($arg); - -if ($res eq "false") { - die "Unable to reload MBT, check path to .xml file!\nRemember that the path is relative where mbt is launched."; -} - -# Walk the model -while ( $MBTService->HasNextStep() eq "true"){ - # Get next step from MBT - my $step = $MBTService->GetNextStep(); - if ($step ne '') { - # Run the step - eval( $step ) or die; - } -} -print "MBT Statistics: \n" . $MBTService->GetStatistics() . "\n"; - -}}>HEADER - -# -# This sub routine implements the {EDGE_VERTEX} '{LABEL}' -# -sub {LABEL}() -{ - print "{EDGE_VERTEX}: {LABEL}\n"; - die "The {EDGE_VERTEX}: {LABEL} is not implemented yet!"; -} - -FOOTER<{{ -return 1; -}}>FOOTER diff --git a/src/test/resources/templates/short.report b/src/test/resources/templates/short.report deleted file mode 100644 index 99d12772..00000000 --- a/src/test/resources/templates/short.report +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - 0 - 0 - 0 - 0 - 0 - - - - - -
- http://chart.apis.google.com/chart?chs=300x200&chxt=x,y&chxr=1,0,100|0,0,&chco=ff0000,00ff00,0000ff,000000,777777&chd=t:|||&cht=lc - Coverage - Edge Coverage
State Coverage
2-Edge Sequence Coverage
3-Edge Sequence Coverage
-
- - 1,0 - -
\ No newline at end of file diff --git a/src/test/resources/xml/ReachedVertex.xml b/src/test/resources/xml/ReachedVertex.xml deleted file mode 100644 index 0a3d64e2..00000000 --- a/src/test/resources/xml/ReachedVertex.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/bugs/Issue_10.xml b/src/test/resources/xml/bugs/Issue_10.xml deleted file mode 100644 index e30cd8b8..00000000 --- a/src/test/resources/xml/bugs/Issue_10.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/bugs/Issue_9.xml b/src/test/resources/xml/bugs/Issue_9.xml deleted file mode 100644 index 1475b1e2..00000000 --- a/src/test/resources/xml/bugs/Issue_9.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/javaExecutor.xml b/src/test/resources/xml/javaExecutor.xml deleted file mode 100644 index 03d67134..00000000 --- a/src/test/resources/xml/javaExecutor.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/mbt_setup.dtd b/src/test/resources/xml/mbt_setup.dtd deleted file mode 100644 index a19ef6d4..00000000 --- a/src/test/resources/xml/mbt_setup.dtd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/xml/multipleA.xml b/src/test/resources/xml/multipleA.xml deleted file mode 100644 index 9b589641..00000000 --- a/src/test/resources/xml/multipleA.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/multipleB.xml b/src/test/resources/xml/multipleB.xml deleted file mode 100644 index 474169d4..00000000 --- a/src/test/resources/xml/multipleB.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/org.graphwalker.EventDrivenModels.eventModel.xml b/src/test/resources/xml/org.graphwalker.EventDrivenModels.eventModel.xml deleted file mode 100644 index c392dbc6..00000000 --- a/src/test/resources/xml/org.graphwalker.EventDrivenModels.eventModel.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/org.graphwalker.EventDrivenModels.load2Models.1.xml b/src/test/resources/xml/org.graphwalker.EventDrivenModels.load2Models.1.xml deleted file mode 100644 index e8868975..00000000 --- a/src/test/resources/xml/org.graphwalker.EventDrivenModels.load2Models.1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/org.graphwalker.EventDrivenModels.load2Models.2.xml b/src/test/resources/xml/org.graphwalker.EventDrivenModels.load2Models.2.xml deleted file mode 100644 index ab157f74..00000000 --- a/src/test/resources/xml/org.graphwalker.EventDrivenModels.load2Models.2.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/org.graphwalker.EventDrivenModels.switchModels.A.xml b/src/test/resources/xml/org.graphwalker.EventDrivenModels.switchModels.A.xml deleted file mode 100644 index 33ba35dc..00000000 --- a/src/test/resources/xml/org.graphwalker.EventDrivenModels.switchModels.A.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/org.graphwalker.EventDrivenModels.switchModels.B.xml b/src/test/resources/xml/org.graphwalker.EventDrivenModels.switchModels.B.xml deleted file mode 100644 index 242ac72b..00000000 --- a/src/test/resources/xml/org.graphwalker.EventDrivenModels.switchModels.B.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/org.graphwalker.EventDrivenModels.switchModels.C.xml b/src/test/resources/xml/org.graphwalker.EventDrivenModels.switchModels.C.xml deleted file mode 100644 index 339d79c9..00000000 --- a/src/test/resources/xml/org.graphwalker.EventDrivenModels.switchModels.C.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/reqCoverage.xml b/src/test/resources/xml/reqCoverage.xml deleted file mode 100644 index 0f1e35b3..00000000 --- a/src/test/resources/xml/reqCoverage.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/src/test/resources/xml/reqtags/mbt_init.xml b/src/test/resources/xml/reqtags/mbt_init.xml deleted file mode 100644 index d1655a70..00000000 --- a/src/test/resources/xml/reqtags/mbt_init.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/reqtags/mbt_init10.xml b/src/test/resources/xml/reqtags/mbt_init10.xml deleted file mode 100644 index 2d3a1b2e..00000000 --- a/src/test/resources/xml/reqtags/mbt_init10.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/src/test/resources/xml/reqtags/mbt_init11.xml b/src/test/resources/xml/reqtags/mbt_init11.xml deleted file mode 100644 index b728718b..00000000 --- a/src/test/resources/xml/reqtags/mbt_init11.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/reqtags/mbt_init2.xml b/src/test/resources/xml/reqtags/mbt_init2.xml deleted file mode 100644 index 18716514..00000000 --- a/src/test/resources/xml/reqtags/mbt_init2.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/test/resources/xml/reqtags/mbt_init3.xml b/src/test/resources/xml/reqtags/mbt_init3.xml deleted file mode 100644 index 1bc55aba..00000000 --- a/src/test/resources/xml/reqtags/mbt_init3.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/src/test/resources/xml/reqtags/mbt_init4.xml b/src/test/resources/xml/reqtags/mbt_init4.xml deleted file mode 100644 index e6192683..00000000 --- a/src/test/resources/xml/reqtags/mbt_init4.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/reqtags/mbt_init5.xml b/src/test/resources/xml/reqtags/mbt_init5.xml deleted file mode 100644 index 1c7fed3f..00000000 --- a/src/test/resources/xml/reqtags/mbt_init5.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/reqtags/mbt_init6.xml b/src/test/resources/xml/reqtags/mbt_init6.xml deleted file mode 100644 index 9f8db291..00000000 --- a/src/test/resources/xml/reqtags/mbt_init6.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/test/resources/xml/reqtags/mbt_init7.xml b/src/test/resources/xml/reqtags/mbt_init7.xml deleted file mode 100644 index 9f8db291..00000000 --- a/src/test/resources/xml/reqtags/mbt_init7.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/test/resources/xml/reqtags/mbt_init8.xml b/src/test/resources/xml/reqtags/mbt_init8.xml deleted file mode 100644 index e2bac122..00000000 --- a/src/test/resources/xml/reqtags/mbt_init8.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/src/test/resources/xml/reqtags/mbt_init9.xml b/src/test/resources/xml/reqtags/mbt_init9.xml deleted file mode 100644 index 85be307d..00000000 --- a/src/test/resources/xml/reqtags/mbt_init9.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/src/test/resources/xml/switch/A.xml b/src/test/resources/xml/switch/A.xml deleted file mode 100644 index e323033b..00000000 --- a/src/test/resources/xml/switch/A.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/switch/B.xml b/src/test/resources/xml/switch/B.xml deleted file mode 100644 index 3b0481bf..00000000 --- a/src/test/resources/xml/switch/B.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/test/resources/xml/switch/C.xml b/src/test/resources/xml/switch/C.xml deleted file mode 100644 index e2b42960..00000000 --- a/src/test/resources/xml/switch/C.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - -