Compare commits
10 Commits
socket-1.1
...
socket-1.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 78b5926af1 | |||
| a3d2c2c07e | |||
| 9df812273c | |||
| e953c2e659 | |||
| 0f4fd6109d | |||
| 69a8fd2533 | |||
| 0b772ddeb3 | |||
| 55f13ae004 | |||
| 295075ca37 | |||
| 75bbba9884 |
@@ -7,7 +7,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
<groupId>net.bigeon.gclc</groupId>
|
<groupId>net.bigeon.gclc</groupId>
|
||||||
<artifactId>socket</artifactId>
|
<artifactId>socket</artifactId>
|
||||||
<version>1.1.14</version>
|
<version>1.1.16</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>GCLC Socket</name>
|
<name>GCLC Socket</name>
|
||||||
<description>Socket implementation of GCLC</description>
|
<description>Socket implementation of GCLC</description>
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
</developers>
|
</developers>
|
||||||
<scm>
|
<scm>
|
||||||
<developerConnection>scm:git:gogs@git.code.bigeon.net:emmanuel/gclc.git</developerConnection>
|
<developerConnection>scm:git:gogs@git.code.bigeon.net:emmanuel/gclc.git</developerConnection>
|
||||||
<tag>socket-1.1.14</tag>
|
<tag>socket-1.1.16</tag>
|
||||||
</scm>
|
</scm>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import java.io.BufferedReader;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.InterruptedIOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
@@ -119,6 +120,7 @@ public final class PluggableConsoleInput implements ConsoleInput {
|
|||||||
if (prompting) {
|
if (prompting) {
|
||||||
// print the hint, to indicate we are waiting for a user input.
|
// print the hint, to indicate we are waiting for a user input.
|
||||||
out.print(hint);
|
out.print(hint);
|
||||||
|
out.println();
|
||||||
out.flush();
|
out.flush();
|
||||||
}
|
}
|
||||||
final InputStreamReader streamReader = new InputStreamReader(stream,
|
final InputStreamReader streamReader = new InputStreamReader(stream,
|
||||||
@@ -279,7 +281,14 @@ public final class PluggableConsoleInput implements ConsoleInput {
|
|||||||
final long connexionTimeout) throws IOException, InterruptedException {
|
final long connexionTimeout) throws IOException, InterruptedException {
|
||||||
synchronized (connexionLock) {
|
synchronized (connexionLock) {
|
||||||
if (connected) {
|
if (connected) {
|
||||||
|
try {
|
||||||
return connexion.getNextMessage(messageTimeout);
|
return connexion.getNextMessage(messageTimeout);
|
||||||
|
} catch (final InterruptedIOException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (final IOException e) {
|
||||||
|
LOGGER.log(Level.INFO, "Communication was abrubptly interrupted", e);
|
||||||
|
disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
connexionLock.wait(connexionTimeout);
|
connexionLock.wait(connexionTimeout);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.bigeon.config</groupId>
|
<groupId>net.bigeon.config</groupId>
|
||||||
<artifactId>swt-config</artifactId>
|
<artifactId>swt-public-conf</artifactId>
|
||||||
<version>1.8.11</version>
|
<version>1.0.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>net.bigeon.gclc</groupId>
|
<groupId>net.bigeon.gclc</groupId>
|
||||||
<artifactId>swt</artifactId>
|
<artifactId>swt</artifactId>
|
||||||
<version>1.2.0-SNAPSHOT</version>
|
<version>1.2.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>GCLC swt</name>
|
<name>GCLC swt</name>
|
||||||
<description>A swt window for console applications</description>
|
<description>A swt window for console applications</description>
|
||||||
@@ -48,17 +48,17 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.bigeon</groupId>
|
<groupId>net.bigeon</groupId>
|
||||||
<artifactId>gclc</artifactId>
|
<artifactId>gclc</artifactId>
|
||||||
<version>2.0.12</version>
|
<version>2.1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.bigeon</groupId>
|
<groupId>net.bigeon</groupId>
|
||||||
<artifactId>collections</artifactId>
|
<artifactId>collections</artifactId>
|
||||||
<version>1.2.0</version>
|
<version>1.2.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<version>2.23.0</version>
|
<version>2.27.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
import net.bigeon.gclc.utils.PipedConsoleInput;
|
import net.bigeon.gclc.manager.PipedConsoleInput;
|
||||||
|
|
||||||
/** The object managing the console input.
|
/** The object managing the console input.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ package net.bigeon.gclc.swt;
|
|||||||
|
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
import net.bigeon.gclc.manager.PipedConsoleOutput;
|
||||||
import net.bigeon.gclc.swt.tools.ToSWTConsoleForwardRunnable;
|
import net.bigeon.gclc.swt.tools.ToSWTConsoleForwardRunnable;
|
||||||
import net.bigeon.gclc.utils.PipedConsoleOutput;
|
|
||||||
|
|
||||||
/** The manager for console output to insert in a text.
|
/** The manager for console output to insert in a text.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -77,8 +77,8 @@ import org.eclipse.swt.widgets.Composite;
|
|||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
import net.bigeon.gclc.utils.PipedConsoleInput;
|
import net.bigeon.gclc.manager.PipedConsoleInput;
|
||||||
import net.bigeon.gclc.utils.PipedConsoleOutput;
|
import net.bigeon.gclc.manager.PipedConsoleOutput;
|
||||||
|
|
||||||
/** A shell containing a {@link SWTConsoleView}
|
/** A shell containing a {@link SWTConsoleView}
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ import org.eclipse.swt.widgets.Composite;
|
|||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
import net.bigeon.gclc.ConsoleApplication;
|
import net.bigeon.gclc.ConsoleApplication;
|
||||||
import net.bigeon.gclc.utils.PipedConsoleInput;
|
import net.bigeon.gclc.manager.PipedConsoleInput;
|
||||||
import net.bigeon.gclc.utils.PipedConsoleOutput;
|
import net.bigeon.gclc.manager.PipedConsoleOutput;
|
||||||
|
|
||||||
/** A SWT component to connect to gclc {@link ConsoleApplication}.
|
/** A SWT component to connect to gclc {@link ConsoleApplication}.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ package net.bigeon.gclc.swt.tools;
|
|||||||
|
|
||||||
import org.eclipse.swt.widgets.Widget;
|
import org.eclipse.swt.widgets.Widget;
|
||||||
|
|
||||||
|
import net.bigeon.gclc.manager.PipedConsoleOutput;
|
||||||
|
import net.bigeon.gclc.manager.forwarding.AOutputForwardRunnable;
|
||||||
import net.bigeon.gclc.swt.ConsoleOutputDisplay;
|
import net.bigeon.gclc.swt.ConsoleOutputDisplay;
|
||||||
import net.bigeon.gclc.utils.AOutputForwardRunnable;
|
|
||||||
import net.bigeon.gclc.utils.PipedConsoleOutput;
|
|
||||||
|
|
||||||
/** The local implementation of the forwarding runnable.
|
/** The local implementation of the forwarding runnable.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -39,17 +39,14 @@ package net.bigeon.gclc.swt;
|
|||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
import static org.mockito.Mockito.doThrow;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import net.bigeon.gclc.utils.PipedConsoleInput;
|
import net.bigeon.gclc.manager.PipedConsoleInput;
|
||||||
|
|
||||||
/** @author Emmanuel Bigeon */
|
/** @author Emmanuel Bigeon */
|
||||||
public class ConsoleInputManagerTest {
|
public class ConsoleInputManagerTest {
|
||||||
|
|||||||
@@ -38,10 +38,7 @@ package net.bigeon.gclc.swt;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@@ -51,7 +48,7 @@ import org.junit.Test;
|
|||||||
import org.mockito.invocation.InvocationOnMock;
|
import org.mockito.invocation.InvocationOnMock;
|
||||||
import org.mockito.stubbing.Answer;
|
import org.mockito.stubbing.Answer;
|
||||||
|
|
||||||
import net.bigeon.gclc.utils.PipedConsoleOutput;
|
import net.bigeon.gclc.manager.PipedConsoleOutput;
|
||||||
|
|
||||||
/** @author Emmanuel Bigeon */
|
/** @author Emmanuel Bigeon */
|
||||||
public class ConsoleOutputManagerTest {
|
public class ConsoleOutputManagerTest {
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ import org.eclipse.swt.widgets.Composite;
|
|||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import net.bigeon.gclc.manager.PipedConsoleInput;
|
||||||
|
import net.bigeon.gclc.manager.PipedConsoleOutput;
|
||||||
|
|
||||||
/** @author Emmanuel Bigeon */
|
/** @author Emmanuel Bigeon */
|
||||||
public class SWTConsoleShellTest {
|
public class SWTConsoleShellTest {
|
||||||
|
|
||||||
@@ -61,7 +64,7 @@ public class SWTConsoleShellTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Test method for
|
/** Test method for
|
||||||
* {@link net.bigeon.gclc.swt.SWTConsole#connect(net.bigeon.gclc.utils.PipedConsoleInput, net.bigeon.gclc.utils.PipedConsoleOutput, java.io.BufferedReader)}. */
|
* {@link net.bigeon.gclc.swt.SWTConsole#connect(PipedConsoleInput, PipedConsoleOutput, java.io.BufferedReader)}. */
|
||||||
@Test
|
@Test
|
||||||
public void testConnect() {
|
public void testConnect() {
|
||||||
final SWTConsole console = new SWTConsole(new Shell(), SWT.NONE);
|
final SWTConsole console = new SWTConsole(new Shell(), SWT.NONE);
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ import org.eclipse.swt.SWT;
|
|||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import net.bigeon.gclc.manager.PipedConsoleInput;
|
||||||
|
import net.bigeon.gclc.manager.PipedConsoleOutput;
|
||||||
|
|
||||||
/** @author Emmanuel Bigeon */
|
/** @author Emmanuel Bigeon */
|
||||||
public class SWTConsoleViewTest {
|
public class SWTConsoleViewTest {
|
||||||
|
|
||||||
@@ -65,7 +68,7 @@ public class SWTConsoleViewTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Test method for
|
/** Test method for
|
||||||
* {@link net.bigeon.gclc.swt.SWTConsoleView#setManager(net.bigeon.gclc.utils.PipedConsoleOutput, net.bigeon.gclc.utils.PipedConsoleInput)}. */
|
* {@link net.bigeon.gclc.swt.SWTConsoleView#setManager(PipedConsoleOutput, PipedConsoleInput)}. */
|
||||||
@Test
|
@Test
|
||||||
public void testSetManager() {
|
public void testSetManager() {
|
||||||
final SWTConsoleView view = new SWTConsoleView(new Shell(), SWT.NONE);
|
final SWTConsoleView view = new SWTConsoleView(new Shell(), SWT.NONE);
|
||||||
|
|||||||
Reference in New Issue
Block a user