Skip to content

Commit 13a6e2c

Browse files
author
Bruce Eckel
committed
Put necessary files in packages
Also fixed a small compile bug (can't use static in @beforeeach)
1 parent 704bac0 commit 13a6e2c

10 files changed

+55
-3
lines changed

go.bat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
gradlew --no-daemon run > output.txt 2> errors.txt
1+
gradlew --parallel --daemon run > output.txt 2> errors.txt
2+
START /min "C:\Program Files\Windows Media Player\wmplayer.exe" %windir%\media\Alarm07.wav
23
rem find . -size 0 -type f

network/ChatterClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// {ValidateByHand}
66
// Tests the ChatterServer by starting multiple
77
// clients, each of which sends datagrams.
8+
package network;
89
import java.net.*;
910
import java.io.*;
1011
import onjava.*;

network/ChatterServer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// {ValidateByHand}
66
// A server that echoes datagrams
7+
package network;
78
import java.net.*;
89
import java.io.*;
910
import onjava.*;

network/Dgram.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// Converts between Strings and DataGramPackets
6+
package network;
67
import java.net.*;
78

89
public class Dgram {

network/MultiSimpleClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// Testing MultiSimpleServer with multiple clients.
66
// {ValidateByHand}
7+
package network;
78
import java.net.*;
89
import java.io.*;
910
import onjava.*;

network/MultiSimpleServer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// Uses threads to handle any number of clients.
66
// {ValidateByHand}
7+
package network;
78
import java.io.*;
89
import java.net.*;
910
import onjava.*;

network/SimpleClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Sends lines to the server and
66
// reads lines the server sends.
77
// {ValidateByHand}
8+
package network;
89
import java.net.*;
910
import java.io.*;
1011

network/SimpleServer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// Echoes what the client sends.
66
// {ValidateByHand}
7+
package network;
78
import java.io.*;
89
import java.net.*;
910

network/WhoAmI.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
// (c)2016 MindView LLC: see Copyright.txt
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
5-
// Finds out your machine name and network address
6-
// when you're connected to the Internet
5+
// Discovers your machine name and network address.
76
import java.net.*;
87

98
public class WhoAmI {

network/tests/SimpleTcpTests.java

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// network/tests/SimpleTcpTests.java
2+
// (c)2016 MindView LLC: see Copyright.txt
3+
// We make no guarantees that this code is fit for any purpose.
4+
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
5+
package network;
6+
import java.util.*;
7+
import java.util.stream.*;
8+
import org.junit.jupiter.api.*;
9+
import static org.junit.jupiter.api.Assertions.*;
10+
import onjava.*;
11+
12+
public class SimpleTcpTests {
13+
14+
@BeforeAll
15+
static void startMsg() {
16+
System.out.println(">>> Network Tests <<<");
17+
}
18+
19+
@BeforeEach
20+
void setupServer () { }
21+
22+
@Test
23+
void basicTest() throws Exception {
24+
SimpleServer server = new SimpleServer();
25+
SimpleClient client = new SimpleClient();
26+
client.main(null);
27+
assertTrue(false); // Fail until there are good assertions in the test
28+
}
29+
30+
@Test
31+
void multiTest() throws Exception {
32+
MultiSimpleClient client = new MultiSimpleClient();
33+
MultiSimpleServer server = new MultiSimpleServer();
34+
client.main(null);
35+
assertTrue(false); // Fail until there are good assertions in the test
36+
}
37+
38+
@Test
39+
void chatterTest() throws Exception {
40+
ChatterServer server = new ChatterServer();
41+
ChatterClient.main(null);
42+
assertTrue(false); // Fail until there are good assertions in the test
43+
}
44+
45+
}

0 commit comments

Comments
 (0)