Skip to content

Commit ad8d726

Browse files
committed
fix java-websocket dependency, and enable to run tests (though it fails)
1 parent 74839db commit ad8d726

File tree

5 files changed

+46
-10
lines changed

5 files changed

+46
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ target/
66
bin/
77
.externalToolBuilders/
88
.settings/
9+
node_modules/

pom.xml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77

88

99
<repositories>
10+
<repository>
11+
<id>sonatype-oss-public</id>
12+
<url>https://oss.sonatype.org/content/groups/public/</url>
13+
<releases>
14+
<enabled>true</enabled>
15+
</releases>
16+
<snapshots>
17+
<enabled>true</enabled>
18+
</snapshots>
19+
</repository>
1020
<repository>
1121
<releases>
1222
<enabled>true</enabled>
@@ -29,9 +39,9 @@
2939
</dependency>
3040

3141
<dependency>
32-
<groupId>org.java_websocket</groupId>
33-
<artifactId>WebSocket</artifactId>
34-
<version>1.0.0-SNAPSHOT</version>
42+
<groupId>org.java-websocket</groupId>
43+
<artifactId>Java-WebSocket</artifactId>
44+
<version>1.3.0-SNAPSHOT</version>
3545
</dependency>
3646

3747
<dependency>
@@ -41,8 +51,7 @@
4151
<type>jar</type>
4252
<scope>test</scope>
4353
</dependency>
44-
45-
54+
4655
</dependencies>
4756

4857

@@ -88,8 +97,18 @@
8897
<target>1.6</target>
8998
</configuration>
9099
</plugin>
100+
<plugin>
101+
<groupId>org.apache.maven.plugins</groupId>
102+
<artifactId>maven-surefire-plugin</artifactId>
103+
<version>2.14</version>
104+
<configuration>
105+
<includes>
106+
<include>**/AllTests.java</include>
107+
</includes>
108+
</configuration>
109+
</plugin>
91110

92-
111+
93112
<!-- DEPLOY -->
94113
<plugin>
95114
<groupId>org.apache.maven.plugins</groupId>
@@ -102,4 +121,4 @@
102121
</plugins>
103122
</build>
104123

105-
</project>
124+
</project>

src/test/java/io/socket/AbstractTestSocketIO.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import io.socket.testutils.MutateProxy;
1515

1616
import java.io.BufferedReader;
17+
import java.io.File;
1718
import java.io.IOException;
1819
import java.io.InputStreamReader;
1920
import java.util.Arrays;
@@ -40,7 +41,10 @@ public abstract class AbstractTestSocketIO implements IOCallback {
4041
private static final String REQUEST_ACKNOWLEDGE = "requestAcknowledge";
4142

4243
/** The Constant to the node executable */
43-
private final static String NODE = "/usr/local/bin/node";
44+
private final static String NODE = "node";
45+
private final static String NPM = "npm";
46+
47+
private final static File RESOURCES_DIR = new File("./src/test/resources");
4448

4549
/** The port of this test, randomly choosed */
4650
private int port = -1;
@@ -98,10 +102,15 @@ public void setUp() throws Exception {
98102
events = new LinkedBlockingQueue<String>();
99103
outputs = new LinkedBlockingQueue<String>();
100104
args = new LinkedBlockingQueue<Object>();
105+
106+
System.out.println("Installing socket.io ...");
107+
Runtime.getRuntime().exec(new String[] { NPM, "install" },
108+
null, RESOURCES_DIR).waitFor();
109+
101110
System.out.println("Connect with " + transport);
102111
node = Runtime.getRuntime().exec(
103-
new String[] { NODE, "./tests/io/socket/testutils/socketio.js",
104-
"" + getPort(), transport });
112+
new String[] { NODE, "socketio.js", "" + getPort(), transport },
113+
null, RESOURCES_DIR);
105114
proxy = new MutateProxy(getPort() + 1, getPort());
106115
proxy.start();
107116

src/test/resources/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "socket.io-java-client-test",
3+
"version": "0.0.0",
4+
"dependencies": {
5+
"socket.io": "0.9.14"
6+
}
7+
}

0 commit comments

Comments
 (0)