Esempio n. 1
0
        public virtual void CreateAUniqueRelationshipOrReturnFail__Create()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String index = indexes.newInstance();
            string index = _indexes.newInstance();
            string key   = "name";
            string value = "Tobias";

            _helper.createRelationshipIndex(index);
            ResponseEntity response = GenConflict.get().expectedStatus(201).payloadType(MediaType.APPLICATION_JSON_TYPE).payload("{\"key\": \"" + key + "\", \"value\": \"" + value + "\", \"start\": \"" + _functionalTestHelper.nodeUri(_helper.createNode()) + "\", \"end\": \"" + _functionalTestHelper.nodeUri(_helper.createNode()) + "\", \"type\":\"" + MyRelationshipTypes.Knows + "\"}").post(_functionalTestHelper.relationshipIndexUri() + index + "?uniqueness=create_or_fail");
            MultivaluedMap <string, string> headers = response.Response().Headers;
            IDictionary <string, object>    result  = JsonHelper.jsonToMap(response.Entity());

            assertEquals(result["indexed"], headers.getFirst("Location"));
        }
Esempio n. 2
0
        public virtual void Streaming()
        {
            Data.get();
            ResponseEntity responseEntity = Gen().withHeader(Org.Neo4j.Server.rest.repr.StreamingFormat_Fields.STREAM_HEADER, "true").expectedType(APPLICATION_JSON_TYPE).expectedStatus(200).get(DataUri);
            JaxRsResponse  response       = responseEntity.Response();
            // this gets the full media type, including things like
            // ; stream=true at the end
            string foundMediaType    = response.Type.ToString();
            string expectedMediaType = Org.Neo4j.Server.rest.repr.StreamingFormat_Fields.MediaType.ToString();

            assertEquals(expectedMediaType, foundMediaType);

            string body = responseEntity.Entity();
            IDictionary <string, object> map = JsonHelper.jsonToMap(body);

            assertEquals(DataUri + "node", map["node"]);
        }