コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void applyConcurrentDeletesToPopulatedIndex() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ApplyConcurrentDeletesToPopulatedIndex()
        {
            IList <EntityUpdates> updates = new List <EntityUpdates>(2);

            updates.Add(EntityUpdates.forEntity(_country1.Id, false).withTokens(Id(COUNTRY_LABEL)).removed(_propertyId, Values.of("Sweden")).build());
            updates.Add(EntityUpdates.forEntity(_color2.Id, false).withTokens(Id(COLOR_LABEL)).removed(_propertyId, Values.of("green")).build());

            LaunchCustomIndexPopulation(_labelsNameIdMap, _propertyId, new UpdateGenerator(this, updates));
            WaitAndActivateIndexes(_labelsNameIdMap, _propertyId);

            using (Transaction ignored = EmbeddedDatabase.beginTx())
            {
                int?countryLabelId = _labelsNameIdMap[COUNTRY_LABEL];
                int?colorLabelId   = _labelsNameIdMap[COLOR_LABEL];
                using (IndexReader indexReader = GetIndexReader(_propertyId, countryLabelId))
                {
                    assertEquals("Should be removed by concurrent remove.", 0, indexReader.CountIndexedNodes(0, new int[] { _propertyId }, Values.of("Sweden")));
                }

                using (IndexReader indexReader = GetIndexReader(_propertyId, colorLabelId))
                {
                    assertEquals("Should be removed by concurrent remove.", 0, indexReader.CountIndexedNodes(3, new int[] { _propertyId }, Values.of("green")));
                }
            }
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void processAllRelationshipProperties() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ProcessAllRelationshipProperties()
        {
            CreateAlistairAndStefanNodes();
            CopyUpdateVisitor     propertyUpdateVisitor = new CopyUpdateVisitor();
            RelationshipStoreScan relationshipStoreScan = new RelationshipStoreScan(new RecordStorageReader(_neoStores), _locks, propertyUpdateVisitor, new int[] { _relTypeId }, id => true);

            using (StorageRelationshipScanCursor relationshipScanCursor = _reader.allocateRelationshipScanCursor())
            {
                relationshipScanCursor.Single(1);
                relationshipScanCursor.Next();

                relationshipStoreScan.process(relationshipScanCursor);
            }

            EntityUpdates propertyUpdates = propertyUpdateVisitor.PropertyUpdates;

            assertNotNull("Visitor should contain container with updates.", propertyUpdates);

            RelationTypeSchemaDescriptor         index1  = SchemaDescriptorFactory.forRelType(0, 2);
            RelationTypeSchemaDescriptor         index2  = SchemaDescriptorFactory.forRelType(0, 3);
            RelationTypeSchemaDescriptor         index3  = SchemaDescriptorFactory.forRelType(0, 2, 3);
            RelationTypeSchemaDescriptor         index4  = SchemaDescriptorFactory.forRelType(1, 3);
            IList <RelationTypeSchemaDescriptor> indexes = Arrays.asList(index1, index2, index3, index4);

//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            assertThat(Iterables.map(IndexEntryUpdate::indexKey, propertyUpdates.ForIndexKeys(indexes)), containsInAnyOrder(index1, index2, index3));
        }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void applyConcurrentAddsToPopulatedIndex() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ApplyConcurrentAddsToPopulatedIndex()
        {
            IList <EntityUpdates> updates = new List <EntityUpdates>(2);

            updates.Add(EntityUpdates.forEntity(_otherNodes[0].Id, false).withTokens(Id(COUNTRY_LABEL)).added(_propertyId, Values.of("Denmark")).build());
            updates.Add(EntityUpdates.forEntity(_otherNodes[1].Id, false).withTokens(Id(CAR_LABEL)).added(_propertyId, Values.of("BMW")).build());

            LaunchCustomIndexPopulation(_labelsNameIdMap, _propertyId, new UpdateGenerator(this, updates));
            WaitAndActivateIndexes(_labelsNameIdMap, _propertyId);

            using (Transaction ignored = EmbeddedDatabase.beginTx())
            {
                int?countryLabelId = _labelsNameIdMap[COUNTRY_LABEL];
                int?carLabelId     = _labelsNameIdMap[CAR_LABEL];
                using (IndexReader indexReader = GetIndexReader(_propertyId, countryLabelId))
                {
                    assertEquals("Should be added by concurrent add.", 1, indexReader.CountIndexedNodes(_otherNodes[0].Id, new int[] { _propertyId }, Values.of("Denmark")));
                }

                using (IndexReader indexReader = GetIndexReader(_propertyId, carLabelId))
                {
                    assertEquals("Should be added by concurrent add.", 1, indexReader.CountIndexedNodes(_otherNodes[1].Id, new int[] { _propertyId }, Values.of("BMW")));
                }
            }
        }
コード例 #4
0
        public void Prepare(BaseSimulation simulation)
        {
            if (simulation == null)
            {
                throw new ArgumentNullException(nameof(simulation));
            }

            simulation.BeforeSetup += (obj, args) =>
            {
                foreach (var action in BeforeSetup)
                {
                    action(simulation);
                }
            };

            simulation.AfterSetup += (obj, args) =>
            {
                foreach (var action in AfterSetup)
                {
                    action(simulation);
                }
            };

            SimulationUpdates.Apply(simulation);
            EntityUpdates.Apply(simulation);
        }
コード例 #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean process(org.neo4j.storageengine.api.StorageNodeCursor cursor) throws FAILURE
        public override bool Process(StorageNodeCursor cursor)
        {
            long[] labels = cursor.Labels();
            if (labels.Length == 0 && LabelIds.Length != 0)
            {
                // This node has no labels at all
                return(false);
            }

            if (_labelUpdateVisitor != null)
            {
                // Notify the label update visitor
                _labelUpdateVisitor.visit(labelChanges(cursor.EntityReference(), EMPTY_LONG_ARRAY, labels));
            }

            if (_propertyUpdatesVisitor != null && containsAnyEntityToken(LabelIds, labels))
            {
                // Notify the property update visitor
                EntityUpdates.Builder updates = EntityUpdates.forEntity(cursor.EntityReference(), true).withTokens(labels);

                if (hasRelevantProperty(cursor, updates))
                {
                    return(_propertyUpdatesVisitor.visit(updates.Build()));
                }
            }
            return(false);
        }
コード例 #6
0
        public override EntityUpdates NodeAsUpdates(long nodeId)
        {
            NodeRecord node = NodeStore.getRecord(nodeId, NodeStore.newRecord(), FORCE);

            if (!node.InUse())
            {
                return(null);
            }
            long firstPropertyId = node.NextProp;

            if (firstPropertyId == Record.NO_NEXT_PROPERTY.intValue())
            {
                return(null);                        // no properties => no updates (it's not going to be in any index)
            }
            long[] labels = parseLabelsField(node).get(NodeStore);
            if (labels.Length == 0)
            {
                return(null);                        // no labels => no updates (it's not going to be in any index)
            }
            EntityUpdates.Builder update = EntityUpdates.forEntity(nodeId, true).withTokens(labels);
            foreach (PropertyRecord propertyRecord in PropertyStore.getPropertyRecordChain(firstPropertyId))
            {
                foreach (PropertyBlock property in propertyRecord)
                {
                    Value value = property.Type.value(property, PropertyStore);
                    update.Added(property.KeyIndexId, value);
                }
            }
            return(update.Build());
        }
コード例 #7
0
 public SimulationPreparations(EntityUpdates entityUpdates, SimulationsUpdates simulationUpdates)
 {
     EntityUpdates     = entityUpdates ?? throw new ArgumentNullException(nameof(entityUpdates));
     SimulationUpdates = simulationUpdates ?? throw new ArgumentNullException(nameof(simulationUpdates));
     BeforeSetup       = new List <Action <BaseSimulation> >();
     AfterSetup        = new List <Action <BaseSimulation> >();
 }
コード例 #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void applyConcurrentChangesToPopulatedIndex() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ApplyConcurrentChangesToPopulatedIndex()
        {
            IList <EntityUpdates> updates = new List <EntityUpdates>(2);

            updates.Add(EntityUpdates.forEntity(_color2.Id, false).withTokens(Id(COLOR_LABEL)).changed(_propertyId, Values.of("green"), Values.of("pink")).build());
            updates.Add(EntityUpdates.forEntity(_car2.Id, false).withTokens(Id(CAR_LABEL)).changed(_propertyId, Values.of("Ford"), Values.of("SAAB")).build());

            LaunchCustomIndexPopulation(_labelsNameIdMap, _propertyId, new UpdateGenerator(this, updates));
            WaitAndActivateIndexes(_labelsNameIdMap, _propertyId);

            using (Transaction ignored = EmbeddedDatabase.beginTx())
            {
                int?colorLabelId = _labelsNameIdMap[COLOR_LABEL];
                int?carLabelId   = _labelsNameIdMap[CAR_LABEL];
                using (IndexReader indexReader = GetIndexReader(_propertyId, colorLabelId))
                {
                    assertEquals(format("Should be deleted by concurrent change. Reader is: %s, ", indexReader), 0, indexReader.CountIndexedNodes(_color2.Id, new int[] { _propertyId }, Values.of("green")));
                }
                using (IndexReader indexReader = GetIndexReader(_propertyId, colorLabelId))
                {
                    assertEquals("Should be updated by concurrent change.", 1, indexReader.CountIndexedNodes(_color2.Id, new int[] { _propertyId }, Values.of("pink")));
                }

                using (IndexReader indexReader = GetIndexReader(_propertyId, carLabelId))
                {
                    assertEquals("Should be added by concurrent change.", 1, indexReader.CountIndexedNodes(_car2.Id, new int[] { _propertyId }, Values.of("SAAB")));
                }
            }
        }
コード例 #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void processAllNodeProperties() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ProcessAllNodeProperties()
        {
            CopyUpdateVisitor      propertyUpdateVisitor  = new CopyUpdateVisitor();
            StoreViewNodeStoreScan storeViewNodeStoreScan = new StoreViewNodeStoreScan(new RecordStorageReader(_neoStores), _locks, null, propertyUpdateVisitor, new int[] { _labelId }, id => true);

            using (StorageNodeCursor nodeCursor = _reader.allocateNodeCursor())
            {
                nodeCursor.Single(1);
                nodeCursor.Next();

                storeViewNodeStoreScan.process(nodeCursor);
            }

            EntityUpdates propertyUpdates = propertyUpdateVisitor.PropertyUpdates;

            assertNotNull("Visitor should contain container with updates.", propertyUpdates);

            LabelSchemaDescriptor         index1  = SchemaDescriptorFactory.forLabel(0, 0);
            LabelSchemaDescriptor         index2  = SchemaDescriptorFactory.forLabel(0, 1);
            LabelSchemaDescriptor         index3  = SchemaDescriptorFactory.forLabel(0, 0, 1);
            LabelSchemaDescriptor         index4  = SchemaDescriptorFactory.forLabel(1, 1);
            IList <LabelSchemaDescriptor> indexes = Arrays.asList(index1, index2, index3, index4);

//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            assertThat(Iterables.map(IndexEntryUpdate::indexKey, propertyUpdates.ForIndexKeys(indexes)), containsInAnyOrder(index1, index2, index3));
        }
コード例 #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGenerateUpdateForWhenCompletingCompositeSchemaIndexUpdate()
        public virtual void ShouldGenerateUpdateForWhenCompletingCompositeSchemaIndexUpdate()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_label).withTokensAfter(_label).added(PROPERTY_KEY_ID1, Values.of("Neo")).added(PROPERTY_KEY_ID3, Values.pointValue(CoordinateReferenceSystem.WGS84, 12.3, 45.6)).build();

            // Then
            assertThat(updates.ForIndexKeys(singleton(_index123), PropertyLoader(_property2), EntityType.NODE), containsInAnyOrder(IndexEntryUpdate.Add(NODE_ID, _index123, _values123)));
        }
コード例 #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotGenerateUpdatesForLabelAdditionWithNoProperties()
        public virtual void ShouldNotGenerateUpdatesForLabelAdditionWithNoProperties()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_empty).withTokensAfter(_label).build();

            // Then
            assertThat(updates.ForIndexKeys(_indexes, PropertyLoader(), EntityType.NODE), emptyIterable());
        }
コード例 #12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotGenerateUpdateForMultipleExistingPropertiesAndLabels()
        public virtual void ShouldNotGenerateUpdateForMultipleExistingPropertiesAndLabels()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_label).existing(PROPERTY_KEY_ID1, Values.of("Neo")).existing(PROPERTY_KEY_ID2, Values.of(100L)).existing(PROPERTY_KEY_ID3, Values.pointValue(CoordinateReferenceSystem.WGS84, 12.3, 45.6)).build();

            // Then
            assertThat(updates.ForIndexKeys(_indexes, AssertNoLoading(), EntityType.NODE), emptyIterable());
        }
コード例 #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotGenerateUpdatesForEmptyNodeUpdates()
        public virtual void ShouldNotGenerateUpdatesForEmptyNodeUpdates()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).build();

            // Then
            assertThat(updates.ForIndexKeys(_indexes, AssertNoLoading(), EntityType.NODE), emptyIterable());
        }
コード例 #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGenerateUpdateWhenRemovingLastTokenForNonSchemaIndex()
        public virtual void ShouldGenerateUpdateWhenRemovingLastTokenForNonSchemaIndex()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_label).withTokensAfter(_empty).build();

            // Then
            assertThat(updates.ForIndexKeys(singleton(_nonSchemaIndex), PropertyLoader(_property1, _property2, _property3), EntityType.NODE), containsInAnyOrder(IndexEntryUpdate.Remove(NODE_ID, _nonSchemaIndex, _values123)));
        }
コード例 #15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGenerateUpdatesForLabelAdditionWithExistingProperties()
        public virtual void ShouldGenerateUpdatesForLabelAdditionWithExistingProperties()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_empty).withTokensAfter(_label).existing(PROPERTY_KEY_ID1, Values.of("Neo")).existing(PROPERTY_KEY_ID2, Values.of(100L)).existing(PROPERTY_KEY_ID3, Values.pointValue(CoordinateReferenceSystem.WGS84, 12.3, 45.6)).build();

            // Then
            assertThat(updates.ForIndexKeys(_indexes, PropertyLoader(_property1, _property2, _property3), EntityType.NODE), containsInAnyOrder(IndexEntryUpdate.Add(NODE_ID, _index1, _property1.value()), IndexEntryUpdate.Add(NODE_ID, _index2, _property2.value()), IndexEntryUpdate.Add(NODE_ID, _index3, _property3.value()), IndexEntryUpdate.Add(NODE_ID, _index123, _values123)));
        }
コード例 #16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotGenerateUpdatesForPropertyAdditionWithNoLabels()
        public virtual void ShouldNotGenerateUpdatesForPropertyAdditionWithNoLabels()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).added(_property1.propertyKeyId(), _property1.value()).build();

            // Then
            assertThat(updates.ForIndexKeys(_indexes, AssertNoLoading(), EntityType.NODE), emptyIterable());
        }
コード例 #17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGenerateUpdateForFullNonSchemaIndexUpdate()
        public virtual void ShouldGenerateUpdateForFullNonSchemaIndexUpdate()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_label).withTokensAfter(_label).added(_property1.propertyKeyId(), _property1.value()).added(_property2.propertyKeyId(), _property2.value()).added(_property3.propertyKeyId(), _property3.value()).build();

            // Then
            assertThat(updates.ForIndexKeys(singleton(_nonSchemaIndex), PropertyLoader(), EntityType.NODE), containsInAnyOrder(IndexEntryUpdate.Add(NODE_ID, _nonSchemaIndex, _values123)));
        }
コード例 #18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGenerateUpdateForPartialNonSchemaIndexUpdate()
        public virtual void ShouldGenerateUpdateForPartialNonSchemaIndexUpdate()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_label).withTokensAfter(_label).added(PROPERTY_KEY_ID1, Values.of("Neo")).build();

            // Then
            assertThat(updates.ForIndexKeys(singleton(_nonSchemaIndex), PropertyLoader(), EntityType.NODE), containsInAnyOrder(IndexEntryUpdate.Add(NODE_ID, _nonSchemaIndex, _property1.value(), null, null)));
        }
コード例 #19
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotLoadPropertyForNoLabelsAndButPropertyAddition()
        public virtual void ShouldNotLoadPropertyForNoLabelsAndButPropertyAddition()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_empty).added(_property1.propertyKeyId(), _property1.value()).build();

            // Then
            assertThat(updates.ForIndexKeys(singleton(_index1), AssertNoLoading(), EntityType.NODE), emptyIterable());
        }
コード例 #20
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotLoadPropertyForLabelsAndNoPropertyChanges()
        public virtual void ShouldNotLoadPropertyForLabelsAndNoPropertyChanges()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_label).build();

            // Then
            assertThat(updates.ForIndexKeys(singleton(_index1), AssertNoLoading(), EntityType.NODE), emptyIterable());
        }
コード例 #21
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotGenerateUpdatesForLabelRemoveAndPropertyAdd()
        public virtual void ShouldNotGenerateUpdatesForLabelRemoveAndPropertyAdd()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_label).withTokensAfter(_empty).added(_property1.propertyKeyId(), _property1.value()).added(_property2.propertyKeyId(), _property2.value()).added(_property3.propertyKeyId(), _property3.value()).build();

            // Then
            assertThat(updates.ForIndexKeys(_indexes, AssertNoLoading(), EntityType.NODE), emptyIterable());
        }
コード例 #22
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGenerateUpdatesForMultiplePropertyAdditionWithLabels()
        public virtual void ShouldGenerateUpdatesForMultiplePropertyAdditionWithLabels()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_label).added(_property1.propertyKeyId(), _property1.value()).added(_property2.propertyKeyId(), _property2.value()).added(_property3.propertyKeyId(), _property3.value()).build();

            // Then
            assertThat(updates.ForIndexKeys(_indexes, PropertyLoader(_property1, _property2, _property3), EntityType.NODE), containsInAnyOrder(IndexEntryUpdate.Add(NODE_ID, _index1, _property1.value()), IndexEntryUpdate.Add(NODE_ID, _index2, _property2.value()), IndexEntryUpdate.Add(NODE_ID, _index3, _property3.value()), IndexEntryUpdate.Add(NODE_ID, _index123, _values123)));
        }
コード例 #23
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotGenerateUpdateWhenAddingAnotherUselessTokenForNonSchemaIndex()
        public virtual void ShouldNotGenerateUpdateWhenAddingAnotherUselessTokenForNonSchemaIndex()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_label).withTokensAfter(LABEL_ID1, UNUSED_LABEL_ID).build();

            // Then
            assertThat(updates.ForIndexKeys(singleton(_nonSchemaIndex), PropertyLoader(_property1, _property2, _property3), EntityType.NODE), emptyIterable());
        }
コード例 #24
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGenerateUpdatesForLabelRemovalWithExistingProperties()
        public virtual void ShouldGenerateUpdatesForLabelRemovalWithExistingProperties()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_label).withTokensAfter(_empty).build();

            // Then
            assertThat(updates.ForIndexKeys(_indexes, PropertyLoader(_property1, _property2, _property3), EntityType.NODE), containsInAnyOrder(IndexEntryUpdate.Remove(NODE_ID, _index1, _property1.value()), IndexEntryUpdate.Remove(NODE_ID, _index2, _property2.value()), IndexEntryUpdate.Remove(NODE_ID, _index3, _property3.value()), IndexEntryUpdate.Remove(NODE_ID, _index123, _values123)));
        }
コード例 #25
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGenerateUpdateWhenRemovingOnePropertyForNonSchemaIndex()
        public virtual void ShouldGenerateUpdateWhenRemovingOnePropertyForNonSchemaIndex()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_label).withTokensAfter(_label).removed(_property2.propertyKeyId(), _property2.value()).build();

            // Then
            assertThat(updates.ForIndexKeys(singleton(_nonSchemaIndex), PropertyLoader(_property1, _property2, _property3), EntityType.NODE), containsInAnyOrder(IndexEntryUpdate.Change(NODE_ID, _nonSchemaIndex, _values123, new Value[] { _property1.value(), null, _property3.value() })));
        }
コード例 #26
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotGenerateUpdateForPartialCompositeSchemaIndexUpdate()
        public virtual void ShouldNotGenerateUpdateForPartialCompositeSchemaIndexUpdate()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_label).withTokensAfter(_label).added(PROPERTY_KEY_ID1, Values.of("Neo")).added(PROPERTY_KEY_ID3, Values.pointValue(CoordinateReferenceSystem.WGS84, 12.3, 45.6)).build();

            // Then
            assertThat(updates.ForIndexKeys(singleton(_index123), PropertyLoader(), EntityType.NODE), emptyIterable());
        }
コード例 #27
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotGenerateUpdateWhenRemovingOneTokenForNonSchemaIndex()
        public virtual void ShouldNotGenerateUpdateWhenRemovingOneTokenForNonSchemaIndex()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_allLabels).withTokensAfter(_label).build();

            // Then
            assertThat(updates.ForIndexKeys(singleton(_nonSchemaIndex), PropertyLoader(_property1, _property2, _property3), EntityType.NODE), emptyIterable());
        }
コード例 #28
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGenerateUpdateForLabelAdditionWithExistingProperty()
        public virtual void ShouldGenerateUpdateForLabelAdditionWithExistingProperty()
        {
            // When
            EntityUpdates updates = EntityUpdates.forEntity(NODE_ID, false).withTokens(_empty).withTokensAfter(_label).build();

            // Then
            assertThat(updates.ForIndexKeys(_indexes, PropertyLoader(_property1), EntityType.NODE), containsInAnyOrder(IndexEntryUpdate.Add(NODE_ID, _index1, _property1.value())));
        }
コード例 #29
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGenerateUpdateForAllChangedNonSchemaIndex()
        public virtual void ShouldGenerateUpdateForAllChangedNonSchemaIndex()
        {
            // When
            Value         newValue1 = Values.of("Nio");
            Value         newValue2 = Values.of(10L);
            Value         newValue3 = Values.pointValue(CoordinateReferenceSystem.WGS84, 32.3, 15.6);
            EntityUpdates updates   = EntityUpdates.forEntity(NODE_ID, false).withTokens(_label).withTokensAfter(_label).changed(_property1.propertyKeyId(), _property1.value(), newValue1).changed(_property2.propertyKeyId(), _property2.value(), newValue2).changed(_property3.propertyKeyId(), _property3.value(), newValue3).build();

            // Then
            assertThat(updates.ForIndexKeys(singleton(_nonSchemaIndex), PropertyLoader(_property1, _property2, _property3), EntityType.NODE), containsInAnyOrder(IndexEntryUpdate.Change(NODE_ID, _nonSchemaIndex, _values123, new Value[] { newValue1, newValue2, newValue3 })));
        }
コード例 #30
0
        private void GatherUpdatesFor(long nodeId, Command.NodeCommand nodeCommand, EntityCommandGrouper <Command.NodeCommand> .Cursor propertyCommands)
        {
            EntityUpdates.Builder nodePropertyUpdate = GatherUpdatesFromCommandsForNode(nodeId, nodeCommand, propertyCommands);

            EntityUpdates entityUpdates = nodePropertyUpdate.Build();

            // we need to materialize the IndexEntryUpdates here, because when we
            // consume (later in separate thread) the store might have changed.
            foreach (IndexEntryUpdate <SchemaDescriptor> update in _updateService.convertToIndexUpdates(entityUpdates, EntityType.NODE))
            {
                _updates.Add(update);
            }
        }