Skip to content

Commit cd6661e

Browse files
timis1timis1
andauthored
JAVA-100003 Removed apis from Kong
Co-authored-by: timis1 <noreplay@yahoo.com>
1 parent 718e199 commit cd6661e

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/kong/KongAdminAPILiveTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,17 @@ public void givenEndpoint_whenQueryStockPrice_thenPriceCorrect() {
5353

5454
@Test
5555
public void givenKongAdminAPI_whenAddAPI_thenAPIAccessibleViaKong() throws Exception {
56-
restTemplate.delete("http://localhost:8001/apis/stock-api");
56+
restTemplate.delete("http://localhost:8001/stock-api");
5757

5858
APIObject stockAPI = new APIObject("stock-api", "stock.api", "http://localhost:9090", "/");
5959
HttpEntity<APIObject> apiEntity = new HttpEntity<>(stockAPI);
60-
ResponseEntity<String> addAPIResp = restTemplate.postForEntity("http://localhost:8001/apis", apiEntity, String.class);
60+
ResponseEntity<String> addAPIResp = restTemplate.postForEntity("http://localhost:8001", apiEntity, String.class);
6161

6262
assertEquals(HttpStatus.CREATED, addAPIResp.getStatusCode());
6363

64-
addAPIResp = restTemplate.postForEntity("http://localhost:8001/apis", apiEntity, String.class);
64+
addAPIResp = restTemplate.postForEntity("http://localhost:8001", apiEntity, String.class);
6565
assertEquals(HttpStatus.CONFLICT, addAPIResp.getStatusCode());
66-
String apiListResp = restTemplate.getForObject("http://localhost:8001/apis/", String.class);
66+
String apiListResp = restTemplate.getForObject("http://localhost:8001/", String.class);
6767

6868
assertTrue(apiListResp.contains("stock-api"));
6969

@@ -94,17 +94,17 @@ public void givenKongAdminAPI_whenAddAPIConsumer_thenAdded() {
9494

9595
@Test
9696
public void givenAPI_whenEnableAuth_thenAnonymousDenied() throws Exception {
97-
String apiListResp = restTemplate.getForObject("http://localhost:8001/apis/", String.class);
97+
String apiListResp = restTemplate.getForObject("http://localhost:8001/", String.class);
9898
if (!apiListResp.contains("stock-api")) {
9999
givenKongAdminAPI_whenAddAPI_thenAPIAccessibleViaKong();
100100
}
101101

102102
PluginObject authPlugin = new PluginObject("key-auth");
103-
ResponseEntity<String> enableAuthResp = restTemplate.postForEntity("http://localhost:8001/apis/stock-api/plugins", new HttpEntity<>(authPlugin), String.class);
103+
ResponseEntity<String> enableAuthResp = restTemplate.postForEntity("http://localhost:8001/stock-api/plugins", new HttpEntity<>(authPlugin), String.class);
104104

105105
assertTrue(HttpStatus.CREATED == enableAuthResp.getStatusCode() || HttpStatus.CONFLICT == enableAuthResp.getStatusCode());
106106

107-
String pluginsResp = restTemplate.getForObject("http://localhost:8001/apis/stock-api/plugins", String.class);
107+
String pluginsResp = restTemplate.getForObject("http://localhost:8001/stock-api/plugins", String.class);
108108
assertTrue(pluginsResp.contains("key-auth"));
109109

110110
HttpHeaders headers = new HttpHeaders();
@@ -116,7 +116,7 @@ public void givenAPI_whenEnableAuth_thenAnonymousDenied() throws Exception {
116116

117117
@Test
118118
public void givenAPIAuthEnabled_whenAddKey_thenAccessAllowed() throws Exception {
119-
String apiListResp = restTemplate.getForObject("http://localhost:8001/apis/", String.class);
119+
String apiListResp = restTemplate.getForObject("http://localhost:8001/", String.class);
120120
if (!apiListResp.contains("stock-api")) {
121121
givenKongAdminAPI_whenAddAPI_thenAPIAccessibleViaKong();
122122
}
@@ -127,7 +127,7 @@ public void givenAPIAuthEnabled_whenAddKey_thenAccessAllowed() throws Exception
127127
}
128128

129129
PluginObject authPlugin = new PluginObject("key-auth");
130-
ResponseEntity<String> enableAuthResp = restTemplate.postForEntity("http://localhost:8001/apis/stock-api/plugins", new HttpEntity<>(authPlugin), String.class);
130+
ResponseEntity<String> enableAuthResp = restTemplate.postForEntity("http://localhost:8001/stock-api/plugins", new HttpEntity<>(authPlugin), String.class);
131131
assertTrue(HttpStatus.CREATED == enableAuthResp.getStatusCode() || HttpStatus.CONFLICT == enableAuthResp.getStatusCode());
132132

133133
final String consumerKey = "eugenp.pass";
@@ -154,14 +154,14 @@ public void givenAPIAuthEnabled_whenAddKey_thenAccessAllowed() throws Exception
154154
public void givenAdminAPIProxy_whenAddAPIViaProxy_thenAPIAdded() throws Exception {
155155
APIObject adminAPI = new APIObject("admin-api", "admin.api", "http://localhost:8001", "/admin-api");
156156
HttpEntity<APIObject> apiEntity = new HttpEntity<>(adminAPI);
157-
ResponseEntity<String> addAPIResp = restTemplate.postForEntity("http://localhost:8001/apis", apiEntity, String.class);
157+
ResponseEntity<String> addAPIResp = restTemplate.postForEntity("http://localhost:8001", apiEntity, String.class);
158158

159159
assertTrue(HttpStatus.CREATED == addAPIResp.getStatusCode() || HttpStatus.CONFLICT == addAPIResp.getStatusCode());
160160

161161
HttpHeaders headers = new HttpHeaders();
162162
headers.set("Host", "admin.api");
163163
APIObject baeldungAPI = new APIObject("baeldung-api", "baeldung.com", "http://ww.baeldung.com", "/");
164-
RequestEntity<APIObject> requestEntity = new RequestEntity<>(baeldungAPI, headers, HttpMethod.POST, new URI("http://localhost:8000/admin-api/apis"));
164+
RequestEntity<APIObject> requestEntity = new RequestEntity<>(baeldungAPI, headers, HttpMethod.POST, new URI("http://localhost:8000/admin-api"));
165165
addAPIResp = restTemplate.exchange(requestEntity, String.class);
166166

167167
assertTrue(HttpStatus.CREATED == addAPIResp.getStatusCode() || HttpStatus.CONFLICT == addAPIResp.getStatusCode());

spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/kong/KongLoadBalanceLiveTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void givenKongAdminAPI_whenAddAPI_thenAPIAccessibleViaKong() throws Excep
5555

5656
APIObject stockAPI = new APIObject("balanced-stock-api", "balanced.stock.api", "http://stock.api.service", "/");
5757
HttpEntity<APIObject> apiEntity = new HttpEntity<>(stockAPI);
58-
ResponseEntity<String> addAPIResp = restTemplate.postForEntity("http://localhost:8001/apis", apiEntity, String.class);
58+
ResponseEntity<String> addAPIResp = restTemplate.postForEntity("http://localhost:8001", apiEntity, String.class);
5959
assertTrue(HttpStatus.CREATED == addAPIResp.getStatusCode() || HttpStatus.CONFLICT == addAPIResp.getStatusCode());
6060

6161
HttpHeaders headers = new HttpHeaders();

0 commit comments

Comments
 (0)