diff --git a/de.prob.core/src/de/prob/core/IServerConnection.java b/de.prob.core/src/de/prob/core/IServerConnection.java deleted file mode 100644 index 5b7dc30444cfc344f2a5c36be818110047fa76ba..0000000000000000000000000000000000000000 --- a/de.prob.core/src/de/prob/core/IServerConnection.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, Heinrich - * Heine Universitaet Duesseldorf This software is licenced under EPL 1.0 - * (http://www.eclipse.org/org/documents/epl-v10.html) - * */ - -package de.prob.core; - -import java.io.File; - -import de.prob.cli.CliException; -import de.prob.exceptions.ProBException; - -/** - * This interface can be used to mock up a connection to ProB for testing. Don't - * use this in productive code. - * - * An example of such a mock is - * - * <pre> - * IServerConnection mock = EasyMock.createMock(IServerConnection.class); - * mock.startup(); - * EasyMock.expect(mock.sendCommand(COMMAND)).andReturn( - * ProBResultParser.parse(EXPECTED_ANSWER)); - * GetErrorsHelper.expectGetErrors(mock); - * EasyMock.replay(mock); - * Animator animator = new AnimatorImpl(mock); - * EasyMock.verify(mock); - * // [ ... Assertions ...] - * </pre> - * - * @author Jens Bendisposto - * - */ -public interface IServerConnection { - - public abstract int getCliPortNumber(); - - public abstract String sendCommand(final String commandString) - throws ProBException; - - public abstract void shutdown(); - - public abstract void startup(File file) throws CliException; - - void sendUserInterruptSignal(); -} \ No newline at end of file diff --git a/de.prob.core/src/de/prob/core/internal/AnimatorImpl.java b/de.prob.core/src/de/prob/core/internal/AnimatorImpl.java index a14f54bd05f6dbac1a55a8327ff09f04fbff1e52..00ced65cbf0e2cea5f19e7d77413e0de83d0d1b6 100644 --- a/de.prob.core/src/de/prob/core/internal/AnimatorImpl.java +++ b/de.prob.core/src/de/prob/core/internal/AnimatorImpl.java @@ -11,7 +11,6 @@ import java.util.List; import java.util.Map; import de.prob.cli.CliException; -import de.prob.core.IServerConnection; import de.prob.core.LanguageDependendAnimationPart; import de.prob.core.ProblemHandler; import de.prob.core.command.CommandException; @@ -38,7 +37,7 @@ public class AnimatorImpl { private final History history = new History(); - private IServerConnection connector; + private ServerConnection connector; private MachineDescription description; @@ -46,8 +45,7 @@ public class AnimatorImpl { private LanguageDependendAnimationPart langdep; - public AnimatorImpl(final IServerConnection serverConnection, - final File file) { + public AnimatorImpl(final ServerConnection serverConnection, final File file) { this.file = file; setConnector(serverConnection); } @@ -92,8 +90,7 @@ public class AnimatorImpl { return history; } - private synchronized void setConnector( - final IServerConnection serverConnection) { + private synchronized void setConnector(final ServerConnection serverConnection) { this.connector = serverConnection; try { connector.startup(file); diff --git a/de.prob.core/src/de/prob/core/internal/ServerConnection.java b/de.prob.core/src/de/prob/core/internal/ServerConnection.java index a9c9c43f7277a3491f78a8d95b7ec6e315e1add9..5488c452ef929bf51d05d5279a84cd041498d525 100644 --- a/de.prob.core/src/de/prob/core/internal/ServerConnection.java +++ b/de.prob.core/src/de/prob/core/internal/ServerConnection.java @@ -16,13 +16,11 @@ import java.nio.charset.Charset; import de.prob.cli.CliException; import de.prob.cli.CliStarter; -import de.prob.core.IServerConnection; import de.prob.core.ProblemHandler; import de.prob.exceptions.ProBException; import de.prob.logging.Logger; -public class ServerConnection implements IServerConnection { - +public class ServerConnection { private Socket socket = null; private BufferedInputStream inputStream = null; private PrintStream outputStream = null; @@ -66,7 +64,6 @@ public class ServerConnection implements IServerConnection { } } - @Override public String sendCommand(final String commandString) throws ProBException { if (shutdown) { final String message = "probcli is currently shutting down"; @@ -156,7 +153,6 @@ public class ServerConnection implements IServerConnection { return result.length() > 0 ? result.toString() : null; } - @Override public void startup(final File file) throws CliException { if (shutdown) { startcli(file); @@ -168,7 +164,6 @@ public class ServerConnection implements IServerConnection { } } - @Override public void shutdown() { if (!shutdown) { if (socket != null) { @@ -195,12 +190,10 @@ public class ServerConnection implements IServerConnection { } } - @Override public int getCliPortNumber() { return cli.getPort(); } - @Override public void sendUserInterruptSignal() { if (cli != null) { cli.sendUserInterruptReference();