Skip to content

Commit

Permalink
adding a failing test for #933
Browse files Browse the repository at this point in the history
  • Loading branch information
peterneubauer committed Oct 19, 2012
1 parent 4b96053 commit 614c5c4
Showing 1 changed file with 63 additions and 0 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.Map; import java.util.Map;


import org.json.JSONException; import org.json.JSONException;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.neo4j.graphdb.Node; import org.neo4j.graphdb.Node;
import org.neo4j.kernel.impl.annotations.Documented; import org.neo4j.kernel.impl.annotations.Documented;
Expand Down Expand Up @@ -222,6 +223,66 @@ public void shouldBeAbleToReferToCreatedResource() throws Exception {
// .expectedStatus( 200 ).get( getRelationshipIndexUri( "my_rels", "since", "2010")).entity(); // .expectedStatus( 200 ).get( getRelationshipIndexUri( "my_rels", "since", "2010")).entity();
// assertEquals(1, JsonHelper.jsonToList( rels ).size()); // assertEquals(1, JsonHelper.jsonToList( rels ).size());
} }

@Test
@Ignore
public void shouldBeAbleToUniqueIndexing() throws Exception {
String jsonString = new PrettyJSON()
.array()
.object()
.key("method") .value("POST")
.key("to") .value("/index/node/People?unique")
.key("id") .value(0)
.key("body")
.object()
.key("key").value("name")
.key("value").value("Alice")
.key( "properties" )
.object()
.key( "name" ).value( "Alice" )
.endObject()
.endObject()
.endObject()
.object()
.key("method") .value("POST")
.key("to") .value("/index/node/People?unique")
.key("id") .value(1)
.key("body")
.object()
.key("key").value("name")
.key("value").value("Bob")
.key( "properties" )
.object()
.key( "name" ).value( "Bob" )
.endObject()
.endObject()
.endObject()
.object()
.key("method") .value("POST")
.key("to") .value("{0}/relationships")
.key("id") .value(2)
.key("body")
.object()
.key("type").value("KNOWS")
.key("to").value("{1}")
.key( "data" )
.object()
.key( "since" ).value( "1999" )
.endObject()
.endObject()
.endObject()
.endArray().toString();

String entity = gen.get()
.expectedStatus( 200 )
.payload( jsonString )
.post( batchUri() )
.entity();

List<Map<String, Object>> results = JsonHelper.jsonToList(entity);

assertEquals(3, results.size());
}


private String batchUri() private String batchUri()
{ {
Expand Down Expand Up @@ -284,6 +345,8 @@ public void shouldForwardUnderlyingErrors() throws Exception {
assertTrue(((String)res.get("message")).startsWith("Invalid JSON array in POST body")); assertTrue(((String)res.get("message")).startsWith("Invalid JSON array in POST body"));
} }




@Test @Test
public void shouldRollbackAllWhenGivenIncorrectRequest() throws JsonParseException, ClientHandlerException, public void shouldRollbackAllWhenGivenIncorrectRequest() throws JsonParseException, ClientHandlerException,
UniformInterfaceException, JSONException { UniformInterfaceException, JSONException {
Expand Down

0 comments on commit 614c5c4

Please sign in to comment.