Commit 519322dce4dc7c322793f24d996bccf028c1f1da
1 parent
22d6c284
Exists in
master
Externalização do endereço base dos serviços
Showing
2 changed files
with
50 additions
and
46 deletions
Show diff stats
archetype/html-rest/src/main/resources/archetype-resources/src/test/java/rest/BookmarkRESTTest.java
| @@ -15,8 +15,9 @@ import java.util.List; | @@ -15,8 +15,9 @@ import java.util.List; | ||
| 15 | import java.util.Set; | 15 | import java.util.Set; |
| 16 | 16 | ||
| 17 | import org.apache.commons.codec.binary.Base64; | 17 | import org.apache.commons.codec.binary.Base64; |
| 18 | +import org.apache.commons.configuration.Configuration; | ||
| 19 | +import org.apache.commons.configuration.PropertiesConfiguration; | ||
| 18 | import org.apache.http.HttpEntity; | 20 | import org.apache.http.HttpEntity; |
| 19 | -import org.apache.http.HttpHost; | ||
| 20 | import org.apache.http.client.ClientProtocolException; | 21 | import org.apache.http.client.ClientProtocolException; |
| 21 | import org.apache.http.client.entity.EntityBuilder; | 22 | import org.apache.http.client.entity.EntityBuilder; |
| 22 | import org.apache.http.client.methods.CloseableHttpResponse; | 23 | import org.apache.http.client.methods.CloseableHttpResponse; |
| @@ -38,19 +39,21 @@ import br.gov.frameworkdemoiselle.PreconditionFailedException; | @@ -38,19 +39,21 @@ import br.gov.frameworkdemoiselle.PreconditionFailedException; | ||
| 38 | 39 | ||
| 39 | public class BookmarkRESTTest { | 40 | public class BookmarkRESTTest { |
| 40 | 41 | ||
| 41 | - private HttpHost host; | ||
| 42 | - | ||
| 43 | private static final String BASIC_CREDENTIALS = "Basic " + Base64.encodeBase64String("admin:admin".getBytes()); | 42 | private static final String BASIC_CREDENTIALS = "Basic " + Base64.encodeBase64String("admin:admin".getBytes()); |
| 44 | 43 | ||
| 45 | private CloseableHttpClient client; | 44 | private CloseableHttpClient client; |
| 46 | 45 | ||
| 47 | private ObjectMapper mapper; | 46 | private ObjectMapper mapper; |
| 48 | 47 | ||
| 48 | + private String url; | ||
| 49 | + | ||
| 49 | @Before | 50 | @Before |
| 50 | - public void before() { | ||
| 51 | - host = new HttpHost("localhost", 8080, "http"); | 51 | + public void before() throws Exception { |
| 52 | client = HttpClientBuilder.create().build(); | 52 | client = HttpClientBuilder.create().build(); |
| 53 | mapper = new ObjectMapper(); | 53 | mapper = new ObjectMapper(); |
| 54 | + | ||
| 55 | + Configuration config = new PropertiesConfiguration("demoiselle.properties"); | ||
| 56 | + url = config.getString("services.url"); | ||
| 54 | } | 57 | } |
| 55 | 58 | ||
| 56 | @After | 59 | @After |
| @@ -63,8 +66,8 @@ public class BookmarkRESTTest { | @@ -63,8 +66,8 @@ public class BookmarkRESTTest { | ||
| 63 | HttpGet request; | 66 | HttpGet request; |
| 64 | CloseableHttpResponse response; | 67 | CloseableHttpResponse response; |
| 65 | 68 | ||
| 66 | - request = new HttpGet("/a15/api/bookmark"); | ||
| 67 | - response = client.execute(host, request); | 69 | + request = new HttpGet(url + "/bookmark"); |
| 70 | + response = client.execute(request); | ||
| 68 | response.close(); | 71 | response.close(); |
| 69 | List<Bookmark> listAll = mapper.readValue(response.getEntity().getContent(), | 72 | List<Bookmark> listAll = mapper.readValue(response.getEntity().getContent(), |
| 70 | new TypeReference<List<Bookmark>>() { | 73 | new TypeReference<List<Bookmark>>() { |
| @@ -72,8 +75,8 @@ public class BookmarkRESTTest { | @@ -72,8 +75,8 @@ public class BookmarkRESTTest { | ||
| 72 | assertEquals(SC_OK, response.getStatusLine().getStatusCode()); | 75 | assertEquals(SC_OK, response.getStatusLine().getStatusCode()); |
| 73 | 76 | ||
| 74 | String filter = "po"; | 77 | String filter = "po"; |
| 75 | - request = new HttpGet("/a15/api/bookmark?q=" + filter); | ||
| 76 | - response = client.execute(host, request); | 78 | + request = new HttpGet(url + "/bookmark?q=" + filter); |
| 79 | + response = client.execute(request); | ||
| 77 | response.close(); | 80 | response.close(); |
| 78 | List<Bookmark> filteredList = mapper.readValue(response.getEntity().getContent(), | 81 | List<Bookmark> filteredList = mapper.readValue(response.getEntity().getContent(), |
| 79 | new TypeReference<List<Bookmark>>() { | 82 | new TypeReference<List<Bookmark>>() { |
| @@ -91,8 +94,8 @@ public class BookmarkRESTTest { | @@ -91,8 +94,8 @@ public class BookmarkRESTTest { | ||
| 91 | public void loadSuccessful() throws Exception { | 94 | public void loadSuccessful() throws Exception { |
| 92 | Long id = parseEntity(createSample().getEntity(), Long.class); | 95 | Long id = parseEntity(createSample().getEntity(), Long.class); |
| 93 | 96 | ||
| 94 | - HttpGet request = new HttpGet("/a15/api/bookmark/" + id); | ||
| 95 | - CloseableHttpResponse response = client.execute(host, request); | 97 | + HttpGet request = new HttpGet(url + "/bookmark/" + id); |
| 98 | + CloseableHttpResponse response = client.execute(request); | ||
| 96 | response.close(); | 99 | response.close(); |
| 97 | assertEquals(SC_OK, response.getStatusLine().getStatusCode()); | 100 | assertEquals(SC_OK, response.getStatusLine().getStatusCode()); |
| 98 | 101 | ||
| @@ -106,8 +109,8 @@ public class BookmarkRESTTest { | @@ -106,8 +109,8 @@ public class BookmarkRESTTest { | ||
| 106 | 109 | ||
| 107 | @Test | 110 | @Test |
| 108 | public void loadFailed() throws ClientProtocolException, IOException { | 111 | public void loadFailed() throws ClientProtocolException, IOException { |
| 109 | - HttpGet get = new HttpGet("/a15/api/bookmark/99999999"); | ||
| 110 | - CloseableHttpResponse response = client.execute(host, get); | 112 | + HttpGet request = new HttpGet(url + "/bookmark/99999999"); |
| 113 | + CloseableHttpResponse response = client.execute(request); | ||
| 111 | response.close(); | 114 | response.close(); |
| 112 | assertEquals(SC_NOT_FOUND, response.getStatusLine().getStatusCode()); | 115 | assertEquals(SC_NOT_FOUND, response.getStatusLine().getStatusCode()); |
| 113 | } | 116 | } |
| @@ -116,9 +119,9 @@ public class BookmarkRESTTest { | @@ -116,9 +119,9 @@ public class BookmarkRESTTest { | ||
| 116 | public void deleteSuccessful() throws Exception { | 119 | public void deleteSuccessful() throws Exception { |
| 117 | Long id = parseEntity(createSample().getEntity(), Long.class); | 120 | Long id = parseEntity(createSample().getEntity(), Long.class); |
| 118 | 121 | ||
| 119 | - HttpDelete request = new HttpDelete("/a15/api/bookmark/" + id); | 122 | + HttpDelete request = new HttpDelete(url + "/bookmark/" + id); |
| 120 | request.addHeader("Authorization", BASIC_CREDENTIALS); | 123 | request.addHeader("Authorization", BASIC_CREDENTIALS); |
| 121 | - CloseableHttpResponse response = client.execute(host, request); | 124 | + CloseableHttpResponse response = client.execute(request); |
| 122 | response.close(); | 125 | response.close(); |
| 123 | assertEquals(SC_NO_CONTENT, response.getStatusLine().getStatusCode()); | 126 | assertEquals(SC_NO_CONTENT, response.getStatusLine().getStatusCode()); |
| 124 | } | 127 | } |
| @@ -129,15 +132,15 @@ public class BookmarkRESTTest { | @@ -129,15 +132,15 @@ public class BookmarkRESTTest { | ||
| 129 | CloseableHttpResponse response; | 132 | CloseableHttpResponse response; |
| 130 | 133 | ||
| 131 | Long id = parseEntity(createSample().getEntity(), Long.class); | 134 | Long id = parseEntity(createSample().getEntity(), Long.class); |
| 132 | - request = new HttpDelete("/a15/api/bookmark/" + id); | ||
| 133 | - response = client.execute(host, request); | 135 | + request = new HttpDelete(url + "/bookmark/" + id); |
| 136 | + response = client.execute(request); | ||
| 134 | response.close(); | 137 | response.close(); |
| 135 | assertEquals(SC_UNAUTHORIZED, response.getStatusLine().getStatusCode()); | 138 | assertEquals(SC_UNAUTHORIZED, response.getStatusLine().getStatusCode()); |
| 136 | destroySample(id); | 139 | destroySample(id); |
| 137 | 140 | ||
| 138 | - request = new HttpDelete("/a15/api/bookmark/99999999"); | 141 | + request = new HttpDelete(url + "/bookmark/99999999"); |
| 139 | request.addHeader("Authorization", BASIC_CREDENTIALS); | 142 | request.addHeader("Authorization", BASIC_CREDENTIALS); |
| 140 | - response = client.execute(host, request); | 143 | + response = client.execute(request); |
| 141 | response.close(); | 144 | response.close(); |
| 142 | assertEquals(SC_NOT_FOUND, response.getStatusLine().getStatusCode()); | 145 | assertEquals(SC_NOT_FOUND, response.getStatusLine().getStatusCode()); |
| 143 | } | 146 | } |
| @@ -150,12 +153,12 @@ public class BookmarkRESTTest { | @@ -150,12 +153,12 @@ public class BookmarkRESTTest { | ||
| 150 | Long id = parseEntity(response.getEntity(), Long.class); | 153 | Long id = parseEntity(response.getEntity(), Long.class); |
| 151 | assertNotNull(id); | 154 | assertNotNull(id); |
| 152 | 155 | ||
| 153 | - String expectedLocation = host.toString() + "/a15/api/bookmark/" + id; | 156 | + String expectedLocation = url + "/bookmark/" + id; |
| 154 | String returnedLocation = response.getHeaders("Location")[0].getValue(); | 157 | String returnedLocation = response.getHeaders("Location")[0].getValue(); |
| 155 | assertEquals(expectedLocation, returnedLocation); | 158 | assertEquals(expectedLocation, returnedLocation); |
| 156 | 159 | ||
| 157 | HttpGet request = new HttpGet(returnedLocation); | 160 | HttpGet request = new HttpGet(returnedLocation); |
| 158 | - response = client.execute(host, request); | 161 | + response = client.execute(request); |
| 159 | response.close(); | 162 | response.close(); |
| 160 | 163 | ||
| 161 | destroySample(id); | 164 | destroySample(id); |
| @@ -172,19 +175,19 @@ public class BookmarkRESTTest { | @@ -172,19 +175,19 @@ public class BookmarkRESTTest { | ||
| 172 | bookmark = new Bookmark(); | 175 | bookmark = new Bookmark(); |
| 173 | bookmark.setDescription("Google"); | 176 | bookmark.setDescription("Google"); |
| 174 | bookmark.setLink("http://google.com"); | 177 | bookmark.setLink("http://google.com"); |
| 175 | - request = new HttpPost("/a15/api/bookmark"); | 178 | + request = new HttpPost(url + "/bookmark"); |
| 176 | request.setEntity(createEntity(bookmark)); | 179 | request.setEntity(createEntity(bookmark)); |
| 177 | request.addHeader("Content-Type", "application/json"); | 180 | request.addHeader("Content-Type", "application/json"); |
| 178 | - response = client.execute(host, request); | 181 | + response = client.execute(request); |
| 179 | response.close(); | 182 | response.close(); |
| 180 | assertEquals(SC_UNAUTHORIZED, response.getStatusLine().getStatusCode()); | 183 | assertEquals(SC_UNAUTHORIZED, response.getStatusLine().getStatusCode()); |
| 181 | 184 | ||
| 182 | bookmark = new Bookmark(); | 185 | bookmark = new Bookmark(); |
| 183 | - request = new HttpPost("/a15/api/bookmark"); | 186 | + request = new HttpPost(url + "/bookmark"); |
| 184 | request.setEntity(createEntity(bookmark)); | 187 | request.setEntity(createEntity(bookmark)); |
| 185 | request.addHeader("Content-Type", "application/json"); | 188 | request.addHeader("Content-Type", "application/json"); |
| 186 | request.addHeader("Authorization", BASIC_CREDENTIALS); | 189 | request.addHeader("Authorization", BASIC_CREDENTIALS); |
| 187 | - response = client.execute(host, request); | 190 | + response = client.execute(request); |
| 188 | response.close(); | 191 | response.close(); |
| 189 | assertEquals(SC_PRECONDITION_FAILED, response.getStatusLine().getStatusCode()); | 192 | assertEquals(SC_PRECONDITION_FAILED, response.getStatusLine().getStatusCode()); |
| 190 | violations = mapper.readValue(response.getEntity().getContent(), | 193 | violations = mapper.readValue(response.getEntity().getContent(), |
| @@ -198,11 +201,11 @@ public class BookmarkRESTTest { | @@ -198,11 +201,11 @@ public class BookmarkRESTTest { | ||
| 198 | bookmark = new Bookmark(); | 201 | bookmark = new Bookmark(); |
| 199 | bookmark.setDescription("Google"); | 202 | bookmark.setDescription("Google"); |
| 200 | bookmark.setLink("http: // google . com"); | 203 | bookmark.setLink("http: // google . com"); |
| 201 | - request = new HttpPost("/a15/api/bookmark"); | 204 | + request = new HttpPost(url + "/bookmark"); |
| 202 | request.setEntity(createEntity(bookmark)); | 205 | request.setEntity(createEntity(bookmark)); |
| 203 | request.addHeader("Content-Type", "application/json"); | 206 | request.addHeader("Content-Type", "application/json"); |
| 204 | request.addHeader("Authorization", BASIC_CREDENTIALS); | 207 | request.addHeader("Authorization", BASIC_CREDENTIALS); |
| 205 | - response = client.execute(host, request); | 208 | + response = client.execute(request); |
| 206 | response.close(); | 209 | response.close(); |
| 207 | assertEquals(SC_PRECONDITION_FAILED, response.getStatusLine().getStatusCode()); | 210 | assertEquals(SC_PRECONDITION_FAILED, response.getStatusLine().getStatusCode()); |
| 208 | violations = mapper.readValue(response.getEntity().getContent(), | 211 | violations = mapper.readValue(response.getEntity().getContent(), |
| @@ -215,11 +218,11 @@ public class BookmarkRESTTest { | @@ -215,11 +218,11 @@ public class BookmarkRESTTest { | ||
| 215 | bookmark.setId(Long.valueOf(123456789)); | 218 | bookmark.setId(Long.valueOf(123456789)); |
| 216 | bookmark.setDescription("Test"); | 219 | bookmark.setDescription("Test"); |
| 217 | bookmark.setLink("http://test.com"); | 220 | bookmark.setLink("http://test.com"); |
| 218 | - request = new HttpPost("/a15/api/bookmark"); | 221 | + request = new HttpPost(url + "/bookmark"); |
| 219 | request.setEntity(createEntity(bookmark)); | 222 | request.setEntity(createEntity(bookmark)); |
| 220 | request.addHeader("Content-Type", "application/json"); | 223 | request.addHeader("Content-Type", "application/json"); |
| 221 | request.addHeader("Authorization", BASIC_CREDENTIALS); | 224 | request.addHeader("Authorization", BASIC_CREDENTIALS); |
| 222 | - response = client.execute(host, request); | 225 | + response = client.execute(request); |
| 223 | response.close(); | 226 | response.close(); |
| 224 | assertEquals(SC_BAD_REQUEST, response.getStatusLine().getStatusCode()); | 227 | assertEquals(SC_BAD_REQUEST, response.getStatusLine().getStatusCode()); |
| 225 | } | 228 | } |
| @@ -235,18 +238,18 @@ public class BookmarkRESTTest { | @@ -235,18 +238,18 @@ public class BookmarkRESTTest { | ||
| 235 | bookmark.setLink("http://maps.google.com"); | 238 | bookmark.setLink("http://maps.google.com"); |
| 236 | 239 | ||
| 237 | Long id = parseEntity(response.getEntity(), Long.class); | 240 | Long id = parseEntity(response.getEntity(), Long.class); |
| 238 | - String url = "/a15/api/bookmark/" + id; | 241 | + String resourceUrl = url + "/bookmark/" + id; |
| 239 | 242 | ||
| 240 | - request = new HttpPut(url); | 243 | + request = new HttpPut(resourceUrl); |
| 241 | ((HttpPut) request).setEntity(createEntity(bookmark)); | 244 | ((HttpPut) request).setEntity(createEntity(bookmark)); |
| 242 | request.addHeader("Content-Type", "application/json"); | 245 | request.addHeader("Content-Type", "application/json"); |
| 243 | request.addHeader("Authorization", BASIC_CREDENTIALS); | 246 | request.addHeader("Authorization", BASIC_CREDENTIALS); |
| 244 | - response = client.execute(host, request); | 247 | + response = client.execute(request); |
| 245 | response.close(); | 248 | response.close(); |
| 246 | assertEquals(SC_NO_CONTENT, response.getStatusLine().getStatusCode()); | 249 | assertEquals(SC_NO_CONTENT, response.getStatusLine().getStatusCode()); |
| 247 | 250 | ||
| 248 | - request = new HttpGet(url); | ||
| 249 | - response = client.execute(host, request); | 251 | + request = new HttpGet(resourceUrl); |
| 252 | + response = client.execute(request); | ||
| 250 | response.close(); | 253 | response.close(); |
| 251 | Bookmark result = parseEntity(response.getEntity(), Bookmark.class); | 254 | Bookmark result = parseEntity(response.getEntity(), Bookmark.class); |
| 252 | assertEquals(id, result.getId()); | 255 | assertEquals(id, result.getId()); |
| @@ -269,19 +272,19 @@ public class BookmarkRESTTest { | @@ -269,19 +272,19 @@ public class BookmarkRESTTest { | ||
| 269 | bookmark = new Bookmark(); | 272 | bookmark = new Bookmark(); |
| 270 | bookmark.setDescription("Google"); | 273 | bookmark.setDescription("Google"); |
| 271 | bookmark.setLink("http://google.com"); | 274 | bookmark.setLink("http://google.com"); |
| 272 | - request = new HttpPut("/a15/api/bookmark/" + id); | 275 | + request = new HttpPut(url + "/bookmark/" + id); |
| 273 | request.setEntity(createEntity(bookmark)); | 276 | request.setEntity(createEntity(bookmark)); |
| 274 | request.addHeader("Content-Type", "application/json"); | 277 | request.addHeader("Content-Type", "application/json"); |
| 275 | - response = client.execute(host, request); | 278 | + response = client.execute(request); |
| 276 | response.close(); | 279 | response.close(); |
| 277 | assertEquals(SC_UNAUTHORIZED, response.getStatusLine().getStatusCode()); | 280 | assertEquals(SC_UNAUTHORIZED, response.getStatusLine().getStatusCode()); |
| 278 | 281 | ||
| 279 | bookmark = new Bookmark(); | 282 | bookmark = new Bookmark(); |
| 280 | - request = new HttpPut("/a15/api/bookmark/" + id); | 283 | + request = new HttpPut(url + "/bookmark/" + id); |
| 281 | request.setEntity(createEntity(bookmark)); | 284 | request.setEntity(createEntity(bookmark)); |
| 282 | request.addHeader("Content-Type", "application/json"); | 285 | request.addHeader("Content-Type", "application/json"); |
| 283 | request.addHeader("Authorization", BASIC_CREDENTIALS); | 286 | request.addHeader("Authorization", BASIC_CREDENTIALS); |
| 284 | - response = client.execute(host, request); | 287 | + response = client.execute(request); |
| 285 | response.close(); | 288 | response.close(); |
| 286 | assertEquals(SC_PRECONDITION_FAILED, response.getStatusLine().getStatusCode()); | 289 | assertEquals(SC_PRECONDITION_FAILED, response.getStatusLine().getStatusCode()); |
| 287 | violations = mapper.readValue(response.getEntity().getContent(), | 290 | violations = mapper.readValue(response.getEntity().getContent(), |
| @@ -295,11 +298,11 @@ public class BookmarkRESTTest { | @@ -295,11 +298,11 @@ public class BookmarkRESTTest { | ||
| 295 | bookmark = new Bookmark(); | 298 | bookmark = new Bookmark(); |
| 296 | bookmark.setDescription("Google"); | 299 | bookmark.setDescription("Google"); |
| 297 | bookmark.setLink("http: // google . com"); | 300 | bookmark.setLink("http: // google . com"); |
| 298 | - request = new HttpPut("/a15/api/bookmark/" + id); | 301 | + request = new HttpPut(url + "/bookmark/" + id); |
| 299 | request.setEntity(createEntity(bookmark)); | 302 | request.setEntity(createEntity(bookmark)); |
| 300 | request.addHeader("Content-Type", "application/json"); | 303 | request.addHeader("Content-Type", "application/json"); |
| 301 | request.addHeader("Authorization", BASIC_CREDENTIALS); | 304 | request.addHeader("Authorization", BASIC_CREDENTIALS); |
| 302 | - response = client.execute(host, request); | 305 | + response = client.execute(request); |
| 303 | response.close(); | 306 | response.close(); |
| 304 | assertEquals(SC_PRECONDITION_FAILED, response.getStatusLine().getStatusCode()); | 307 | assertEquals(SC_PRECONDITION_FAILED, response.getStatusLine().getStatusCode()); |
| 305 | violations = mapper.readValue(response.getEntity().getContent(), | 308 | violations = mapper.readValue(response.getEntity().getContent(), |
| @@ -312,11 +315,11 @@ public class BookmarkRESTTest { | @@ -312,11 +315,11 @@ public class BookmarkRESTTest { | ||
| 312 | bookmark.setId(Long.valueOf(123456789)); | 315 | bookmark.setId(Long.valueOf(123456789)); |
| 313 | bookmark.setDescription("Test"); | 316 | bookmark.setDescription("Test"); |
| 314 | bookmark.setLink("http://test.com"); | 317 | bookmark.setLink("http://test.com"); |
| 315 | - request = new HttpPut("/a15/api/bookmark/" + id); | 318 | + request = new HttpPut(url + "/bookmark/" + id); |
| 316 | request.setEntity(createEntity(bookmark)); | 319 | request.setEntity(createEntity(bookmark)); |
| 317 | request.addHeader("Content-Type", "application/json"); | 320 | request.addHeader("Content-Type", "application/json"); |
| 318 | request.addHeader("Authorization", BASIC_CREDENTIALS); | 321 | request.addHeader("Authorization", BASIC_CREDENTIALS); |
| 319 | - response = client.execute(host, request); | 322 | + response = client.execute(request); |
| 320 | response.close(); | 323 | response.close(); |
| 321 | assertEquals(SC_BAD_REQUEST, response.getStatusLine().getStatusCode()); | 324 | assertEquals(SC_BAD_REQUEST, response.getStatusLine().getStatusCode()); |
| 322 | 325 | ||
| @@ -328,21 +331,21 @@ public class BookmarkRESTTest { | @@ -328,21 +331,21 @@ public class BookmarkRESTTest { | ||
| 328 | bookmark.setDescription("Google"); | 331 | bookmark.setDescription("Google"); |
| 329 | bookmark.setLink("http://google.com"); | 332 | bookmark.setLink("http://google.com"); |
| 330 | 333 | ||
| 331 | - HttpPost request = new HttpPost("/a15/api/bookmark"); | 334 | + HttpPost request = new HttpPost(url + "/bookmark"); |
| 332 | request.setEntity(EntityBuilder.create().setText(mapper.writeValueAsString(bookmark)).build()); | 335 | request.setEntity(EntityBuilder.create().setText(mapper.writeValueAsString(bookmark)).build()); |
| 333 | request.addHeader("Content-Type", "application/json"); | 336 | request.addHeader("Content-Type", "application/json"); |
| 334 | request.addHeader("Authorization", BASIC_CREDENTIALS); | 337 | request.addHeader("Authorization", BASIC_CREDENTIALS); |
| 335 | 338 | ||
| 336 | - CloseableHttpResponse response = client.execute(host, request); | 339 | + CloseableHttpResponse response = client.execute(request); |
| 337 | response.close(); | 340 | response.close(); |
| 338 | 341 | ||
| 339 | return response; | 342 | return response; |
| 340 | } | 343 | } |
| 341 | 344 | ||
| 342 | private void destroySample(Long id) throws Exception { | 345 | private void destroySample(Long id) throws Exception { |
| 343 | - HttpDelete request = new HttpDelete("/a15/api/bookmark/" + id); | 346 | + HttpDelete request = new HttpDelete(url + "/bookmark/" + id); |
| 344 | request.addHeader("Authorization", BASIC_CREDENTIALS); | 347 | request.addHeader("Authorization", BASIC_CREDENTIALS); |
| 345 | - client.execute(host, request).close(); | 348 | + client.execute(request).close(); |
| 346 | } | 349 | } |
| 347 | 350 | ||
| 348 | private <T> T parseEntity(HttpEntity entity, Class<T> type) throws Exception { | 351 | private <T> T parseEntity(HttpEntity entity, Class<T> type) throws Exception { |
archetype/html-rest/src/main/resources/archetype-resources/src/test/resources/demoiselle.properties
0 → 100644
| @@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
| 1 | +services.url=http://localhost:8080/${artifactId}/api |