//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldEnforceUniqueConstraintsDirectly() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldEnforceUniqueConstraintsDirectly() { // when IndexSamplingConfig indexSamplingConfig = new IndexSamplingConfig(Config.defaults()); WithPopulator(IndexProvider.getPopulator(Descriptor, indexSamplingConfig, heapBufferFactory(1024)), p => { try { p.add(Arrays.asList(IndexEntryUpdate.Add(NodeId1, Descriptor.schema(), Value1, Value2), IndexEntryUpdate.Add(NodeId2, Descriptor.schema(), Value1, Value2))); TestNodePropertyAccessor propertyAccessor = new TestNodePropertyAccessor(NodeId1, Descriptor.schema(), Value1, Value2); propertyAccessor.AddNode(NodeId2, Descriptor.schema(), Value1, Value2); p.scanCompleted(PhaseTracker.nullInstance); p.verifyDeferredConstraints(propertyAccessor); fail("expected exception"); } // then catch (IndexEntryConflictException conflict) { assertEquals(NodeId1, conflict.ExistingNodeId); assertEquals(ValueTuple.of(Value1, Value2), conflict.PropertyValues); assertEquals(NodeId2, conflict.AddedNodeId); } }, false); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotRestrictUpdatesDifferingOnSecondProperty() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotRestrictUpdatesDifferingOnSecondProperty() { // given IndexSamplingConfig indexSamplingConfig = new IndexSamplingConfig(Config.defaults()); WithPopulator(IndexProvider.getPopulator(Descriptor, indexSamplingConfig, heapBufferFactory(1024)), p => { // when p.add(Arrays.asList(IndexEntryUpdate.Add(NodeId1, Descriptor.schema(), Value1, Value2), IndexEntryUpdate.Add(NodeId2, Descriptor.schema(), Value1, Value3))); TestNodePropertyAccessor propertyAccessor = new TestNodePropertyAccessor(NodeId1, Descriptor.schema(), Value1, Value2); propertyAccessor.AddNode(NodeId2, Descriptor.schema(), Value1, Value3); // then this should pass fine p.verifyDeferredConstraints(propertyAccessor); }); }
/// <summary> /// This is also checked by the UniqueConstraintCompatibility test, only not on this abstraction level. /// </summary> //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldProvidePopulatorThatEnforcesUniqueConstraints() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldProvidePopulatorThatEnforcesUniqueConstraints() { // when Value value = Values.of("value1"); int nodeId1 = 1; int nodeId2 = 2; WithPopulator(IndexProvider.getPopulator(Descriptor, IndexSamplingConfig, heapBufferFactory(1024)), p => { try { p.add(Arrays.asList(add(nodeId1, Descriptor.schema(), value), add(nodeId2, Descriptor.schema(), value))); TestNodePropertyAccessor propertyAccessor = new TestNodePropertyAccessor(nodeId1, Descriptor.schema(), value); propertyAccessor.AddNode(nodeId2, Descriptor.schema(), value); p.scanCompleted(PhaseTracker.nullInstance); p.verifyDeferredConstraints(propertyAccessor); fail("expected exception"); } // then catch (Exception e) { Exception root = Exceptions.rootCause(e); if (root is IndexEntryConflictException) { IndexEntryConflictException conflict = ( IndexEntryConflictException )root; assertEquals(nodeId1, conflict.ExistingNodeId); assertEquals(ValueTuple.of(value), conflict.PropertyValues); assertEquals(nodeId2, conflict.AddedNodeId); } else { throw e; } } }, false); }