Skip to content

Commit

Permalink
update test case to have base path
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehu committed Sep 18, 2016
1 parent 97e0886 commit b31315a
Showing 1 changed file with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,140 +79,140 @@ RoutingHandler getPetStoreHandler() {
RoutingHandler handler = Handlers.routing()


.add(Methods.POST, "/pet", new HttpHandler() {
.add(Methods.POST, "/v2/pet", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("addPet");
}
})


.add(Methods.DELETE, "/pet/{petId}", new HttpHandler() {
.add(Methods.DELETE, "/v2/pet/{petId}", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("deletePet");
}
})


.add(Methods.GET, "/pet/findByStatus", new HttpHandler() {
.add(Methods.GET, "/v2/pet/findByStatus", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("findPetsByStatus");
}
})


.add(Methods.GET, "/pet/findByTags", new HttpHandler() {
.add(Methods.GET, "/v2/pet/findByTags", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("findPetsByTags");
}
})


.add(Methods.GET, "/pet/{petId}", new HttpHandler() {
.add(Methods.GET, "/v2/pet/{petId}", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("getPetById");
}
})


.add(Methods.PUT, "/pet", new HttpHandler() {
.add(Methods.PUT, "/v2/pet", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("updatePet");
}
})


.add(Methods.POST, "/pet/{petId}", new HttpHandler() {
.add(Methods.POST, "/v2/pet/{petId}", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("updatePetWithForm");
}
})


.add(Methods.POST, "/pet/{petId}/uploadImage", new HttpHandler() {
.add(Methods.POST, "/v2/pet/{petId}/uploadImage", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("uploadFile");
}
})


.add(Methods.DELETE, "/store/order/{orderId}", new HttpHandler() {
.add(Methods.DELETE, "/v2/store/order/{orderId}", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("deleteOrder");
}
})


.add(Methods.GET, "/store/inventory", new HttpHandler() {
.add(Methods.GET, "/v2/store/inventory", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("getInventory");
}
})


.add(Methods.GET, "/store/order/{orderId}", new HttpHandler() {
.add(Methods.GET, "/v2/store/order/{orderId}", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("getOrderById");
}
})


.add(Methods.POST, "/store/order", new HttpHandler() {
.add(Methods.POST, "/v2/store/order", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("placeOrder");
}
})


.add(Methods.POST, "/user", new HttpHandler() {
.add(Methods.POST, "/v2/user", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("createUser");
}
})


.add(Methods.POST, "/user/createWithArray", new HttpHandler() {
.add(Methods.POST, "/v2/user/createWithArray", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("createUsersWithArrayInput");
}
})


.add(Methods.POST, "/user/createWithList", new HttpHandler() {
.add(Methods.POST, "/v2/user/createWithList", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("createUsersWithListInput");
}
})


.add(Methods.DELETE, "/user/{username}", new HttpHandler() {
.add(Methods.DELETE, "/v2/user/{username}", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("deleteUser");
}
})


.add(Methods.GET, "/user/{username}", new HttpHandler() {
.add(Methods.GET, "/v2/user/{username}", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("getUserByName");
}
})


.add(Methods.GET, "/user/login", new HttpHandler() {
.add(Methods.GET, "/v2/user/login", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("loginUser");
}
})


.add(Methods.GET, "/user/logout", new HttpHandler() {
.add(Methods.GET, "/v2/user/logout", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("logoutUser");
}
})


.add(Methods.PUT, "/user/{username}", new HttpHandler() {
.add(Methods.PUT, "/v2/user/{username}", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("updateUser");
}
Expand Down Expand Up @@ -247,7 +247,7 @@ public String handleResponse(final HttpResponse response) throws ClientProtocolE

@Test
public void testInvalidMethod() throws Exception {
String url = "http://localhost:8080/pet";
String url = "http://localhost:8080/v2/pet";
CloseableHttpClient client = Client.getInstance().getSyncClient();
HttpGet httpGet = new HttpGet(url);
ResponseHandler<String> responseHandler = new ResponseHandler<String>() {
Expand All @@ -269,7 +269,7 @@ public String handleResponse(final HttpResponse response) throws ClientProtocolE

@Test
public void testInvalidPost() throws Exception {
String url = "http://localhost:8080/pet";
String url = "http://localhost:8080/v2/pet";
CloseableHttpClient client = Client.getInstance().getSyncClient();
HttpPost httpPost = new HttpPost(url);
StringEntity entity = new StringEntity("{\"name\":\"Pinky\", \"photoUrl\": \"http://www.photo.com/1.jpg\"}");
Expand All @@ -285,7 +285,7 @@ public void testInvalidPost() throws Exception {

@Test
public void testValidPost() throws Exception {
String url = "http://localhost:8080/pet";
String url = "http://localhost:8080/v2/pet";
CloseableHttpClient client = Client.getInstance().getSyncClient();
HttpPost httpPost = new HttpPost(url);
StringEntity entity = new StringEntity("{\"id\":0,\"category\":{\"id\":0,\"name\":\"string\"},\"name\":\"doggie\",\"photoUrls\":[\"string\"],\"tags\":[{\"id\":0,\"name\":\"string\"}],\"status\":\"available\"}");
Expand Down

0 comments on commit b31315a

Please sign in to comment.