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%2Fjunit%2FRuntimeSTSTestRunner.java;h=a30462d3f4725d769bee3deb0d3992bae10c81d2;hp=a80b84e750f7dbe413b255b5a2527d7dc49dc139;hb=b123fe92f27f72b9132ec52c9494fb8d8715d2ed;hpb=c125a1755cc7c4a6241c3c5bf841c3db0ff2d658 diff --git a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSTestRunner.java b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSTestRunner.java index a80b84e75..a30462d3f 100644 --- a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSTestRunner.java +++ b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSTestRunner.java @@ -1,69 +1,75 @@ -package org.simantics.tests.modelled.junit; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.StringReader; - -import org.junit.runner.Description; -import org.junit.runner.Runner; -import org.junit.runner.notification.RunNotifier; -import org.simantics.scl.compiler.commands.CommandSession; -import org.simantics.scl.compiler.commands.TestScriptExecutor; -import org.simantics.scl.osgi.SCLOsgi; -import org.simantics.scl.runtime.SCLContext; -import org.simantics.scl.runtime.reporting.SCLReportingHandler; - -public class RuntimeSTSTestRunner extends Runner { - - private final String name; - private final String code; - private final Integer priority; - private CommandSession session; - - public RuntimeSTSTestRunner(String name, String code, Integer priority) { - this.name = name; - this.code = code; - this.priority = priority; - } - - public void setCommandSession(CommandSession session) { - this.session = session; - } - - @Override - public Description getDescription() { - return Description.createTestDescription(RuntimeSTSTestRunner.class, name); - } - - @Override - public void run(RunNotifier notifier) { - StringReader reade = new StringReader(code); - BufferedReader reader = new BufferedReader(reade); - - SCLContext context = SCLContext.getCurrent(); - SCLReportingHandler printer = (SCLReportingHandler)context.get(SCLReportingHandler.REPORTING_HANDLER); - SCLReportingHandler handler; - if(printer instanceof SCLReportingHandler) - handler = (SCLReportingHandler)printer; - else - handler = SCLReportingHandler.DEFAULT; - - try { - if (session == null) - session = new CommandSession(SCLOsgi.MODULE_REPOSITORY, handler); - new TestScriptExecutor(session, reader, handler).execute(); - } catch (IOException e) { - throw new RuntimeException(e); - } finally { - try { - reader.close(); - } catch (IOException e) { - // Ignore - } - } - } - - public Integer getPriority() { - return priority; - } -} +package org.simantics.tests.modelled.junit; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.StringReader; + +import org.junit.runner.Description; +import org.junit.runner.Runner; +import org.junit.runner.notification.RunNotifier; +import org.simantics.scl.compiler.commands.CommandSession; +import org.simantics.scl.compiler.commands.TestScriptExecutor; +import org.simantics.scl.osgi.SCLOsgi; +import org.simantics.scl.runtime.SCLContext; +import org.simantics.scl.runtime.reporting.SCLReportingHandler; + +@Deprecated +public class RuntimeSTSTestRunner extends Runner { + + private final String name; + private final String code; + private final Integer priority; + private CommandSession session; + + public RuntimeSTSTestRunner(String name, String code, Integer priority) { + this.name = name; + this.code = code; + this.priority = priority; + } + + public void setCommandSession(CommandSession session) { + this.session = session; + } + + @Override + public Description getDescription() { + return Description.createTestDescription(RuntimeSTSTestRunner.class, name); + } + + @Override + public void run(RunNotifier notifier) { + StringReader reade = new StringReader(code); + BufferedReader reader = new BufferedReader(reade); + + SCLContext context = SCLContext.getCurrent(); + SCLReportingHandler printer = (SCLReportingHandler)context.get(SCLReportingHandler.REPORTING_HANDLER); + SCLReportingHandler handler; + if(printer instanceof SCLReportingHandler) + handler = (SCLReportingHandler)printer; + else + handler = SCLReportingHandler.DEFAULT; + + try { + if (session == null) + session = new CommandSession(SCLOsgi.MODULE_REPOSITORY, handler); + new TestScriptExecutor(session, reader, handler).execute(); + } catch (IOException e) { + throw new RuntimeException(e); + } finally { + try { + reader.close(); + } catch (IOException e) { + // Ignore + } + } + } + + public String getName() { + return name; + } + + public Integer getPriority() { + return priority; + } + +} \ No newline at end of file