private NodeValueClientFilter InitializeFilter(params IndexQuery[] filters)
        {
            NodeValueClientFilter filter = new NodeValueClientFilter(this, _node, _property, _read, filters);

            filter.Initialize(TestIndexDescriptorFactory.forLabel(11), this, null, IndexOrder.NONE, true);
            return(filter);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleCompositeSizesCloseToTheLimit() throws org.neo4j.internal.kernel.api.exceptions.KernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldHandleCompositeSizesCloseToTheLimit()
        {
            // given
            CreateIndex(KEY, KEY2);

            // when a string longer than native string limit, but within lucene limit
            int    length  = 20_000;
            string string1 = Random.nextAlphaNumericString(length, length);
            string string2 = Random.nextAlphaNumericString(length, length);
            Node   node;

            using (Transaction tx = Db.beginTx())
            {
                node = Db.createNode(LABEL);
                node.SetProperty(KEY, string1);
                node.SetProperty(KEY2, string2);
                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = Db.DependencyResolver.resolveDependency(typeof(ThreadToStatementContextBridge)).getKernelTransactionBoundToThisThread(true);
                int labelId           = ktx.TokenRead().nodeLabel(LABEL.Name());
                int propertyKeyId1    = ktx.TokenRead().propertyKey(KEY);
                int propertyKeyId2    = ktx.TokenRead().propertyKey(KEY2);
                using (NodeValueIndexCursor cursor = ktx.Cursors().allocateNodeValueIndexCursor())
                {
                    ktx.DataRead().nodeIndexSeek(TestIndexDescriptorFactory.forLabel(labelId, propertyKeyId1, propertyKeyId2), cursor, IndexOrder.NONE, false, IndexQuery.exact(propertyKeyId1, string1), IndexQuery.exact(propertyKeyId2, string2));
                    assertTrue(cursor.Next());
                    assertEquals(node.Id, cursor.NodeReference());
                    assertFalse(cursor.Next());
                }
                tx.Success();
            }
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void failForceIndexesWhenOneOfTheIndexesIsBroken() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void FailForceIndexesWhenOneOfTheIndexesIsBroken()
        {
            string constraintLabelPrefix    = "ConstraintLabel";
            string constraintPropertyPrefix = "ConstraintProperty";
            string indexLabelPrefix         = "Label";
            string indexPropertyPrefix      = "Property";

            for (int i = 0; i < 10; i++)
            {
                using (Transaction transaction = _database.beginTx())
                {
                    _database.schema().constraintFor(Label.label(constraintLabelPrefix + i)).assertPropertyIsUnique(constraintPropertyPrefix + i).create();
                    _database.schema().indexFor(Label.label(indexLabelPrefix + i)).on(indexPropertyPrefix + i).create();
                    transaction.Success();
                }
            }

            using (Transaction ignored = _database.beginTx())
            {
                _database.schema().awaitIndexesOnline(1, TimeUnit.MINUTES);
            }

            IndexingService indexingService = GetIndexingService(_database);

            int indexLabel7    = GetLabelId(indexLabelPrefix + 7);
            int indexProperty7 = GetPropertyKeyId(indexPropertyPrefix + 7);

            IndexProxy index = indexingService.GetIndexProxy(TestIndexDescriptorFactory.forLabel(indexLabel7, indexProperty7).schema());

            index.Drop();

            ExpectedException.expect(typeof(UnderlyingStorageException));
            ExpectedException.expectMessage("Unable to force");
            indexingService.ForceAll(Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup()
        public virtual void Setup()
        {
            DefaultFileSystemAbstraction fs = this._fs.get();
            PageCache     pc     = _pageCacheRule.getPageCache(fs);
            File          file   = _directory.file("index");
            GenericLayout layout = new GenericLayout(1, _indexSettings);
            RecoveryCleanupWorkCollector collector = RecoveryCleanupWorkCollector.ignore();

            _descriptor = TestIndexDescriptorFactory.forLabel(1, 1).withId(1);
            IndexDirectoryStructure.Factory factory   = IndexDirectoryStructure.directoriesByProvider(_directory.storeDir());
            IndexDirectoryStructure         structure = factory.ForProvider(GenericNativeIndexProvider.Descriptor);
            IndexDropAction dropAction = new FileSystemIndexDropAction(fs, structure);

            _accessor = new GenericNativeIndexAccessor(pc, fs, file, layout, collector, EMPTY, _descriptor, _indexSettings, new StandardConfiguration(), dropAction, false);
        }
Beispiel #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void committedConstraintRuleShouldCrossReferenceTheCorrespondingIndexRule() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CommittedConstraintRuleShouldCrossReferenceTheCorrespondingIndexRule()
        {
            // when
            SchemaWrite statement = schemaWriteInNewTransaction();

            statement.UniquePropertyConstraintCreate(Descriptor);
            commit();

            // then
            SchemaStorage        schema         = new SchemaStorage(NeoStores().SchemaStore);
            StoreIndexDescriptor indexRule      = Schema.indexGetForSchema(TestIndexDescriptorFactory.uniqueForLabel(TypeId, PropertyKeyId));
            ConstraintRule       constraintRule = Schema.constraintsGetSingle(ConstraintDescriptorFactory.uniqueForLabel(TypeId, PropertyKeyId));

            assertEquals(constraintRule.Id, indexRule.OwningConstraint.Value);
            assertEquals(indexRule.Id, constraintRule.OwnedIndex);
        }
Beispiel #6
0
 private void ExerciseVisitor(System.Func <object, DbStructureVisitor> visitor)
 {
     visitor(null).visitLabel(0, "Person");
     visitor(null).visitLabel(1, "Party");
     visitor(null).visitPropertyKey(0, "name");
     visitor(null).visitPropertyKey(2, "lastName");
     visitor(null).visitPropertyKey(1, "age");
     visitor(null).visitRelationshipType(0, "ACCEPTS");
     visitor(null).visitRelationshipType(1, "REJECTS");
     visitor(null).visitIndex(TestIndexDescriptorFactory.forLabel(0, 1), ":Person(age)", 0.5d, 1L);
     visitor(null).visitIndex(TestIndexDescriptorFactory.uniqueForLabel(0, 0, 2), ":Person(name, lastName)", 0.5d, 1L);
     visitor(null).visitUniqueConstraint(ConstraintDescriptorFactory.uniqueForLabel(1, 0), ":Party(name)");
     visitor(null).visitNodeKeyConstraint(ConstraintDescriptorFactory.nodeKeyForLabel(0, 1, 2), ":Person(name, lastName)");
     visitor(null).visitAllNodesCount(55);
     visitor(null).visitNodeCount(0, "Person", 50);
     visitor(null).visitNodeCount(0, "Party", 5);
     visitor(null).visitRelCount(0, 1, -1, "MATCH (:Person)-[:REJECTS]->() RETURN count(*)", 5);
 }
        private void ShouldConsultProvidedFilters(System.Func <Value[], Value[]> filterValues, bool filterAcceptsValue)
        {
            // given
            long nodeReference = 123;
            int  labelId       = 10;
            int  slots         = Random.Next(3, 8);

            IndexQuery[]             filters      = new IndexQuery[slots];
            Value[]                  actualValues = new Value[slots];
            Value[]                  values       = new Value[slots];
            IDictionary <int, Value> properties   = new Dictionary <int, Value>();

            int[] propertyKeyIds = new int[slots];
            int   filterCount    = 0;

            for (int i = 0; i < slots; i++)
            {
                actualValues[i] = Random.nextValue();
                int propertyKeyId = i;
                propertyKeyIds[i] = propertyKeyId;
                //    we want at least one filter         ,  randomly add filter or not
                if ((filterCount == 0 && i == slots - 1) || Random.nextBoolean())
                {
                    object filterValue = (filterAcceptsValue ? actualValues[i] : AnyOtherValueThan(actualValues[i])).asObjectCopy();
                    filters[i] = IndexQuery.exact(propertyKeyId, filterValue);
                    filterCount++;
                }
                values[i] = Random.nextBoolean() ? NO_VALUE : actualValues[i];
                properties[propertyKeyId] = actualValues[i];
            }
            _node.withNode(nodeReference, new long[] { labelId }, properties);

            // when
            NodeValueClientFilter filter = new NodeValueClientFilter(this, _node, _property, _read, filters);

            filter.Initialize(TestIndexDescriptorFactory.forLabel(labelId, propertyKeyIds), this, null, IndexOrder.NONE, true);
            bool accepted = filter.AcceptNode(nodeReference, filterValues(values));

            // then
            assertEquals(filterAcceptsValue, accepted);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFilterResults()
        public virtual void ShouldFilterResults()
        {
            // given
            IList <string> keys = new List <string>();

            for (int i = 0; i < 100; i++)
            {
                // duplicates are fine
                keys.Add(Random.nextString());
            }

            RawCursor <Hit <StringIndexKey, NativeIndexValue>, IOException> cursor = new ResultCursor(keys.GetEnumerator());
            NodeValueIterator valueClient = new NodeValueIteratorAnonymousInnerClass(this);

            IndexQuery[] predicates          = new IndexQuery[] { mock(typeof(IndexQuery)) };
            System.Predicate <string> filter = @string => @string.contains("a");
            when(predicates[0].AcceptsValue(any(typeof(Value)))).then(invocation => filter((( TextValue )invocation.getArgument(0)).stringValue()));
            FilteringNativeHitIndexProgressor <StringIndexKey, NativeIndexValue> progressor = new FilteringNativeHitIndexProgressor <StringIndexKey, NativeIndexValue>(cursor, valueClient, new List <RawCursor <Hit <KEY, VALUE>, IOException> >(), predicates);

            valueClient.Initialize(TestIndexDescriptorFactory.forLabel(0, 0), progressor, predicates, IndexOrder.NONE, true);
            IList <long> result = new List <long>();

            // when
            while (valueClient.HasNext())
            {
                result.Add(valueClient.Next());
            }

            // then
            for (int i = 0; i < keys.Count; i++)
            {
                if (filter(keys[i]))
                {
                    assertTrue(result.RemoveAt(( long )i));
                }
            }
            assertTrue(result.Count == 0);
        }
Beispiel #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnIndexRuleForLabelAndPropertyComposite()
        public virtual void ShouldReturnIndexRuleForLabelAndPropertyComposite()
        {
            string a = "a";
            string b = "b";
            string c = "c";
            string d = "d";
            string e = "e";
            string f = "f";

            CreateSchema(Db => Db.schema().indexFor(Label.label(LABEL1)).on(a).on(b).on(c).on(d).on(e).on(f).create());

            StoreIndexDescriptor rule = _storage.indexGetForSchema(TestIndexDescriptorFactory.forLabel(LabelId(LABEL1), PropId(a), PropId(b), PropId(c), PropId(d), PropId(e), PropId(f)));

            assertNotNull(rule);
            assertTrue(SchemaDescriptorPredicates.hasLabel(rule, LabelId(LABEL1)));
            assertTrue(SchemaDescriptorPredicates.hasProperty(rule, PropId(a)));
            assertTrue(SchemaDescriptorPredicates.hasProperty(rule, PropId(b)));
            assertTrue(SchemaDescriptorPredicates.hasProperty(rule, PropId(c)));
            assertTrue(SchemaDescriptorPredicates.hasProperty(rule, PropId(d)));
            assertTrue(SchemaDescriptorPredicates.hasProperty(rule, PropId(e)));
            assertTrue(SchemaDescriptorPredicates.hasProperty(rule, PropId(f)));
            assertEquals(IndexDescriptor.Type.GENERAL, rule.Type());
        }
Beispiel #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnIndexRuleForLabelAndVeryManyPropertiesComposite()
        public virtual void ShouldReturnIndexRuleForLabelAndVeryManyPropertiesComposite()
        {
            string[] props = "abcdefghijklmnopqrstuvwxyzABCDEFGHJILKMNOPQRSTUVWXYZ".Split("\\B", true);
            CreateSchema(Db =>
            {
                IndexCreator indexCreator = Db.schema().indexFor(Label.label(LABEL1));
                foreach (string prop in props)
                {
                    indexCreator = indexCreator.on(prop);
                }
                indexCreator.create();
            });

            StoreIndexDescriptor rule = _storage.indexGetForSchema(TestIndexDescriptorFactory.forLabel(LabelId(LABEL1), java.util.props.Select(this.propId).ToArray()));

            assertNotNull(rule);
            assertTrue(SchemaDescriptorPredicates.hasLabel(rule, LabelId(LABEL1)));
            foreach (string prop in props)
            {
                assertTrue(SchemaDescriptorPredicates.hasProperty(rule, PropId(prop)));
            }
            assertEquals(IndexDescriptor.Type.GENERAL, rule.Type());
        }
Beispiel #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void updateForHigherNodeIgnoredWhenUsingFullNodeStoreScan() throws org.neo4j.kernel.api.exceptions.index.IndexPopulationFailedKernelException, java.io.IOException, org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void UpdateForHigherNodeIgnoredWhenUsingFullNodeStoreScan()
        {
            NeoStores neoStores = Mockito.mock(typeof(NeoStores));
            NodeStore nodeStore = mock(typeof(NodeStore));

            when(neoStores.NodeStore).thenReturn(nodeStore);

            ProcessListenableNeoStoreIndexView storeView      = new ProcessListenableNeoStoreIndexView(this, LockService.NO_LOCK_SERVICE, neoStores);
            MultipleIndexPopulator             indexPopulator = new MultipleIndexPopulator(storeView, _logProvider, EntityType.NODE, mock(typeof(SchemaState)));

            storeView.ProcessListener = new NodeUpdateProcessListener(indexPopulator);

            IndexPopulator populator    = CreateIndexPopulator();
            IndexUpdater   indexUpdater = mock(typeof(IndexUpdater));

            AddPopulator(indexPopulator, populator, 1, TestIndexDescriptorFactory.forLabel(1, 1));

            indexPopulator.Create();
            StoreScan <IndexPopulationFailedKernelException> storeScan = indexPopulator.IndexAllEntities();

            storeScan.Run();

            Mockito.verify(indexUpdater, never()).process(any(typeof(IndexEntryUpdate)));
        }
Beispiel #12
0
 public void Accept(DbStructureVisitor visitor)
 {
     visitor.VisitLabel(1, "Person");
     visitor.VisitPropertyKey(0, "name");
     visitor.VisitPropertyKey(1, "location");
     visitor.VisitPropertyKey(2, "uid");
     visitor.VisitPropertyKey(3, "link");
     visitor.VisitPropertyKey(4, "gender");
     visitor.VisitPropertyKey(5, "email");
     visitor.VisitPropertyKey(6, "education");
     visitor.VisitPropertyKey(7, "work");
     visitor.VisitPropertyKey(8, "node_type");
     visitor.VisitPropertyKey(9, "hometown");
     visitor.VisitPropertyKey(10, "birthdate");
     visitor.VisitPropertyKey(11, "ids");
     visitor.VisitPropertyKey(12, "created");
     visitor.VisitPropertyKey(13, "since");
     visitor.VisitPropertyKey(14, "location_name");
     visitor.VisitPropertyKey(15, "location_lon");
     visitor.VisitPropertyKey(17, "location_id");
     visitor.VisitPropertyKey(16, "location_lat");
     visitor.VisitRelationshipType(0, "friends");
     visitor.VisitRelationshipType(1, "FRIEND");
     visitor.VisitIndex(TestIndexDescriptorFactory.forLabel(1, 2), ":Person(uid)", 1.0d, 135164L);
     visitor.VisitAllNodesCount(135242L);
     visitor.VisitNodeCount(1, "Person", 135213L);
     visitor.VisitRelCount(-1, -1, -1, "MATCH ()-[]->() RETURN count(*)", 4537616L);
     visitor.VisitRelCount(1, -1, -1, "MATCH (:Person)-[]->() RETURN count(*)", 4536688L);
     visitor.VisitRelCount(-1, -1, 1, "MATCH ()-[]->(:Person) RETURN count(*)", 4536688L);
     visitor.VisitRelCount(-1, 0, -1, "MATCH ()-[:friends]->() RETURN count(*)", 4537616L);
     visitor.VisitRelCount(1, 0, -1, "MATCH (:Person)-[:friends]->() RETURN count(*)", 4536688L);
     visitor.VisitRelCount(-1, 0, 1, "MATCH ()-[:friends]->(:Person) RETURN count(*)", 4536688L);
     visitor.VisitRelCount(-1, 1, -1, "MATCH ()-[:FRIEND]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(1, 1, -1, "MATCH (:Person)-[:FRIEND]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 1, 1, "MATCH ()-[:FRIEND]->(:Person) RETURN count(*)", 0L);
 }
Beispiel #13
0
 public void Accept(DbStructureVisitor visitor)
 {
     visitor.VisitLabel(0, "Movie");
     visitor.VisitLabel(1, "Person");
     visitor.VisitLabel(2, "User");
     visitor.VisitLabel(3, "Actor");
     visitor.VisitLabel(4, "Director");
     visitor.VisitPropertyKey(0, "startTime");
     visitor.VisitPropertyKey(1, "__type__");
     visitor.VisitPropertyKey(2, "password");
     visitor.VisitPropertyKey(3, "login");
     visitor.VisitPropertyKey(4, "roles");
     visitor.VisitPropertyKey(5, "name");
     visitor.VisitPropertyKey(6, "description");
     visitor.VisitPropertyKey(7, "id");
     visitor.VisitPropertyKey(8, "releaseDate");
     visitor.VisitPropertyKey(9, "title");
     visitor.VisitPropertyKey(10, "tagline");
     visitor.VisitPropertyKey(11, "language");
     visitor.VisitPropertyKey(12, "imageUrl");
     visitor.VisitPropertyKey(13, "lastModified");
     visitor.VisitPropertyKey(14, "genre");
     visitor.VisitPropertyKey(15, "studio");
     visitor.VisitPropertyKey(17, "imdbId");
     visitor.VisitPropertyKey(16, "trailer");
     visitor.VisitPropertyKey(19, "homepage");
     visitor.VisitPropertyKey(18, "version");
     visitor.VisitPropertyKey(21, "profileImageUrl");
     visitor.VisitPropertyKey(20, "runtime");
     visitor.VisitPropertyKey(23, "birthday");
     visitor.VisitPropertyKey(22, "biography");
     visitor.VisitPropertyKey(25, "stars");
     visitor.VisitPropertyKey(24, "birthplace");
     visitor.VisitPropertyKey(26, "comment");
     visitor.VisitRelationshipType(0, "FRIEND");
     visitor.VisitRelationshipType(1, "DIRECTED");
     visitor.VisitRelationshipType(2, "ACTS_IN");
     visitor.VisitRelationshipType(3, "RATED");
     visitor.VisitRelationshipType(4, "ROOT");
     visitor.VisitIndex(TestIndexDescriptorFactory.forLabel(0, 9), ":Movie(title)", 1.0d, 12462L);
     visitor.VisitIndex(TestIndexDescriptorFactory.forLabel(1, 5), ":Person(name)", 1.0d, 49845L);
     visitor.VisitIndex(TestIndexDescriptorFactory.forLabel(3, 5), ":Actor(name)", 1.0d, 44689L);
     visitor.VisitIndex(TestIndexDescriptorFactory.forLabel(4, 5), ":Director(name)", 1.0d, 6010L);
     visitor.VisitIndex(TestIndexDescriptorFactory.uniqueForLabel(2, 3), ":User(login)", 1.0d, 45L);
     visitor.VisitUniqueConstraint(ConstraintDescriptorFactory.uniqueForLabel(2, 3), "CONSTRAINT ON ( " + "user:User ) ASSERT user.login IS UNIQUE");
     visitor.VisitAllNodesCount(63042L);
     visitor.VisitNodeCount(0, "Movie", 12862L);
     visitor.VisitNodeCount(1, "Person", 50179L);
     visitor.VisitNodeCount(2, "User", 45L);
     visitor.VisitNodeCount(3, "Actor", 44943L);
     visitor.VisitNodeCount(4, "Director", 6037L);
     visitor.VisitRelCount(-1, -1, -1, "MATCH ()-[]->() RETURN count(*)", 106651L);
     visitor.VisitRelCount(0, -1, -1, "MATCH (:Movie)-[]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, -1, 0, "MATCH ()-[]->(:Movie) RETURN count(*)", 106645L);
     visitor.VisitRelCount(1, -1, -1, "MATCH (:Person)-[]->() RETURN count(*)", 106651L);
     visitor.VisitRelCount(-1, -1, 1, "MATCH ()-[]->(:Person) RETURN count(*)", 6L);
     visitor.VisitRelCount(2, -1, -1, "MATCH (:User)-[]->() RETURN count(*)", 36L);
     visitor.VisitRelCount(-1, -1, 2, "MATCH ()-[]->(:User) RETURN count(*)", 6L);
     visitor.VisitRelCount(3, -1, -1, "MATCH (:Actor)-[]->() RETURN count(*)", 97151L);
     visitor.VisitRelCount(-1, -1, 3, "MATCH ()-[]->(:Actor) RETURN count(*)", 0L);
     visitor.VisitRelCount(4, -1, -1, "MATCH (:Director)-[]->() RETURN count(*)", 16268L);
     visitor.VisitRelCount(-1, -1, 4, "MATCH ()-[]->(:Director) RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 0, -1, "MATCH ()-[:FRIEND]->() RETURN count(*)", 6L);
     visitor.VisitRelCount(0, 0, -1, "MATCH (:Movie)-[:FRIEND]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 0, 0, "MATCH ()-[:FRIEND]->(:Movie) RETURN count(*)", 0L);
     visitor.VisitRelCount(1, 0, -1, "MATCH (:Person)-[:FRIEND]->() RETURN count(*)", 6L);
     visitor.VisitRelCount(-1, 0, 1, "MATCH ()-[:FRIEND]->(:Person) RETURN count(*)", 6L);
     visitor.VisitRelCount(2, 0, -1, "MATCH (:User)-[:FRIEND]->() RETURN count(*)", 6L);
     visitor.VisitRelCount(-1, 0, 2, "MATCH ()-[:FRIEND]->(:User) RETURN count(*)", 6L);
     visitor.VisitRelCount(3, 0, -1, "MATCH (:Actor)-[:FRIEND]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 0, 3, "MATCH ()-[:FRIEND]->(:Actor) RETURN count(*)", 0L);
     visitor.VisitRelCount(4, 0, -1, "MATCH (:Director)-[:FRIEND]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 0, 4, "MATCH ()-[:FRIEND]->(:Director) RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 1, -1, "MATCH ()-[:DIRECTED]->() RETURN count(*)", 11915L);
     visitor.VisitRelCount(0, 1, -1, "MATCH (:Movie)-[:DIRECTED]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 1, 0, "MATCH ()-[:DIRECTED]->(:Movie) RETURN count(*)", 11915L);
     visitor.VisitRelCount(1, 1, -1, "MATCH (:Person)-[:DIRECTED]->() RETURN count(*)", 11915L);
     visitor.VisitRelCount(-1, 1, 1, "MATCH ()-[:DIRECTED]->(:Person) RETURN count(*)", 0L);
     visitor.VisitRelCount(2, 1, -1, "MATCH (:User)-[:DIRECTED]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 1, 2, "MATCH ()-[:DIRECTED]->(:User) RETURN count(*)", 0L);
     visitor.VisitRelCount(3, 1, -1, "MATCH (:Actor)-[:DIRECTED]->() RETURN count(*)", 2451L);
     visitor.VisitRelCount(-1, 1, 3, "MATCH ()-[:DIRECTED]->(:Actor) RETURN count(*)", 0L);
     visitor.VisitRelCount(4, 1, -1, "MATCH (:Director)-[:DIRECTED]->() RETURN count(*)", 11915L);
     visitor.VisitRelCount(-1, 1, 4, "MATCH ()-[:DIRECTED]->(:Director) RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 2, -1, "MATCH ()-[:ACTS_IN]->() RETURN count(*)", 94700L);
     visitor.VisitRelCount(0, 2, -1, "MATCH (:Movie)-[:ACTS_IN]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 2, 0, "MATCH ()-[:ACTS_IN]->(:Movie) RETURN count(*)", 94700L);
     visitor.VisitRelCount(1, 2, -1, "MATCH (:Person)-[:ACTS_IN]->() RETURN count(*)", 94700L);
     visitor.VisitRelCount(-1, 2, 1, "MATCH ()-[:ACTS_IN]->(:Person) RETURN count(*)", 0L);
     visitor.VisitRelCount(2, 2, -1, "MATCH (:User)-[:ACTS_IN]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 2, 2, "MATCH ()-[:ACTS_IN]->(:User) RETURN count(*)", 0L);
     visitor.VisitRelCount(3, 2, -1, "MATCH (:Actor)-[:ACTS_IN]->() RETURN count(*)", 94700L);
     visitor.VisitRelCount(-1, 2, 3, "MATCH ()-[:ACTS_IN]->(:Actor) RETURN count(*)", 0L);
     visitor.VisitRelCount(4, 2, -1, "MATCH (:Director)-[:ACTS_IN]->() RETURN count(*)", 4353L);
     visitor.VisitRelCount(-1, 2, 4, "MATCH ()-[:ACTS_IN]->(:Director) RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 3, -1, "MATCH ()-[:RATED]->() RETURN count(*)", 30L);
     visitor.VisitRelCount(0, 3, -1, "MATCH (:Movie)-[:RATED]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 3, 0, "MATCH ()-[:RATED]->(:Movie) RETURN count(*)", 30L);
     visitor.VisitRelCount(1, 3, -1, "MATCH (:Person)-[:RATED]->() RETURN count(*)", 30L);
     visitor.VisitRelCount(-1, 3, 1, "MATCH ()-[:RATED]->(:Person) RETURN count(*)", 0L);
     visitor.VisitRelCount(2, 3, -1, "MATCH (:User)-[:RATED]->() RETURN count(*)", 30L);
     visitor.VisitRelCount(-1, 3, 2, "MATCH ()-[:RATED]->(:User) RETURN count(*)", 0L);
     visitor.VisitRelCount(3, 3, -1, "MATCH (:Actor)-[:RATED]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 3, 3, "MATCH ()-[:RATED]->(:Actor) RETURN count(*)", 0L);
     visitor.VisitRelCount(4, 3, -1, "MATCH (:Director)-[:RATED]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 3, 4, "MATCH ()-[:RATED]->(:Director) RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 4, -1, "MATCH ()-[:ROOT]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(0, 4, -1, "MATCH (:Movie)-[:ROOT]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 4, 0, "MATCH ()-[:ROOT]->(:Movie) RETURN count(*)", 0L);
     visitor.VisitRelCount(1, 4, -1, "MATCH (:Person)-[:ROOT]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 4, 1, "MATCH ()-[:ROOT]->(:Person) RETURN count(*)", 0L);
     visitor.VisitRelCount(2, 4, -1, "MATCH (:User)-[:ROOT]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 4, 2, "MATCH ()-[:ROOT]->(:User) RETURN count(*)", 0L);
     visitor.VisitRelCount(3, 4, -1, "MATCH (:Actor)-[:ROOT]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 4, 3, "MATCH ()-[:ROOT]->(:Actor) RETURN count(*)", 0L);
     visitor.VisitRelCount(4, 4, -1, "MATCH (:Director)-[:ROOT]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 4, 4, "MATCH ()-[:ROOT]->(:Director) RETURN count(*)", 0L);
 }
 public Unique(IndexProviderCompatibilityTestSuite testSuite) : base(testSuite, TestIndexDescriptorFactory.uniqueForLabel(1000, 100))
 {
 }
 public General(IndexProviderCompatibilityTestSuite testSuite) : base(testSuite, TestIndexDescriptorFactory.forLabel(1000, 100))
 {
 }
        private SpatialValueCreatorUtil CreateLayoutTestUtil(long indexId, int labelId)
        {
            StoreIndexDescriptor descriptor = TestIndexDescriptorFactory.forLabel(labelId, 666).withId(indexId);

            return(new SpatialValueCreatorUtil(descriptor, ValueCreatorUtil.FRACTION_DUPLICATE_NON_UNIQUE));
        }
Beispiel #17
0
 internal override LabelSchemaDescriptor MakeDescriptor(int typeId, int propertyKeyId)
 {
     _uniqueIndex = TestIndexDescriptorFactory.uniqueForLabel(typeId, propertyKeyId);
     return(SchemaDescriptorFactory.forLabel(typeId, propertyKeyId));
 }
Beispiel #18
0
 private CapableIndexDescriptor DummyMeta()
 {
     return(TestIndexDescriptorFactory.forLabel(0, 0).withId(0).withoutCapabilities());
 }
Beispiel #19
0
 public void Accept(DbStructureVisitor visitor)
 {
     visitor.VisitLabel(2, "Label20");
     visitor.VisitLabel(3, "Label4");
     visitor.VisitLabel(4, "Label22");
     visitor.VisitLabel(5, "Label6");
     visitor.VisitLabel(7, "Label1");
     visitor.VisitLabel(8, "Label12");
     visitor.VisitLabel(9, "Label14");
     visitor.VisitLabel(10, "Label26");
     visitor.VisitLabel(11, "Label10");
     visitor.VisitLabel(12, "Label24");
     visitor.VisitLabel(13, "Label8");
     visitor.VisitLabel(14, "Label18");
     visitor.VisitLabel(15, "Label19");
     visitor.VisitLabel(16, "Label3");
     visitor.VisitLabel(17, "Label16");
     visitor.VisitLabel(18, "Label15");
     visitor.VisitLabel(19, "Label21");
     visitor.VisitLabel(20, "Label5");
     visitor.VisitLabel(22, "Label2");
     visitor.VisitLabel(23, "Label11");
     visitor.VisitLabel(24, "Label13");
     visitor.VisitLabel(25, "Label17");
     visitor.VisitLabel(26, "Label25");
     visitor.VisitLabel(27, "Label9");
     visitor.VisitLabel(28, "Label23");
     visitor.VisitLabel(29, "Label7");
     visitor.VisitLabel(31, "Label27");
     visitor.VisitPropertyKey(0, "id");
     visitor.VisitPropertyKey(27, "deleted");
     visitor.VisitRelationshipType(1, "REL1");
     visitor.VisitRelationshipType(2, "REL4");
     visitor.VisitRelationshipType(4, "REL2");
     visitor.VisitRelationshipType(5, "REL5");
     visitor.VisitRelationshipType(6, "REL8");
     visitor.VisitRelationshipType(9, "REL6");
     visitor.VisitIndex(TestIndexDescriptorFactory.forLabel(22, 0), ":Label2(id)", 0.3641877706337751d, 304838L);
     visitor.VisitAllNodesCount(2668827L);
     visitor.VisitNodeCount(2, "Label20", 3L);
     visitor.VisitNodeCount(3, "Label4", 0L);
     visitor.VisitNodeCount(4, "Label22", 0L);
     visitor.VisitNodeCount(5, "Label6", 0L);
     visitor.VisitNodeCount(7, "Label1", 111110L);
     visitor.VisitNodeCount(8, "Label12", 111112L);
     visitor.VisitNodeCount(9, "Label14", 99917L);
     visitor.VisitNodeCount(10, "Label26", 3L);
     visitor.VisitNodeCount(11, "Label10", 111150L);
     visitor.VisitNodeCount(12, "Label24", 0L);
     visitor.VisitNodeCount(13, "Label8", 0L);
     visitor.VisitNodeCount(14, "Label18", 111112L);
     visitor.VisitNodeCount(15, "Label19", 3L);
     visitor.VisitNodeCount(16, "Label3", 0L);
     visitor.VisitNodeCount(17, "Label16", 0L);
     visitor.VisitNodeCount(18, "Label15", 0L);
     visitor.VisitNodeCount(19, "Label21", 0L);
     visitor.VisitNodeCount(20, "Label5", 0L);
     visitor.VisitNodeCount(22, "Label2", 310059L);
     visitor.VisitNodeCount(23, "Label11", 179015L);
     visitor.VisitNodeCount(24, "Label13", 99917L);
     visitor.VisitNodeCount(25, "Label17", 179021L);
     visitor.VisitNodeCount(26, "Label25", 3L);
     visitor.VisitNodeCount(27, "Label9", 111150L);
     visitor.VisitNodeCount(28, "Label23", 0L);
     visitor.VisitNodeCount(29, "Label7", 0L);
     visitor.VisitNodeCount(31, "Label27", 1567352L);
     visitor.VisitRelCount(-1, -1, -1, "MATCH ()-[]->() RETURN count(*)", 4944492L);
 }
Beispiel #20
0
 private StoreIndexDescriptor NewIndexRule(long id, int label, int propertyKey)
 {
     return(TestIndexDescriptorFactory.forLabel(label, propertyKey).withId(id));
 }
 public SimpleRandomizedIndexAccessorCompatibility(IndexProviderCompatibilityTestSuite testSuite) : base(testSuite, TestIndexDescriptorFactory.forLabel(1000, 100))
 {
 }
Beispiel #22
0
 public Exact(IndexProviderCompatibilityTestSuite testSuite) : base(testSuite, TestIndexDescriptorFactory.forLabel(1000, 100, 101, 102, 103))
 {
     // composite index of 4 properties
 }
Beispiel #23
0
        private void InitializeInstanceFields()
        {
            _writer = new LogEntryWriter(_inMemoryChannel);
            NeoStoreRecord after = new NeoStoreRecord();

            after.NextProp = 42;
            _permutations[typeof(Command.NeoStoreCommand)]              = new Command[] { new Command.NeoStoreCommand(new NeoStoreRecord(), after) };
            _permutations[typeof(Command.NodeCommand)]                  = new Command[] { new Command.NodeCommand(new NodeRecord(12L, false, 13L, 13L), new NodeRecord(0, false, 0, 0)) };
            _permutations[typeof(Command.RelationshipCommand)]          = new Command[] { new Command.RelationshipCommand(new RelationshipRecord(1L), new RelationshipRecord(1L, 2L, 3L, 4)) };
            _permutations[typeof(Command.PropertyCommand)]              = new Command[] { new Command.PropertyCommand(new PropertyRecord(1, new NodeRecord(12L, false, 13L, 13)), new PropertyRecord(1, new NodeRecord(12L, false, 13L, 13))) };
            _permutations[typeof(Command.RelationshipGroupCommand)]     = new Command[] { new Command.LabelTokenCommand(new LabelTokenRecord(1), CreateLabelTokenRecord(1)) };
            _permutations[typeof(Command.SchemaRuleCommand)]            = new Command[] { new Command.SchemaRuleCommand(singletonList(dynamicRecord(1L, false, true, -1L, 1, "hello".GetBytes())), singletonList(dynamicRecord(1L, true, true, -1L, 1, "hello".GetBytes())), TestIndexDescriptorFactory.forLabel(3, 4).withId(1)) };
            _permutations[typeof(Command.RelationshipTypeTokenCommand)] = new Command[] { new Command.RelationshipTypeTokenCommand(new RelationshipTypeTokenRecord(1), CreateRelationshipTypeTokenRecord(1)) };
            _permutations[typeof(Command.PropertyKeyTokenCommand)]      = new Command[] { new Command.PropertyKeyTokenCommand(new PropertyKeyTokenRecord(1), CreatePropertyKeyTokenRecord(1)) };
            _permutations[typeof(Command.LabelTokenCommand)]            = new Command[] { new Command.LabelTokenCommand(new LabelTokenRecord(1), CreateLabelTokenRecord(1)) };

            // Index commands
            IndexCommand.AddRelationshipCommand addRelationshipCommand = new IndexCommand.AddRelationshipCommand();
            addRelationshipCommand.Init(1, 1L, 12345, "some value", 1, 1);
            _permutations[typeof(IndexCommand.AddRelationshipCommand)] = new Command[] { addRelationshipCommand };

            IndexCommand.CreateCommand createCommand = new IndexCommand.CreateCommand();
            createCommand.Init(1, IndexEntityType.Relationship.id(), MapUtil.stringMap("string1", "string 2"));
            _permutations[typeof(IndexCommand.CreateCommand)] = new Command[] { createCommand };

            IndexCommand.AddNodeCommand addCommand = new IndexCommand.AddNodeCommand();
            addCommand.Init(1234, 122L, 2, "value");
            _permutations[typeof(IndexCommand.AddNodeCommand)] = new Command[] { addCommand };

            IndexCommand.DeleteCommand deleteCommand = new IndexCommand.DeleteCommand();
            deleteCommand.Init(1, IndexEntityType.Relationship.id());
            _permutations[typeof(IndexCommand.DeleteCommand)] = new Command[] { deleteCommand };

            IndexCommand.RemoveCommand removeCommand = new IndexCommand.RemoveCommand();
            removeCommand.Init(1, IndexEntityType.Node.id(), 126, (sbyte)3, "the value");
            _permutations[typeof(IndexCommand.RemoveCommand)] = new Command[] { removeCommand };

            IndexDefineCommand indexDefineCommand = new IndexDefineCommand();

            indexDefineCommand.Init(ObjectIntHashMap.newWithKeysValues("string1", 45, "key1", 2), ObjectIntHashMap.newWithKeysValues("string", 2));
            _permutations[typeof(IndexDefineCommand)] = new Command[] { indexDefineCommand };

            // Counts commands
            _permutations[typeof(Command.NodeCountsCommand)]         = new Command[] { new Command.NodeCountsCommand(42, 11) };
            _permutations[typeof(Command.RelationshipCountsCommand)] = new Command[] { new Command.RelationshipCountsCommand(17, 2, 13, -2) };
        }
        private void InitiateMocks()
        {
            IndexSlot[] activeSlots = FusionVersion.aliveSlots();
            _readers = new Dictionary <IndexSlot, IndexReader>(typeof(IndexSlot));
            fill(_readers, IndexReader.EMPTY);
            _aliveReaders = new IndexReader[activeSlots.Length];
            for (int i = 0; i < activeSlots.Length; i++)
            {
                IndexReader mock = mock(typeof(IndexReader));
                _aliveReaders[i] = mock;
                switch (activeSlots[i])
                {
                case STRING:
                    _readers[STRING] = mock;
                    break;

                case NUMBER:
                    _readers[NUMBER] = mock;
                    break;

                case SPATIAL:
                    _readers[SPATIAL] = mock;
                    break;

                case TEMPORAL:
                    _readers[TEMPORAL] = mock;
                    break;

                case LUCENE:
                    _readers[LUCENE] = mock;
                    break;

                default:
                    throw new Exception();
                }
            }
            _fusionIndexReader = new FusionIndexReader(FusionVersion.slotSelector(), new LazyInstanceSelector <IndexReader>(_readers, ThrowingFactory()), TestIndexDescriptorFactory.forLabel(LABEL_KEY, PROP_KEY));
        }
Beispiel #25
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFormatIndexDescriptors()
        public virtual void ShouldFormatIndexDescriptors()
        {
            assertEquals("IndexDescriptorFactory.forSchema( SchemaDescriptorFactory.forLabel( 23, 42 ) )", FormatArgument(TestIndexDescriptorFactory.forLabel(23, 42)));
        }
Beispiel #26
0
 private void InitializeInstanceFields()
 {
     _descriptor = TestIndexDescriptorFactory.forLabel(_labelId, _propertyKeyIds);
 }
Beispiel #27
0
 private IndexPopulation AddPopulator(MultipleIndexPopulator multipleIndexPopulator, IndexPopulator indexPopulator, int id, FlippableIndexProxy flippableIndexProxy, FailedIndexProxyFactory failedIndexProxyFactory)
 {
     return(AddPopulator(multipleIndexPopulator, TestIndexDescriptorFactory.forLabel(id, id).withId(id), indexPopulator, flippableIndexProxy, failedIndexProxyFactory));
 }
Beispiel #28
0
 private IndexDescriptor UniqueIndexDescriptor(string label, string property)
 {
     return(TestIndexDescriptorFactory.uniqueForLabel(LabelId(label), PropId(property)));
 }
Beispiel #29
0
 public Range(IndexProviderCompatibilityTestSuite testSuite) : base(testSuite, TestIndexDescriptorFactory.forLabel(1000, 100, 101))
 {
     // composite index of 2 properties
 }