X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.tests.modelled%2Fsrc%2Forg%2Fsimantics%2Ftests%2Fmodelled%2Futils%2FModelledSTSTest.java;h=94ff2b6b6a4082a78dc5f006b0038d0b22999637;hp=6d9e4f4fece76c6cc9fe09e5e805735ff6c39206;hb=597687a4e41e9892a4b40e0de05183d930e6cc32;hpb=e3944c748c450a0760b9525e53e36b96180103b4 diff --git a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/utils/ModelledSTSTest.java b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/utils/ModelledSTSTest.java index 6d9e4f4fe..94ff2b6b6 100644 --- a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/utils/ModelledSTSTest.java +++ b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/utils/ModelledSTSTest.java @@ -8,7 +8,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.regex.Pattern; import org.simantics.scl.compiler.commands.CommandSession; import org.simantics.scl.compiler.commands.TestScriptExecutor; @@ -25,6 +24,7 @@ import org.simantics.scl.runtime.reporting.SCLReportingHandler; public class ModelledSTSTest { private final String name; + private final String parentName; private final String code; private final int priority; private final boolean ignored; @@ -34,8 +34,9 @@ public class ModelledSTSTest { private CombinedCoverage coverage; private Map variables; - ModelledSTSTest(String name, String code, int priority, boolean ignored, Set dependencies, Map variables) { + ModelledSTSTest(String name, String parentName, String code, int priority, boolean ignored, Set dependencies, Map variables) { this.name = name; + this.parentName = parentName; this.code = code; this.priority = priority; this.ignored = ignored; @@ -48,6 +49,10 @@ public class ModelledSTSTest { return name; } + public String getParentName() { + return parentName; + } + public String getCode() { return code; } @@ -95,6 +100,7 @@ public class ModelledSTSTest { public List run(List vars) throws IOException { ModuleRepository repo = new ModuleRepository(SCLOsgi.SOURCE_REPOSITORY); + CommandSession session = null; try { repo.setAdvisor(new ModuleCompilationOptionsAdvisor() { @@ -114,7 +120,7 @@ public class ModelledSTSTest { }); SCLReportingHandler handler = (SCLReportingHandler) SCLContext.getCurrent().get(SCLReportingHandler.REPORTING_HANDLER); - CommandSession session = new CommandSession(repo, handler); + session = new CommandSession(repo, handler); for (CommandSessionVariable var : vars) session.setVariable(var.getName(), var.getType(), var.getValue()); @@ -148,4 +154,65 @@ public class ModelledSTSTest { public boolean resolveDependency(String testDep) { return unresolvedDependencies.remove(testDep); } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((code == null) ? 0 : code.hashCode()); + result = prime * result + ((coverage == null) ? 0 : coverage.hashCode()); + result = prime * result + ((dependencies == null) ? 0 : dependencies.hashCode()); + result = prime * result + (ignored ? 1231 : 1237); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + priority; + result = prime * result + ((unresolvedDependencies == null) ? 0 : unresolvedDependencies.hashCode()); + result = prime * result + ((variables == null) ? 0 : variables.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ModelledSTSTest other = (ModelledSTSTest) obj; + if (code == null) { + if (other.code != null) + return false; + } else if (!code.equals(other.code)) + return false; + if (coverage == null) { + if (other.coverage != null) + return false; + } else if (!coverage.equals(other.coverage)) + return false; + if (dependencies == null) { + if (other.dependencies != null) + return false; + } else if (!dependencies.equals(other.dependencies)) + return false; + if (ignored != other.ignored) + return false; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + if (priority != other.priority) + return false; + if (unresolvedDependencies == null) { + if (other.unresolvedDependencies != null) + return false; + } else if (!unresolvedDependencies.equals(other.unresolvedDependencies)) + return false; + if (variables == null) { + if (other.variables != null) + return false; + } else if (!variables.equals(other.variables)) + return false; + return true; + } }