Ejemplo n.º 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);
            }
Ejemplo n.º 2
0
 internal IndexProxyCreator(IndexSamplingConfig samplingConfig, IndexStoreView storeView, IndexProviderMap providerMap, TokenNameLookup tokenNameLookup, LogProvider logProvider)
 {
     this._samplingConfig  = samplingConfig;
     this._storeView       = storeView;
     this._providerMap     = providerMap;
     this._tokenNameLookup = tokenNameLookup;
     this._logProvider     = logProvider;
 }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeEach void setUp()
        internal virtual void SetUp()
        {
            PartitionedIndexStorage indexStorage = new PartitionedIndexStorage(DirectoryFactory.PERSISTENT, _fileSystem, _testDirectory.directory());
            Config config = Config.defaults();
            IndexSamplingConfig samplingConfig = new IndexSamplingConfig(config);

            _luceneSchemaIndex = new ReadOnlyDatabaseSchemaIndex(indexStorage, TestIndexDescriptorFactory.forLabel(0, 0), samplingConfig, new ReadOnlyIndexPartitionFactory());
        }
Ejemplo n.º 4
0
        public override IndexPopulator GetPopulator(StoreIndexDescriptor descriptor, IndexSamplingConfig samplingConfig, ByteBufferFactory bufferFactory)
        {
            SchemaIndex luceneIndex = LuceneSchemaIndexBuilder.Create(descriptor, _config).withFileSystem(_fileSystem).withOperationalMode(_operationalMode).withSamplingConfig(samplingConfig).withIndexStorage(GetIndexStorage(descriptor.Id)).withWriterConfig(IndexWriterConfigs.population).build();

            if (luceneIndex.ReadOnly)
            {
                throw new System.NotSupportedException("Can't create populator for read only index");
            }
            if (descriptor.Type() == UNIQUE)
            {
                return(new UniqueLuceneIndexPopulator(luceneIndex, descriptor));
            }
            else
            {
                return(new NonUniqueLuceneIndexPopulator(luceneIndex, samplingConfig));
            }
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldProvidePopulatorThatAcceptsDuplicateEntries() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
            public virtual void ShouldProvidePopulatorThatAcceptsDuplicateEntries()
            {
                // when
                IndexSamplingConfig indexSamplingConfig = new IndexSamplingConfig(Config.defaults());

                WithPopulator(IndexProvider.getPopulator(Descriptor, indexSamplingConfig, heapBufferFactory(1024)), p => p.add(Arrays.asList(add(1, Descriptor.schema(), "v1", "v2"), add(2, Descriptor.schema(), "v1", "v2"))));

                // then
                using (IndexAccessor accessor = IndexProvider.getOnlineAccessor(Descriptor, indexSamplingConfig))
                {
                    using (IndexReader reader = new QueryResultComparingIndexReader(accessor.NewReader()))
                    {
                        LongIterator nodes = reader.Query(IndexQuery.exact(1, "v1"), IndexQuery.exact(1, "v2"));
                        assertEquals(asSet(1L, 2L), PrimitiveLongCollections.toSet(nodes));
                    }
                }
            }
Ejemplo n.º 6
0
//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);
                });
            }
Ejemplo n.º 7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.kernel.api.index.IndexAccessor onlineAccessorFromProvider(org.neo4j.storageengine.api.schema.StoreIndexDescriptor descriptor, org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig samplingConfig) throws java.io.IOException
        private IndexAccessor OnlineAccessorFromProvider(StoreIndexDescriptor descriptor, IndexSamplingConfig samplingConfig)
        {
            IndexProvider indexProvider = _providerMap.lookup(descriptor.ProviderDescriptor());

            return(indexProvider.GetOnlineAccessor(descriptor, samplingConfig));
        }
Ejemplo n.º 8
0
        private IndexPopulator PopulatorFromProvider(StoreIndexDescriptor descriptor, IndexSamplingConfig samplingConfig, ByteBufferFactory bufferFactory)
        {
            IndexProvider indexProvider = _providerMap.lookup(descriptor.ProviderDescriptor());

            return(indexProvider.GetPopulator(descriptor, samplingConfig, bufferFactory));
        }
Ejemplo n.º 9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.kernel.api.index.IndexAccessor getOnlineAccessor(org.neo4j.storageengine.api.schema.StoreIndexDescriptor descriptor, org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig samplingConfig) throws java.io.IOException
        public override IndexAccessor GetOnlineAccessor(StoreIndexDescriptor descriptor, IndexSamplingConfig samplingConfig)
        {
            SchemaIndex luceneIndex = LuceneSchemaIndexBuilder.Create(descriptor, _config).withOperationalMode(_operationalMode).withSamplingConfig(samplingConfig).withIndexStorage(GetIndexStorage(descriptor.Id)).build();

            luceneIndex.open();
            return(new LuceneIndexAccessor(luceneIndex, descriptor));
        }
Ejemplo n.º 10
0
 public override IndexAccessor GetOnlineAccessor(StoreIndexDescriptor indexConfig, IndexSamplingConfig samplingConfig)
 {
     WriterCallCount.incrementAndGet();
     _writerLatch.Signal();
     return(_mockedWriter);
 }
Ejemplo n.º 11
0
 public override IndexPopulator GetPopulator(StoreIndexDescriptor descriptor, IndexSamplingConfig samplingConfig, ByteBufferFactory bufferFactory)
 {
     PopulatorCallCount.incrementAndGet();
     return(_mockedPopulator);
 }
Ejemplo n.º 12
0
 public NonUniqueLuceneIndexPopulator(SchemaIndex luceneIndex, IndexSamplingConfig samplingConfig) : base(luceneIndex)
 {
     this._samplingConfig = samplingConfig;
     this._sampler        = CreateDefaultSampler();
 }
Ejemplo n.º 13
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.kernel.api.index.IndexAccessor getOnlineAccessor(org.neo4j.storageengine.api.schema.StoreIndexDescriptor descriptor, org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig samplingConfig) throws java.io.IOException
        public override IndexAccessor GetOnlineAccessor(StoreIndexDescriptor descriptor, IndexSamplingConfig samplingConfig)
        {
            return(new TrackingReadersIndexAccessor(_indexProvider.getOnlineAccessor(descriptor, samplingConfig)));
        }
Ejemplo n.º 14
0
 public override IndexPopulator GetPopulator(StoreIndexDescriptor descriptor, IndexSamplingConfig samplingConfig, ByteBufferFactory bufferFactory)
 {
     return(_indexProvider.getPopulator(descriptor, samplingConfig, bufferFactory));
 }