Exemple #1
0
//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);
            }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMakeCompositeEntryConflicts()
        public virtual void ShouldMakeCompositeEntryConflicts()
        {
            LabelSchemaDescriptor       schema = SchemaDescriptorFactory.forLabel(LABEL_ID, 2, 3, 4);
            ValueTuple                  values = ValueTuple.of(true, "hi", new long[] { 6L, 4L });
            IndexEntryConflictException e      = new IndexEntryConflictException(0L, 1L, values);

            assertThat(e.EvidenceMessage(SchemaUtil.idTokenNameLookup, schema), equalTo("Both Node(0) and Node(1) have the label `label[1]` " + "and properties `property[2]` = true, `property[3]` = 'hi', `property[4]` = [6, 4]"));
        }
Exemple #3
0
 public static ValueTuple AsValueTuple(params IndexQuery.ExactPredicate[] query)
 {
     Value[] values = new Value[query.Length];
     for (int i = 0; i < query.Length; i++)
     {
         values[i] = query[i].Value();
     }
     return(ValueTuple.of(values));
 }
Exemple #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: void doReportConflict(long existingNodeId, long addedNodeId, org.neo4j.values.storable.Value[] values) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        internal override void DoReportConflict(long existingNodeId, long addedNodeId, Value[] values)
        {
            throw new IndexEntryConflictException(existingNodeId, addedNodeId, ValueTuple.of(values));
        }