Esempio n. 1
0
        /// <summary>
        /// /db/data/index/relationship should be a resource with no content
        /// </summary>
        /// <exception cref="Exception"> </exception>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRespondWithRelationshipIndexes() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRespondWithRelationshipIndexes()
        {
            JaxRsResponse response = RestRequest.Req().get(_functionalTestHelper.relationshipIndexUri());

            AssertResponseContainsNoIndexesOtherThanAutoIndexes(response);
            response.Close();
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturn404WhenPropertiesSentToANodeWhichDoesNotExist()
        public virtual void ShouldReturn404WhenPropertiesSentToANodeWhichDoesNotExist()
        {
            JaxRsResponse response = RestRequest.Req().delete(GetPropertiesUri(999999));

            assertEquals(404, response.Status);
            response.Close();
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRespondWith404WhenGettingOutgoingRelationshipsForNonExistingNode()
        public virtual void ShouldRespondWith404WhenGettingOutgoingRelationshipsForNonExistingNode()
        {
            JaxRsResponse response = SendRetrieveRequestToServer(_nonExistingNode, "/out");

            assertEquals(404, response.Status);
            response.Close();
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGet404ForNoProperty()
        public virtual void ShouldGet404ForNoProperty()
        {
            JaxRsResponse response = RestRequest.Req().get(GetPropertyUri("baz"));

            assertEquals(404, response.Status);
            response.Close();
        }
Esempio n. 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRespondWith404WhenGettingIncomingRelationshipsForNonExistingNodeStreaming()
        public virtual void ShouldRespondWith404WhenGettingIncomingRelationshipsForNonExistingNodeStreaming()
        {
            JaxRsResponse response = RestRequest.Req().header(StreamingJsonFormat.STREAM_HEADER, "true").get(_functionalTestHelper.nodeUri() + "/" + _nonExistingNode + "/relationships" + "/in");

            assertEquals(404, response.Status);
            response.Close();
        }
Esempio n. 6
0
        /// <summary>
        /// /db/data/index is not itself a resource
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRespondWith404ForNonResourceIndexPath()
        public virtual void ShouldRespondWith404ForNonResourceIndexPath()
        {
            JaxRsResponse response = RestRequest.Req().get(_functionalTestHelper.indexUri());

            assertEquals(404, response.Status);
            response.Close();
        }
Esempio n. 7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetContentLengthHeaderWhenRetrievingNode()
        public virtual void ShouldGetContentLengthHeaderWhenRetrievingNode()
        {
            JaxRsResponse response = RetrieveNodeFromService(_nodeUri.ToString());

            assertNotNull(response.Headers.get("Content-Length"));
            response.Close();
        }
Esempio n. 8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetSomeRelationships()
        public virtual void ShouldGetSomeRelationships()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final RestRequest request = RestRequest.req();
            RestRequest   request  = RestRequest.Req();
            JaxRsResponse response = request.Get(_functionalTestHelper.relationshipsUri(_thomasAnderson, RelationshipDirection.all.name(), "KNOWS"), MediaType.TEXT_HTML_TYPE);

            assertEquals(Status.OK.StatusCode, response.Status);
            string entity = response.Entity;

            assertTrue(entity.Contains("KNOWS"));
            assertFalse(entity.Contains("LOVES"));
            AssertValidHtml(entity);
            response.Close();

            response = request.Get(_functionalTestHelper.relationshipsUri(_thomasAnderson, RelationshipDirection.all.name(), "LOVES"), MediaType.TEXT_HTML_TYPE);

            entity = response.Entity;
            assertFalse(entity.Contains("KNOWS"));
            assertTrue(entity.Contains("LOVES"));
            AssertValidHtml(entity);
            response.Close();

            response = request.Get(_functionalTestHelper.relationshipsUri(_thomasAnderson, RelationshipDirection.all.name(), "LOVES", "KNOWS"), MediaType.TEXT_HTML_TYPE);
            entity   = response.Entity;
            assertTrue(entity.Contains("KNOWS"));
            assertTrue(entity.Contains("LOVES"));
            AssertValidHtml(entity);
            response.Close();
        }
Esempio n. 9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGet404ForPropertiesOnNonExistentRelationship()
        public virtual void ShouldGet404ForPropertiesOnNonExistentRelationship()
        {
            JaxRsResponse response = RestRequest.Req().get(_functionalTestHelper.dataUri() + "relationship/999999/properties");

            assertEquals(404, response.Status);
            response.Close();
        }
Esempio n. 10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetContentLengthHeaderWhenRetrievingDiscoveryDocument()
        public virtual void ShouldGetContentLengthHeaderWhenRetrievingDiscoveryDocument()
        {
            JaxRsResponse response = DiscoveryDocument;

            assertNotNull(response.Headers.get("Content-Length"));
            response.Close();
        }
Esempio n. 11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRespondWith200WhenRetrievingDiscoveryDocument()
        public virtual void ShouldRespondWith200WhenRetrievingDiscoveryDocument()
        {
            JaxRsResponse response = DiscoveryDocument;

            assertEquals(200, response.Status);
            response.Close();
        }
Esempio n. 12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturn404WhenPropertySentToANodeWhichDoesNotExist()
        public virtual void ShouldReturn404WhenPropertySentToANodeWhichDoesNotExist()
        {
            JaxRsResponse response = RestRequest.Req().put(_badUri.ToString() + "/foo", JsonHelper.createJsonFrom("bar"));

            assertEquals(404, response.Status);
            response.Close();
        }
Esempio n. 13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturn400WhenSendingCorruptJsonProperties()
        public virtual void ShouldReturn400WhenSendingCorruptJsonProperties()
        {
            JaxRsResponse response = RestRequest.Req().put(_propertiesUri.ToString(), "this:::Is::notJSON}");

            assertEquals(400, response.Status);
            response.Close();
        }
Esempio n. 14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturn400WhenSendinIncompatibleJsonProperty()
        public virtual void ShouldReturn400WhenSendinIncompatibleJsonProperty()
        {
            JaxRsResponse response = SetPropertyOnServer("jim", new Dictionary <string, object>());

            assertEquals(400, response.Status);
            response.Close();
        }
Esempio n. 15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturn400WhenSendingCorruptJsonProperty()
        public virtual void ShouldReturn400WhenSendingCorruptJsonProperty()
        {
            JaxRsResponse response = RestRequest.Req().put(GetPropertyUri("foo"), "this:::Is::notJSON}");

            assertEquals(400, response.Status);
            response.Close();
        }
Esempio n. 16
0
        public virtual void ShouldGet200ForProperties()
        {
            string        entity         = JsonHelper.createJsonFrom(Collections.singletonMap("foo", "bar"));
            JaxRsResponse createResponse = _req.post(_functionalTestHelper.dataUri() + "node/", entity);

            GenConflict.get().expectedStatus(200).get(createResponse.Location.ToString() + "/properties");
        }
Esempio n. 17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturn204WhenPropertyIsSet()
        public virtual void ShouldReturn204WhenPropertyIsSet()
        {
            JaxRsResponse response = SetPropertyOnServer("foo", "bar");

            assertEquals(204, response.Status);
            response.Close();
        }
Esempio n. 18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHaveJsonMediaTypeWhenRetrievingDiscoveryDocument()
        public virtual void ShouldHaveJsonMediaTypeWhenRetrievingDiscoveryDocument()
        {
            JaxRsResponse response = DiscoveryDocument;

            assertThat(response.Type.ToString(), containsString(APPLICATION_JSON));
            response.Close();
        }
Esempio n. 19
0
        /// <summary>
        /// POST ${org.neo4j.server.rest.web}/index/relationship {
        /// "name":"index-name" "config":{ // optional map of index configuration
        /// params "key1":"value1", "key2":"value2" } }
        ///
        /// POST ${org.neo4j.server.rest.web}/index/relationship/{indexName}/{key}/{
        /// value} "http://uri.for.node.to.index"
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCreateANamedRelationshipIndexAndAddToIt() throws org.neo4j.server.rest.domain.JsonParseException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCreateANamedRelationshipIndexAndAddToIt()
        {
            string indexName       = _indexes.newInstance();
            int    expectedIndexes = _helper.RelationshipIndexes.Length + 1;
            IDictionary <string, string> indexSpecification = new Dictionary <string, string>();

            indexSpecification["name"] = indexName;
            JaxRsResponse response = HttpPostIndexRelationshipRoot(JsonHelper.createJsonFrom(indexSpecification));

            assertEquals(201, response.Status);
            assertNotNull(response.Headers.get("Location").get(0));
            assertEquals(expectedIndexes, _helper.RelationshipIndexes.Length);
            assertNotNull(_helper.createRelationshipIndex(indexName));
            // Add a relationship to the index
            string key              = "key";
            string value            = "value";
            string relationshipType = "related-to";
            long   relationshipId   = _helper.createRelationship(relationshipType);

            response = HttpPostIndexRelationshipNameKeyValue(indexName, relationshipId, key, value);
            assertEquals(Status.CREATED.StatusCode, response.Status);
            string indexUri = response.Headers.get("Location").get(0);

            assertNotNull(indexUri);
            assertEquals(Arrays.asList(( long? )relationshipId), _helper.getIndexedRelationships(indexName, key, value));
            // Get the relationship from the indexed URI (Location in header)
            response = HttpGet(indexUri);
            assertEquals(200, response.Status);
            string discoveredEntity          = response.Entity;
            IDictionary <string, object> map = JsonHelper.jsonToMap(discoveredEntity);

            assertNotNull(map["self"]);
        }
Esempio n. 20
0
        // It has to be possible to create relationships among created and not-created nodes
        // in batch operation.  Tests the fix for issue #690.
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToReferToNotCreatedUniqueEntities() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToReferToNotCreatedUniqueEntities()
        {
            string jsonString = (new PrettyJSON()).array().@object().key("method").value("POST").key("to").value("/index/node/Cultures?unique").key("body").@object().key("key").value("name").key("value").value("tobias").key("properties").@object().key("name").value("Tobias Tester").endObject().endObject().key("id").value(0).endObject().@object().key("method").value("POST").key("to").value("/index/node/Cultures?unique").key("body").@object().key("key").value("name").key("value").value("andres").key("properties").@object().key("name").value("Andres Tester").endObject().endObject().key("id").value(1).endObject().@object().key("method").value("POST").key("to").value("/index/node/Cultures?unique").key("body").@object().key("key").value("name").key("value").value("andres").key("properties").@object().key("name").value("Andres Tester").endObject().endObject().key("id").value(2).endObject().@object().key("method").value("POST").key("to").value("/index/relationship/my_rels/?unique").key("body").@object().key("key").value("name").key("value").value("tobias-andres").key("start").value("{0}").key("end").value("{1}").key("type").value("FRIENDS").endObject().key("id").value(3).endObject().@object().key("method").value("POST").key("to").value("/index/relationship/my_rels/?unique").key("body").@object().key("key").value("name").key("value").value("andres-tobias").key("start").value("{2}").key("end").value("{0}").key("type").value("FRIENDS").endObject().key("id").value(4).endObject().@object().key("method").value("POST").key("to").value("/index/relationship/my_rels/?unique").key("body").@object().key("key").value("name").key("value").value("andres-tobias").key("start").value("{1}").key("end").value("{0}").key("type").value("FRIENDS").endObject().key("id").value(5).endObject().endArray().ToString();

            JaxRsResponse response = RestRequest.Req().post(BatchUri(), jsonString);

            assertEquals(200, response.Status);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String entity = response.getEntity();
            string entity = response.Entity;
            IList <IDictionary <string, object> > results = JsonHelper.jsonToList(entity);

            assertEquals(6, results.Count);
            IDictionary <string, object> andresResult1      = results[1];
            IDictionary <string, object> andresResult2      = results[2];
            IDictionary <string, object> secondRelationship = results[4];
            IDictionary <string, object> thirdRelationship  = results[5];

            // Same people
            IDictionary <string, object> body1 = (IDictionary <string, object>)andresResult1["body"];
            IDictionary <string, object> body2 = (IDictionary <string, object>)andresResult2["body"];

            assertEquals(body1["id"], body2["id"]);
            // Same relationship
            body1 = (IDictionary <string, object>)secondRelationship["body"];
            body2 = (IDictionary <string, object>)thirdRelationship["body"];
            assertEquals(body1["self"], body2["self"]);
            // Created for {2} {0}
            assertTrue((( string )secondRelationship["location"]).Length > 0);
            // {2} = {1} = Andres
            body1 = (IDictionary <string, object>)secondRelationship["body"];
            body2 = (IDictionary <string, object>)andresResult1["body"];
            assertEquals(body1["start"], body2["self"]);
        }
Esempio n. 21
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHaveJsonMediaTypeOnResponse()
        public virtual void ShouldHaveJsonMediaTypeOnResponse()
        {
            JaxRsResponse response = RetrieveNodeFromService(_nodeUri.ToString());

            assertThat(response.Type.ToString(), containsString(MediaType.APPLICATION_JSON));
            response.Close();
        }
Esempio n. 22
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetValidLocationHeaderWhenCreatingNode()
        public virtual void ShouldGetValidLocationHeaderWhenCreatingNode()
        {
            JaxRsResponse response = SendCreateRequestToServer();

            assertNotNull(response.Location);
            assertTrue(response.Location.ToString().StartsWith(_functionalTestHelper.dataUri() + "node/", StringComparison.Ordinal));
        }
Esempio n. 23
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGet404ForNonExistingRelationship()
        public virtual void ShouldGet404ForNonExistingRelationship()
        {
            string        uri      = _functionalTestHelper.dataUri() + "relationship/999999/properties/foo";
            JaxRsResponse response = RestRequest.Req().get(uri);

            assertEquals(404, response.Status);
            response.Close();
        }
Esempio n. 24
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeJSONContentTypeOnPropertiesResponse()
        public virtual void ShouldBeJSONContentTypeOnPropertiesResponse()
        {
            string        entity         = JsonHelper.createJsonFrom(Collections.singletonMap("foo", "bar"));
            JaxRsResponse createResource = _req.post(_functionalTestHelper.dataUri() + "node/", entity);
            JaxRsResponse response       = _req.get(createResource.Location.ToString() + "/properties");

            assertThat(response.Type.ToString(), containsString(MediaType.APPLICATION_JSON));
        }
Esempio n. 25
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeValidJSONOnResponse()
        public virtual void ShouldBeValidJSONOnResponse()
        {
            JaxRsResponse response = RestRequest.Req().get(GetPropertyUri("foo"));

            assertThat(response.Type.ToString(), containsString(MediaType.APPLICATION_JSON));
            assertNotNull(JsonHelper.createJsonFrom(response.Entity));
            response.Close();
        }
Esempio n. 26
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetASingleContentLengthHeaderWhenCreatingANode()
        public virtual void ShouldGetASingleContentLengthHeaderWhenCreatingANode()
        {
            JaxRsResponse  response             = SendCreateRequestToServer();
            IList <string> contentLengthHeaders = response.Headers.get("Content-Length");

            assertNotNull(contentLengthHeaders);
            assertEquals(1, contentLengthHeaders.Count);
        }
Esempio n. 27
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetRoot()
        public virtual void ShouldGetRoot()
        {
            JaxRsResponse response = RestRequest.Req().get(_functionalTestHelper.dataUri(), MediaType.TEXT_HTML_TYPE);

            assertEquals(Status.OK.StatusCode, response.Status);
            AssertValidHtml(response.Entity);
            response.Close();
        }
Esempio n. 28
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToReferToUniquelyCreatedEntities() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToReferToUniquelyCreatedEntities()
        {
            string jsonString = (new PrettyJSON()).array().@object().key("method").value("POST").key("to").value("/index/node/Cultures?unique").key("body").@object().key("key").value("ID").key("value").value("fra").key("properties").@object().key("ID").value("fra").endObject().endObject().key("id").value(0).endObject().@object().key("method").value("POST").key("to").value("/node").key("id").value(1).endObject().@object().key("method").value("POST").key("to").value("{1}/relationships").key("body").@object().key("to").value("{0}").key("type").value("has").endObject().key("id").value(2).endObject().endArray().ToString();

            JaxRsResponse response = RestRequest.Req().post(BatchUri(), jsonString);

            assertEquals(200, response.Status);
        }
Esempio n. 29
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGet404WhenDeletingNonExistentIndex()
        public virtual void ShouldGet404WhenDeletingNonExistentIndex()
        {
            string        indexName = _indexes.newInstance();
            string        indexUri  = _functionalTestHelper.relationshipIndexUri() + indexName;
            JaxRsResponse response  = _request.delete(indexUri);

            assertEquals(Status.NOT_FOUND.StatusCode, response.Status);
        }
Esempio n. 30
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHaveJsonDataInResponse() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldHaveJsonDataInResponse()
        {
            JaxRsResponse response = RetrieveNodeFromService(_nodeUri.ToString());

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

            assertTrue(map.ContainsKey("self"));
            response.Close();
        }