Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturn204WhenPropertiesAreRemoved()
        public virtual void ShouldReturn204WhenPropertiesAreRemoved()
        {
            long nodeId = _helper.createNode();
            IDictionary <string, object> map = new Dictionary <string, object>();

            map["jim"] = "tobias";
            _helper.setNodeProperties(nodeId, map);
            JaxRsResponse response = RemoveNodePropertiesOnServer(nodeId);

            assertEquals(204, response.Status);
            response.Close();
        }
Exemplo n.º 2
0
        private long CreateAndIndexNode(string name)
        {
            long id = _helper.createNode();

            _helper.setNodeProperties(id, Collections.singletonMap("name", name));
            _helper.addNodeToIndex("node", "name", name, id);
            return(id);
        }
Exemplo n.º 3
0
        public virtual void ShouldGet404WhenRetrievingNonExistentNode()
        {
            long nonExistentNode = _helper.createNode();

            _helper.deleteNode(nonExistentNode);
            URI nonExistentNodeUri = new URI(_functionalTestHelper.nodeUri() + "/" + nonExistentNode);

            GenConflict.get().expectedStatus(404).get(nonExistentNodeUri.ToString());
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGet200AndArrayOfRelationshipRepsWhenGettingFromIndex() throws org.neo4j.server.rest.domain.JsonParseException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldGet200AndArrayOfRelationshipRepsWhenGettingFromIndex()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long startNode = helper.createNode();
            long startNode = _helper.createNode();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long endNode = helper.createNode();
            long          endNode                    = _helper.createNode();
            const string  key                        = "key_get";
            const string  value                      = "value";
            const string  relationshipName1          = "related-to";
            const string  relationshipName2          = "dislikes";
            string        jsonString                 = JsonRelationshipCreationSpecification(relationshipName1, endNode, key, value);
            JaxRsResponse createRelationshipResponse = HttpPostCreateRelationship(startNode, jsonString);

            assertEquals(201, createRelationshipResponse.Status);
            string relationshipLocation1 = createRelationshipResponse.Location.ToString();

            jsonString = JsonRelationshipCreationSpecification(relationshipName2, endNode, key, value);
            createRelationshipResponse = HttpPostCreateRelationship(startNode, jsonString);
            assertEquals(201, createRelationshipResponse.Status);
            string        relationshipLocation2 = createRelationshipResponse.Headers.get(HttpHeaders.LOCATION).get(0);
            string        indexName             = _indexes.newInstance();
            JaxRsResponse indexCreationResponse = HttpPostIndexRelationshipRoot("{\"name\":\"" + indexName + "\"}");

            assertEquals(201, indexCreationResponse.Status);
            JaxRsResponse indexedRelationshipResponse = HttpPostIndexRelationshipNameKeyValue(indexName, _functionalTestHelper.getRelationshipIdFromUri(relationshipLocation1), key, value);
            string        indexLocation1 = indexedRelationshipResponse.Headers.get(HttpHeaders.LOCATION).get(0);

            indexedRelationshipResponse = HttpPostIndexRelationshipNameKeyValue(indexName, _functionalTestHelper.getRelationshipIdFromUri(relationshipLocation2), key, value);
            string indexLocation2 = indexedRelationshipResponse.Headers.get(HttpHeaders.LOCATION).get(0);
            IDictionary <string, string> uriToName = new Dictionary <string, string>();

            uriToName[indexLocation1] = relationshipName1;
            uriToName[indexLocation2] = relationshipName2;
            JaxRsResponse response = RestRequest.Req().get(_functionalTestHelper.indexRelationshipUri(indexName, key, value));

            assertEquals(200, response.Status);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Collection<?> items = (java.util.Collection<?>) org.neo4j.server.rest.domain.JsonHelper.readJson(response.getEntity());
            ICollection <object> items = (ICollection <object>)JsonHelper.readJson(response.Entity);
            int counter = 0;

            foreach (object item in items)
            {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<?, ?> map = (java.util.Map<?, ?>) item;
                IDictionary <object, ?> map = (IDictionary <object, ?>)item;
                assertNotNull(map["self"]);
                string indexedUri = ( string )map["indexed"];
                assertEquals(uriToName[indexedUri], map["type"]);
                counter++;
            }
            assertEquals(2, counter);
            response.Close();
        }
Exemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setupTheDatabase()
        public virtual void SetupTheDatabase()
        {
            _nodeWithRelationships = _helper.createNode();
            _likes = _helper.createRelationship("LIKES", _nodeWithRelationships, _helper.createNode());
            _helper.createRelationship("LIKES", _helper.createNode(), _nodeWithRelationships);
            _helper.createRelationship("HATES", _nodeWithRelationships, _helper.createNode());
            _nodeWithoutRelationships = _helper.createNode();
            _nonExistingNode          = _helper.createNode();
            _helper.deleteNode(_nonExistingNode);
        }
Exemplo n.º 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void cleanTheDatabaseAndInitialiseTheNodeUri() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CleanTheDatabaseAndInitialiseTheNodeUri()
        {
            _helper  = new GraphDbHelper(Server().Database);
            _nodeUri = new URI(_functionalTestHelper.nodeUri() + "/" + _helper.createNode());
        }