Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
Update to Jersey 1.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ept committed May 19, 2010
1 parent 7c3303c commit c9f2dbf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions pom.xml
Expand Up @@ -46,19 +46,19 @@
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.1.0-ea</version>
<version>1.1.5</version>
</dependency>

<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.1.0-ea</version>
<version>1.1.5</version>
</dependency>

<dependency>
<groupId>com.sun.jersey.test.framework</groupId>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-test-framework</artifactId>
<version>1.1.0-ea</version>
<version>1.1.5</version>
<scope>test</scope>
</dependency>

Expand Down
16 changes: 8 additions & 8 deletions src/test/java/com/eptcomputing/neo4j/rest/Neo4jResourceTest.java
Expand Up @@ -30,7 +30,7 @@ public Neo4jResourceTest() throws Exception {
* Helper which creates a new entity via the API, and returns its ID.
*/
private long createEntity(JSONObject entity) {
ClientResponse created = webResource.path("/neo_resource").type("application/json").
ClientResponse created = resource().path("/neo_resource").type("application/json").
post(ClientResponse.class, entity);
assertEquals(201, created.getStatus());
return Long.parseLong(created.getLocation().getPath().replaceAll(".*/", ""));
Expand All @@ -39,7 +39,7 @@ private long createEntity(JSONObject entity) {
@Test
public void testCreateEntity() throws JSONException {
long id = createEntity(new JSONObject().put("key", "value"));
JSONObject read = webResource.path(String.format("/neo_resource/%d", id)).get(JSONObject.class);
JSONObject read = resource().path(String.format("/neo_resource/%d", id)).get(JSONObject.class);
assertEquals("value", read.get("key"));
}

Expand All @@ -50,11 +50,11 @@ public void testUpdateProperties() throws JSONException {

// Delete one, update two, leave three unchanged, add four
JSONObject updated = new JSONObject().put("two", 22).put("three", 3).put("four", 4);
JSONObject readBack = webResource.path(String.format("/neo_resource/%d", id)).type("application/json").
JSONObject readBack = resource().path(String.format("/neo_resource/%d", id)).type("application/json").
put(JSONObject.class, updated);

// Also do a separate read, and make sure both have the right contents
JSONObject readSeparate = webResource.path(String.format("/neo_resource/%d", id)).get(JSONObject.class);
JSONObject readSeparate = resource().path(String.format("/neo_resource/%d", id)).get(JSONObject.class);
JSONObject[] reads = {readBack, readSeparate};
for (JSONObject read : reads) {
try {
Expand Down Expand Up @@ -91,11 +91,11 @@ public void testUpdateRelationships() throws JSONException {
).put("_out",
new JSONObject().put("ONE_TWO", one).put("TWO_THREE", new JSONArray().put(three).put(four))
);
JSONObject readBack = webResource.path(String.format("/neo_resource/%d", two)).type("application/json").
JSONObject readBack = resource().path(String.format("/neo_resource/%d", two)).type("application/json").
put(JSONObject.class, twoUpdate);

// Also do a separate read, and make sure both have the right contents
JSONObject readSeparate = webResource.path(String.format("/neo_resource/%d", two)).get(JSONObject.class);
JSONObject readSeparate = resource().path(String.format("/neo_resource/%d", two)).get(JSONObject.class);
JSONObject[] reads = {readBack, readSeparate};
for (JSONObject read : reads) {
JSONObject in = read.getJSONObject("_in");
Expand Down Expand Up @@ -127,10 +127,10 @@ public void testDeleteEntity() throws JSONException {
));

// Delete the first and check that it has gone
JSONObject response = webResource.path(String.format("/neo_resource/%d", id)).delete(JSONObject.class);
JSONObject response = resource().path(String.format("/neo_resource/%d", id)).delete(JSONObject.class);
assertEquals("value", response.get("key"));
try {
webResource.path(String.format("/neo_resource/%d", id)).get(JSONObject.class);
resource().path(String.format("/neo_resource/%d", id)).get(JSONObject.class);
fail("Accessing an entity after it has been deleted should return 404");
} catch (UniformInterfaceException e) {
assertEquals(404, e.getResponse().getStatus());
Expand Down

0 comments on commit c9f2dbf

Please sign in to comment.