Skip to content

Commit

Permalink
Change test application path for one of the tests to avoid them all u…
Browse files Browse the repository at this point in the history
…sing "/services" which is kind of special for CXF being the location it uses for serving the html page that links to the wadl.
  • Loading branch information
asoldano committed Feb 17, 2016
1 parent e268b82 commit f7d3b94
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Expand Up @@ -79,11 +79,11 @@ public void testCustomerResource() throws Exception
+ "<country>USA</country>"
+ "</customer>";

Response response = client.target(baseURL + "services/customers").request().post(Entity.xml(xml));
Response response = client.target(baseURL + "myservices/customers").request().post(Entity.xml(xml));
if (response.getStatus() != 201)
throw new RuntimeException("Failed to create");
String location = response.getLocation().toString();
Assert.assertTrue(location.contains("jaxrs20-examples-ex03_1/services/customers/1"));
Assert.assertTrue(location.contains("jaxrs20-examples-ex03_1/myservices/customers/1"));
response.close();

String customer = client.target(location).request().get(String.class);
Expand Down
Expand Up @@ -77,7 +77,7 @@ public void testCustomerResource() throws Exception
+ "<country>USA</country>"
+ "</customer>";

URL postUrl = new URL(baseURL + "services/customers");
URL postUrl = new URL(baseURL + "myservices/customers");
HttpURLConnection connection = (HttpURLConnection) postUrl.openConnection();
connection.setDoOutput(true);
connection.setInstanceFollowRedirects(false);
Expand All @@ -87,11 +87,11 @@ public void testCustomerResource() throws Exception
os.write(newCustomer.getBytes());
os.flush();
Assert.assertEquals(HttpURLConnection.HTTP_CREATED, connection.getResponseCode());
Assert.assertTrue(connection.getHeaderField("Location").toString().contains("jaxrs-examples-ex03_1/services/customers/1"));
Assert.assertTrue(connection.getHeaderField("Location").toString().contains("jaxrs-examples-ex03_1/myservices/customers/1"));
connection.disconnect();

// Get the new customer
URL getUrl = new URL(baseURL + "services/customers/1");
URL getUrl = new URL(baseURL + "myservices/customers/1");
connection = (HttpURLConnection) getUrl.openConnection();
connection.setRequestMethod("GET");
Assert.assertTrue(connection.getContentType().contains("application/xml"));
Expand Down
Expand Up @@ -26,7 +26,7 @@
import java.util.HashSet;
import java.util.Set;

@ApplicationPath("/services")
@ApplicationPath("/myservices")
public class ShoppingApplication extends Application
{
private Set<Object> singletons = new HashSet<Object>();
Expand Down

0 comments on commit f7d3b94

Please sign in to comment.