Permalink
Browse files

adding a failing test for #933

  • Loading branch information...
1 parent 4b96053 commit 614c5c40fe23518968289975090b20389159594c @peterneubauer committed Oct 19, 2012
View
63 server/src/functionaltest/java/org/neo4j/server/rest/BatchOperationFunctionalTest.java
@@ -28,6 +28,7 @@
import java.util.Map;
import org.json.JSONException;
+import org.junit.Ignore;
import org.junit.Test;
import org.neo4j.graphdb.Node;
import org.neo4j.kernel.impl.annotations.Documented;
@@ -222,6 +223,66 @@ public void shouldBeAbleToReferToCreatedResource() throws Exception {
// .expectedStatus( 200 ).get( getRelationshipIndexUri( "my_rels", "since", "2010")).entity();
// 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()
{
@@ -284,6 +345,8 @@ public void shouldForwardUnderlyingErrors() throws Exception {
assertTrue(((String)res.get("message")).startsWith("Invalid JSON array in POST body"));
}
+
+
@Test
public void shouldRollbackAllWhenGivenIncorrectRequest() throws JsonParseException, ClientHandlerException,
UniformInterfaceException, JSONException {

0 comments on commit 614c5c4

Please sign in to comment.