Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToIndexValuesContainingSpaces() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToIndexValuesContainingSpaces()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long startNodeId = helper.createNode();
            long startNodeId = _helper.createNode();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long endNodeId = helper.createNode();
            long         endNodeId        = _helper.createNode();
            const string relationshiptype = "tested-together";
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long relationshipId = helper.createRelationship(relationshiptype, startNodeId, endNodeId);
            long         relationshipId = _helper.createRelationship(relationshiptype, startNodeId, endNodeId);
            const string key            = "key";
            const string value          = "value with   spaces  in it";
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String indexName = indexes.newInstance();
            string indexName = _indexes.newInstance();

            _helper.createRelationshipIndex(indexName);
            JaxRsResponse response = HttpPostIndexRelationshipNameKeyValue(indexName, relationshipId, key, value);

            assertEquals(Status.CREATED.StatusCode, response.Status);
            URI location = response.Location;

            response.Close();
            response = HttpGetIndexRelationshipNameKeyValue(indexName, key, URIHelper.encode(value));
            assertEquals(Status.OK.StatusCode, response.Status);
            string responseEntity = response.Entity;
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Collection<?> hits = (java.util.Collection<?>) org.neo4j.server.rest.domain.JsonHelper.readJson(responseEntity);
            ICollection <object> hits = (ICollection <object>)JsonHelper.readJson(responseEntity);

            assertEquals(1, hits.Count);
            response.Close();
            CLIENT.resource(location).delete();
            response = HttpGetIndexRelationshipNameKeyValue(indexName, key, URIHelper.encode(value));
            assertEquals(200, response.Status);
            responseEntity = response.Entity;
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: hits = (java.util.Collection<?>) org.neo4j.server.rest.domain.JsonHelper.readJson(responseEntity);
            hits = (ICollection <object>)JsonHelper.readJson(responseEntity);
            assertEquals(0, hits.Count);
            response.Close();
        }
Beispiel #2
0
 protected internal virtual string Path()
 {
     return("index/" + PropertyContainerType() + "/" + URIHelper.encode(_name) + "/");
 }
Beispiel #3
0
 public virtual string RelativeUriFor(string key, string value, long entityId)
 {
     return(Path() + URIHelper.encode(key) + "/" + URIHelper.encode(value) + "/" + Convert.ToString(entityId));
 }