//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void updatesShouldEqualRegardlessOfCreationMethod() public virtual void UpdatesShouldEqualRegardlessOfCreationMethod() { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: IndexEntryUpdate<?> singleAdd = IndexEntryUpdate.add(0, org.neo4j.kernel.api.schema.SchemaDescriptorFactory.forLabel(3, 4), singleValue); IndexEntryUpdate <object> singleAdd = IndexEntryUpdate.Add(0, SchemaDescriptorFactory.forLabel(3, 4), _singleValue); Value[] singleAsArray = new Value[] { _singleValue }; //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: IndexEntryUpdate<?> multiAdd = IndexEntryUpdate.add(0, org.neo4j.kernel.api.schema.SchemaDescriptorFactory.forLabel(3, 4), singleAsArray); IndexEntryUpdate <object> multiAdd = IndexEntryUpdate.Add(0, SchemaDescriptorFactory.forLabel(3, 4), singleAsArray); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: IndexEntryUpdate<?> singleRemove = IndexEntryUpdate.remove(0, org.neo4j.kernel.api.schema.SchemaDescriptorFactory.forLabel(3, 4), singleValue); IndexEntryUpdate <object> singleRemove = IndexEntryUpdate.Remove(0, SchemaDescriptorFactory.forLabel(3, 4), _singleValue); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: IndexEntryUpdate<?> multiRemove = IndexEntryUpdate.remove(0, org.neo4j.kernel.api.schema.SchemaDescriptorFactory.forLabel(3, 4), singleAsArray); IndexEntryUpdate <object> multiRemove = IndexEntryUpdate.Remove(0, SchemaDescriptorFactory.forLabel(3, 4), singleAsArray); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: IndexEntryUpdate<?> singleChange = IndexEntryUpdate.change(0, org.neo4j.kernel.api.schema.SchemaDescriptorFactory.forLabel(3, 4), singleValue, singleValue); IndexEntryUpdate <object> singleChange = IndexEntryUpdate.Change(0, SchemaDescriptorFactory.forLabel(3, 4), _singleValue, _singleValue); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: IndexEntryUpdate<?> multiChange = IndexEntryUpdate.change(0, org.neo4j.kernel.api.schema.SchemaDescriptorFactory.forLabel(3, 4), singleAsArray, singleAsArray); IndexEntryUpdate <object> multiChange = IndexEntryUpdate.Change(0, SchemaDescriptorFactory.forLabel(3, 4), singleAsArray, singleAsArray); assertThat(singleAdd, equalTo(multiAdd)); assertThat(singleRemove, equalTo(multiRemove)); assertThat(singleChange, equalTo(multiChange)); }
/// <summary> /// All entries in composite index look like (booleanValue, randomValue ). /// Range queries in composite only work if all predicates before it is exact. /// We use boolean values for exact part so that we get some real ranges to work /// on in second composite slot where the random values are. /// </summary> //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testRangeMatchOnRandomValues() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TestRangeMatchOnRandomValues() { Assume.assumeTrue("Assume support for granular composite queries", TestSuite.supportsGranularCompositeQueries()); // given ValueType[] types = RandomSetOfSupportedAndSortableTypes(); ISet <ValueTuple> uniqueValues = new HashSet <ValueTuple>(); SortedSet <ValueAndId> sortedValues = new SortedSet <ValueAndId>((v1, v2) => ValueTuple.COMPARATOR.Compare(v1.value, v2.value)); MutableLong nextId = new MutableLong(); for (int i = 0; i < 5; i++) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.List<IndexEntryUpdate<?>> updates = new java.util.ArrayList<>(); IList <IndexEntryUpdate <object> > updates = new List <IndexEntryUpdate <object> >(); if (i == 0) { // The initial batch of data can simply be additions updates = GenerateUpdatesFromValues(GenerateValuesFromType(types, uniqueValues, 20_000), nextId); sortedValues.addAll(updates.Select(u => new ValueAndId(ValueTuple.of(u.values()), u.EntityId)).ToList()); } else { // Then do all sorts of updates for (int j = 0; j < 1_000; j++) { int type = Random.intBetween(0, 2); if (type == 0) { // add ValueTuple value = GenerateUniqueRandomValue(types, uniqueValues); long id = nextId.AndIncrement; sortedValues.Add(new ValueAndId(value, id)); updates.Add(IndexEntryUpdate.Add(id, Descriptor.schema(), value.Values)); } else if (type == 1) { // update ValueAndId existing = Random.among(sortedValues.toArray(new ValueAndId[0])); sortedValues.remove(existing); ValueTuple newValue = GenerateUniqueRandomValue(types, uniqueValues); uniqueValues.remove(existing.Value); sortedValues.Add(new ValueAndId(newValue, existing.Id)); updates.Add(IndexEntryUpdate.Change(existing.Id, Descriptor.schema(), existing.Value.Values, newValue.Values)); } else { // remove ValueAndId existing = Random.among(sortedValues.toArray(new ValueAndId[0])); sortedValues.remove(existing); uniqueValues.remove(existing.Value); updates.Add(IndexEntryUpdate.Remove(existing.Id, Descriptor.schema(), existing.Value.Values)); } } } UpdateAndCommit(updates); VerifyRandomRanges(types, sortedValues); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void changedShouldRetainValues() public virtual void ChangedShouldRetainValues() { Value singleAfter = Values.of("Hello"); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: IndexEntryUpdate<?> singleChange = IndexEntryUpdate.change(0, org.neo4j.kernel.api.schema.SchemaDescriptorFactory.forLabel(3, 4), singleValue, singleAfter); IndexEntryUpdate <object> singleChange = IndexEntryUpdate.Change(0, SchemaDescriptorFactory.forLabel(3, 4), _singleValue, singleAfter); Value[] multiAfter = new Value[] { Values.of("Hello"), Values.of("Hi") }; //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: IndexEntryUpdate<?> multiChange = IndexEntryUpdate.change(0, org.neo4j.kernel.api.schema.SchemaDescriptorFactory.forLabel(3, 4, 5), multiValue, multiAfter); IndexEntryUpdate <object> multiChange = IndexEntryUpdate.Change(0, SchemaDescriptorFactory.forLabel(3, 4, 5), _multiValue, multiAfter); assertThat(new object[] { _singleValue }, equalTo(singleChange.BeforeValues())); assertThat(new object[] { singleAfter }, equalTo(singleChange.Values())); assertThat(_multiValue, equalTo(multiChange.BeforeValues())); assertThat(multiAfter, equalTo(multiChange.Values())); }
public static IndexEntryUpdate <SchemaDescriptor> Change(long nodeId, SchemaDescriptor schema, object[] o1, object[] o2) { return(IndexEntryUpdate.Change(nodeId, schema, ToValues(o1), ToValues(o2))); }
//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() }))); }
//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 }))); }