diff options
author | jbion <joffrey.bion@amadeus.com> | 2017-05-25 06:03:13 +0200 |
---|---|---|
committer | jbion <joffrey.bion@amadeus.com> | 2017-05-25 06:03:13 +0200 |
commit | 6a80c19f3578e0ecfc9bfe97a3d3f5a3580470e7 (patch) | |
tree | fd69ceb0f3b4c844ceb71049ac2212c80128b36f /backend | |
parent | Rework integration tests with new client and API (diff) | |
download | seven-wonders-6a80c19f3578e0ecfc9bfe97a3d3f5a3580470e7.tar.gz seven-wonders-6a80c19f3578e0ecfc9bfe97a3d3f5a3580470e7.tar.bz2 seven-wonders-6a80c19f3578e0ecfc9bfe97a3d3f5a3580470e7.zip |
Re-order params and rename to Jackstomp
Diffstat (limited to 'backend')
-rw-r--r-- | backend/src/test/java/org/luxons/sevenwonders/SevenWondersTest.java | 10 | ||||
-rw-r--r-- | backend/src/test/java/org/luxons/sevenwonders/test/api/SevenWondersSession.java | 12 | ||||
-rw-r--r-- | backend/src/test/java/org/luxons/sevenwonders/test/client/JackstompClient.java (renamed from backend/src/test/java/org/luxons/sevenwonders/test/client/JsonStompClient.java) | 12 | ||||
-rw-r--r-- | backend/src/test/java/org/luxons/sevenwonders/test/client/JackstompSession.java (renamed from backend/src/test/java/org/luxons/sevenwonders/test/client/JsonStompSession.java) | 6 |
4 files changed, 20 insertions, 20 deletions
diff --git a/backend/src/test/java/org/luxons/sevenwonders/SevenWondersTest.java b/backend/src/test/java/org/luxons/sevenwonders/SevenWondersTest.java index bd120989..78d85ca4 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/SevenWondersTest.java +++ b/backend/src/test/java/org/luxons/sevenwonders/SevenWondersTest.java @@ -6,8 +6,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.luxons.sevenwonders.test.api.ApiLobby; import org.luxons.sevenwonders.test.api.SevenWondersSession; -import org.luxons.sevenwonders.test.client.JsonStompClient; -import org.luxons.sevenwonders.test.client.JsonStompSession; +import org.luxons.sevenwonders.test.client.JackstompClient; +import org.luxons.sevenwonders.test.client.JackstompSession; import org.springframework.boot.context.embedded.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; @@ -19,18 +19,18 @@ public class SevenWondersTest { private static final String WEBSOCKET_URI = "ws://localhost:%d/seven-wonders-websocket"; - private static JsonStompClient client; + private static JackstompClient client; @LocalServerPort private int randomServerPort; @BeforeClass public static void setUp() { - client = new JsonStompClient(); + client = new JackstompClient(); } private SevenWondersSession connectNewUser() throws Exception { - JsonStompSession session = client.connect(String.format(WEBSOCKET_URI, randomServerPort)); + JackstompSession session = client.connect(String.format(WEBSOCKET_URI, randomServerPort)); return new SevenWondersSession(session); } diff --git a/backend/src/test/java/org/luxons/sevenwonders/test/api/SevenWondersSession.java b/backend/src/test/java/org/luxons/sevenwonders/test/api/SevenWondersSession.java index 4f67c49f..ad8e41ba 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/test/api/SevenWondersSession.java +++ b/backend/src/test/java/org/luxons/sevenwonders/test/api/SevenWondersSession.java @@ -3,7 +3,7 @@ package org.luxons.sevenwonders.test.api; import org.luxons.sevenwonders.actions.ChooseNameAction; import org.luxons.sevenwonders.actions.CreateGameAction; import org.luxons.sevenwonders.actions.JoinGameAction; -import org.luxons.sevenwonders.test.client.JsonStompSession; +import org.luxons.sevenwonders.test.client.JackstompSession; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -11,9 +11,9 @@ import static org.junit.Assert.assertTrue; public class SevenWondersSession { - private final JsonStompSession session; + private final JackstompSession session; - public SevenWondersSession(JsonStompSession session) { + public SevenWondersSession(JackstompSession session) { this.session = session; } @@ -25,7 +25,7 @@ public class SevenWondersSession { ChooseNameAction action = new ChooseNameAction(); action.setPlayerName(displayName); - ApiPlayer player = session.request("/app/chooseName", action, "/user/queue/nameChoice", ApiPlayer.class); + ApiPlayer player = session.request(action, ApiPlayer.class, "/app/chooseName", "/user/queue/nameChoice"); assertNotNull(player); assertEquals(displayName, player.getDisplayName()); @@ -36,7 +36,7 @@ public class SevenWondersSession { CreateGameAction action = new CreateGameAction(); action.setGameName(gameName); - ApiLobby lobby = session.request("/app/lobby/create", action, "/user/queue/lobby/joined", ApiLobby.class); + ApiLobby lobby = session.request(action, ApiLobby.class, "/app/lobby/create", "/user/queue/lobby/joined"); assertNotNull(lobby); assertEquals(gameName, lobby.getName()); return lobby; @@ -46,7 +46,7 @@ public class SevenWondersSession { JoinGameAction action = new JoinGameAction(); action.setGameId(gameId); - ApiLobby lobby = session.request("/app/lobby/join", action, "/user/queue/lobby/joined", ApiLobby.class); + ApiLobby lobby = session.request(action, ApiLobby.class, "/app/lobby/join", "/user/queue/lobby/joined"); assertNotNull(lobby); assertEquals(gameId, lobby.getId()); return lobby; diff --git a/backend/src/test/java/org/luxons/sevenwonders/test/client/JsonStompClient.java b/backend/src/test/java/org/luxons/sevenwonders/test/client/JackstompClient.java index 1e9a5c3e..3388e002 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/test/client/JsonStompClient.java +++ b/backend/src/test/java/org/luxons/sevenwonders/test/client/JackstompClient.java @@ -16,17 +16,17 @@ import org.springframework.web.socket.sockjs.client.SockJsClient; import org.springframework.web.socket.sockjs.client.Transport; import org.springframework.web.socket.sockjs.client.WebSocketTransport; -public class JsonStompClient { +public class JackstompClient { private static final long DEFAULT_CONNECTION_TIMEOUT_IN_SECONDS = 15; private final WebSocketStompClient client; - public JsonStompClient() { + public JackstompClient() { this(createDefaultStompClient()); } - public JsonStompClient(WebSocketStompClient client) { + public JackstompClient(WebSocketStompClient client) { this.client = client; } @@ -51,15 +51,15 @@ public class JsonStompClient { return taskScheduler; } - public JsonStompSession connect(String url) throws InterruptedException, ExecutionException, TimeoutException { + public JackstompSession connect(String url) throws InterruptedException, ExecutionException, TimeoutException { return connect(url, DEFAULT_CONNECTION_TIMEOUT_IN_SECONDS, TimeUnit.SECONDS); } - public JsonStompSession connect(String url, long timeout, TimeUnit unit) + public JackstompSession connect(String url, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { StompSession session = client.connect(url, new LoggingStompSessionHandler()).get(timeout, unit); session.setAutoReceipt(true); - return new JsonStompSession(session); + return new JackstompSession(session); } public void stop() { diff --git a/backend/src/test/java/org/luxons/sevenwonders/test/client/JsonStompSession.java b/backend/src/test/java/org/luxons/sevenwonders/test/client/JackstompSession.java index d2ded856..6ab7fb7d 100644 --- a/backend/src/test/java/org/luxons/sevenwonders/test/client/JsonStompSession.java +++ b/backend/src/test/java/org/luxons/sevenwonders/test/client/JackstompSession.java @@ -7,11 +7,11 @@ import org.springframework.messaging.simp.stomp.StompFrameHandler; import org.springframework.messaging.simp.stomp.StompHeaders; import org.springframework.messaging.simp.stomp.StompSession; -public class JsonStompSession implements StompSession { +public class JackstompSession implements StompSession { private final StompSession stompSession; - public JsonStompSession(StompSession stompSession) { + public JackstompSession(StompSession stompSession) { this.stompSession = stompSession; } @@ -73,7 +73,7 @@ public class JsonStompSession implements StompSession { stompSession.disconnect(); } - public <T> T request(String requestDestination, Object payload, String responseDestination, Class<T> responseType) + public <T> T request(Object payload, Class<T> responseType, String requestDestination, String responseDestination) throws InterruptedException { Channel<T> channel = subscribe(responseDestination, responseType); send(requestDestination, payload); |