示例#1
0
        private static void SetupTheDatabase()
        {
            long relationship = _helper.createRelationship("LIKES");
            IDictionary <string, object> map = new Dictionary <string, object>();

            map["foo"] = "bar";
            _helper.setRelationshipProperties(relationship, map);
            _baseRelationshipUri = _functionalTestHelper.dataUri() + "relationship/" + relationship + "/properties/";
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToRemoveIndexing()
        public virtual void ShouldBeAbleToRemoveIndexing()
        {
            string key1         = "kvkey1";
            string key2         = "kvkey2";
            string value1       = "value1";
            string value2       = "value2";
            string indexName    = _indexes.newInstance();
            long   relationship = _helper.createRelationship("some type");

            _helper.setRelationshipProperties(relationship, MapUtil.map(key1, value1, key1, value2, key2, value1, key2, value2));
            _helper.addRelationshipToIndex(indexName, key1, value1, relationship);
            _helper.addRelationshipToIndex(indexName, key1, value2, relationship);
            _helper.addRelationshipToIndex(indexName, key2, value1, relationship);
            _helper.addRelationshipToIndex(indexName, key2, value2, relationship);
            assertEquals(1, _helper.getIndexedRelationships(indexName, key1, value1).Count);
            assertEquals(1, _helper.getIndexedRelationships(indexName, key1, value2).Count);
            assertEquals(1, _helper.getIndexedRelationships(indexName, key2, value1).Count);
            assertEquals(1, _helper.getIndexedRelationships(indexName, key2, value2).Count);
            JaxRsResponse response = RestRequest.Req().delete(_functionalTestHelper.relationshipIndexUri() + indexName + "/" + key1 + "/" + value1 + "/" + relationship);

            assertEquals(204, response.Status);
            assertEquals(0, _helper.getIndexedRelationships(indexName, key1, value1).Count);
            assertEquals(1, _helper.getIndexedRelationships(indexName, key1, value2).Count);
            assertEquals(1, _helper.getIndexedRelationships(indexName, key2, value1).Count);
            assertEquals(1, _helper.getIndexedRelationships(indexName, key2, value2).Count);
            response = RestRequest.Req().delete(_functionalTestHelper.relationshipIndexUri() + indexName + "/" + key2 + "/" + relationship);
            assertEquals(204, response.Status);
            assertEquals(0, _helper.getIndexedRelationships(indexName, key1, value1).Count);
            assertEquals(1, _helper.getIndexedRelationships(indexName, key1, value2).Count);
            assertEquals(0, _helper.getIndexedRelationships(indexName, key2, value1).Count);
            assertEquals(0, _helper.getIndexedRelationships(indexName, key2, value2).Count);
            response = RestRequest.Req().delete(_functionalTestHelper.relationshipIndexUri() + indexName + "/" + relationship);
            assertEquals(204, response.Status);
            assertEquals(0, _helper.getIndexedRelationships(indexName, key1, value1).Count);
            assertEquals(0, _helper.getIndexedRelationships(indexName, key1, value2).Count);
            assertEquals(0, _helper.getIndexedRelationships(indexName, key2, value1).Count);
            assertEquals(0, _helper.getIndexedRelationships(indexName, key2, value2).Count);
            // Delete the index
            response = RestRequest.Req().delete(_functionalTestHelper.indexRelationshipUri(indexName));
            assertEquals(204, response.Status);
            assertFalse(asList(_helper.RelationshipIndexes).contains(indexName));
        }
示例#3
0
        private void CreateTheMatrix()
        {
            // Create the matrix example
            _thomasAnderson = CreateAndIndexNode("Thomas Anderson");
            _trinity        = CreateAndIndexNode("Trinity");
            long tank = CreateAndIndexNode("Tank");

            long knowsRelationshipId = _helper.createRelationship("KNOWS", _thomasAnderson, _trinity);

            _thomasAndersonLovesTrinity = _helper.createRelationship("LOVES", _thomasAnderson, _trinity);
            _helper.setRelationshipProperties(_thomasAndersonLovesTrinity, Collections.singletonMap("strength", 100));
            _helper.createRelationship("KNOWS", _thomasAnderson, tank);
            _helper.createRelationship("KNOWS", _trinity, tank);

            // index a relationship
            _helper.createRelationshipIndex("relationships");
            _helper.addRelationshipToIndex("relationships", "key", "value", knowsRelationshipId);

            // index a relationship
            _helper.createRelationshipIndex("relationships2");
            _helper.addRelationshipToIndex("relationships2", "key2", "value2", knowsRelationshipId);
        }