//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCreateConstraintIndexForSpecifiedProvider() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCreateConstraintIndexForSpecifiedProvider() { // given IndexingService indexingService = mock(typeof(IndexingService)); StubKernel kernel = new StubKernel(this); when(_schemaRead.indexGetCommittedId(_indexReference)).thenReturn(INDEX_ID); IndexProxy indexProxy = mock(typeof(IndexProxy)); when(indexingService.GetIndexProxy(INDEX_ID)).thenReturn(indexProxy); when(indexingService.getIndexProxy(_descriptor)).thenReturn(indexProxy); NodePropertyAccessor nodePropertyAccessor = mock(typeof(NodePropertyAccessor)); ConstraintIndexCreator creator = new ConstraintIndexCreator(() => kernel, indexingService, nodePropertyAccessor, _logProvider); IndexProviderDescriptor providerDescriptor = new IndexProviderDescriptor("Groovy", "1.2"); // when KernelTransactionImplementation transaction = CreateTransaction(); creator.CreateUniquenessConstraintIndex(transaction, _descriptor, providerDescriptor.Name()); // then assertEquals(1, kernel.Transactions.Count); KernelTransactionImplementation transactionInstance = kernel.Transactions[0]; verify(transactionInstance).indexUniqueCreate(eq(_descriptor), eq(providerDescriptor.Name())); verify(_schemaRead).index(_descriptor); verify(_schemaRead).indexGetCommittedId(any()); verifyNoMoreInteractions(_schemaRead); }
protected internal IndexProvider(IndexProviderDescriptor descriptor, IndexDirectoryStructure.Factory directoryStructureFactory) { this._directoryStructureFactory = directoryStructureFactory; Debug.Assert(descriptor != null); this._providerDescriptor = descriptor; this._directoryStructure = directoryStructureFactory.ForProvider(descriptor); }
public override IndexProvider Lookup(IndexProviderDescriptor providerDescriptor) { AssertInit(); IndexProvider provider = _indexProvidersByDescriptor[providerDescriptor]; AssertProviderFound(provider, providerDescriptor.Name()); return(provider); }
private StoreIndexDescriptor[] CreateIndexRules(IDictionary <string, int> labelNameIdMap, int propertyId) { IndexProvider lookup = IndexProviderMap.lookup(SchemaIndex.providerName()); IndexProviderDescriptor providerDescriptor = lookup.ProviderDescriptor; //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: return(labelNameIdMap.Values.Select(index => IndexDescriptorFactory.forSchema(SchemaDescriptorFactory.forLabel(index, propertyId), providerDescriptor).withId(index)).ToArray(StoreIndexDescriptor[] ::new)); }
protected internal NativeIndexProvider(IndexProviderDescriptor descriptor, Factory directoryStructureFactory, PageCache pageCache, FileSystemAbstraction fs, Monitor monitor, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, bool readOnly) : base(descriptor, directoryStructureFactory) { this.PageCache = pageCache; this.Fs = fs; this.Monitor = monitor; this.RecoveryCleanupWorkCollector = recoveryCleanupWorkCollector; this.ReadOnly = readOnly; }
public override bool Equals(object obj) { if (obj is IndexProviderDescriptor) { IndexProviderDescriptor otherDescriptor = ( IndexProviderDescriptor )obj; return(_key.Equals(otherDescriptor.Key) && _version.Equals(otherDescriptor.Version)); } return(false); }
private IndexProvider Put(IndexProviderDescriptor providerDescriptor, IndexProvider provider) { IndexProvider existing = _indexProvidersByDescriptor.putIfAbsent(providerDescriptor, provider); if (!_indexProvidersByName.ContainsKey(providerDescriptor.Name())) { _indexProvidersByName.Add(providerDescriptor.Name(), provider); } return(existing); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setup() public virtual void Setup() { IndexProviderDescriptor providerDescriptor = new IndexProviderDescriptor("test", "v1"); _directoryStructure = directoriesByProvider(Storage.directory().databaseDir()).forProvider(providerDescriptor); _indexDir = _directoryStructure.directoryForIndex(_indexDescriptor.Id); _indexFile = new File(_indexDir, "index"); _fs = Storage.fileSystem(); _dropAction = new FileSystemIndexDropAction(_fs, _directoryStructure); }
public static SchemaRuleCommand CreateIndexRule(IndexProviderDescriptor provider, long id, LabelSchemaDescriptor descriptor) { SchemaRule rule = IndexDescriptorFactory.forSchema(descriptor, provider).withId(id); DynamicRecord record = new DynamicRecord(id); record.InUse = true; record.SetCreated(); record.Data = SchemaRuleSerialization.serialize(rule); return(new SchemaRuleCommand(Collections.emptyList(), singletonList(record), rule)); }
// === INDEX RULES === private static StoreIndexDescriptor ReadIndexRule(long id, bool constraintIndex, int label, ByteBuffer serialized) { IndexProviderDescriptor providerDescriptor = ReadIndexProviderDescriptor(serialized); int[] propertyKeyIds = ReadIndexPropertyKeys(serialized); LabelSchemaDescriptor schema = SchemaDescriptorFactory.forLabel(label, propertyKeyIds); Optional <string> name = null; IndexDescriptor descriptor = constraintIndex ? IndexDescriptorFactory.uniqueForSchema(schema, name, providerDescriptor) : IndexDescriptorFactory.forSchema(schema, name, providerDescriptor); StoreIndexDescriptor storeIndexDescriptor = constraintIndex ? descriptor.WithIds(id, ReadOwningConstraint(serialized)) : descriptor.WithId(id); return(storeIndexDescriptor); }
internal FulltextIndexProvider(IndexProviderDescriptor descriptor, IndexDirectoryStructure.Factory directoryStructureFactory, FileSystemAbstraction fileSystem, Config config, TokenHolders tokenHolders, DirectoryFactory directoryFactory, OperationalMode operationalMode, JobScheduler scheduler, AuxiliaryTransactionStateManager auxiliaryTransactionStateManager, Log log) : base(descriptor, directoryStructureFactory) { this._fileSystem = fileSystem; this._config = config; this._tokenHolders = tokenHolders; this._operationalMode = operationalMode; this._auxiliaryTransactionStateManager = auxiliaryTransactionStateManager; this._log = log; _defaultAnalyzerName = config.Get(FulltextConfig.FulltextDefaultAnalyzer); _defaultEventuallyConsistentSetting = Convert.ToString(config.Get(FulltextConfig.EventuallyConsistent)); _indexUpdateSink = new IndexUpdateSink(scheduler, config.Get(FulltextConfig.EventuallyConsistentIndexUpdateQueueMaxLength)); _openOnlineAccessors = new ConcurrentDictionary <StoreIndexDescriptor, FulltextIndexAccessor>(); _indexStorageFactory = BuildIndexStorageFactory(fileSystem, directoryFactory); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRegisterIndexesToActivateIntoTheActivator() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRegisterIndexesToActivateIntoTheActivator() { // given IndexingService indexing = mock(typeof(IndexingService)); LabelScanWriter writer = new OrderVerifyingLabelScanWriter(10, 15, 20); WorkSync <System.Func <LabelScanWriter>, LabelUpdateWork> labelScanSync = spy(new WorkSync <System.Func <LabelScanWriter>, LabelUpdateWork>(SingletonProvider(writer))); WorkSync <IndexingUpdateService, IndexUpdatesWork> indexUpdatesSync = new WorkSync <IndexingUpdateService, IndexUpdatesWork>(indexing); PropertyStore propertyStore = mock(typeof(PropertyStore)); TransactionToApply tx = mock(typeof(TransactionToApply)); IndexActivator indexActivator = new IndexActivator(indexing); long indexId1 = 1; long indexId2 = 2; long indexId3 = 3; long constraintId1 = 10; long constraintId2 = 11; long constraintId3 = 12; IndexProviderDescriptor providerDescriptor = new IndexProviderDescriptor("index-key", "v1"); StoreIndexDescriptor rule1 = uniqueForSchema(forLabel(1, 1), providerDescriptor).withIds(indexId1, constraintId1); StoreIndexDescriptor rule2 = uniqueForSchema(forLabel(2, 1), providerDescriptor).withIds(indexId2, constraintId2); StoreIndexDescriptor rule3 = uniqueForSchema(forLabel(3, 1), providerDescriptor).withIds(indexId3, constraintId3); using (IndexBatchTransactionApplier applier = new IndexBatchTransactionApplier(indexing, labelScanSync, indexUpdatesSync, mock(typeof(NodeStore)), mock(typeof(RelationshipStore)), propertyStore, indexActivator)) { using (TransactionApplier txApplier = applier.StartTx(tx)) { // WHEN // activate index 1 txApplier.VisitSchemaRuleCommand(new Command.SchemaRuleCommand(Collections.emptyList(), AsRecords(rule1, true), rule1)); // activate index 2 txApplier.VisitSchemaRuleCommand(new Command.SchemaRuleCommand(Collections.emptyList(), AsRecords(rule2, true), rule2)); // activate index 3 txApplier.VisitSchemaRuleCommand(new Command.SchemaRuleCommand(Collections.emptyList(), AsRecords(rule3, true), rule3)); // drop index 2 txApplier.VisitSchemaRuleCommand(new Command.SchemaRuleCommand(AsRecords(rule2, true), AsRecords(rule2, false), rule2)); } } verify(indexing).dropIndex(rule2); indexActivator.Close(); verify(indexing).activateIndex(indexId1); verify(indexing).activateIndex(indexId3); verifyNoMoreInteractions(indexing); }
public override void Init() { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: Iterable<? extends org.neo4j.kernel.api.index.IndexProvider> indexProviders = dependencies.resolveTypeDependencies(org.neo4j.kernel.api.index.IndexProvider.class); IEnumerable <IndexProvider> indexProviders = _dependencies.resolveTypeDependencies(typeof(IndexProvider)); foreach (IndexProvider provider in indexProviders) { IndexProviderDescriptor providerDescriptor = provider.ProviderDescriptor; requireNonNull(providerDescriptor); IndexProvider existing = Put(providerDescriptor, provider); if (existing != null) { throw new System.ArgumentException("Tried to load multiple schema index providers with the same provider descriptor " + providerDescriptor + ". First loaded " + existing + " then " + provider); } } InitDefaultProvider(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldLogUserReadableLabelAndPropertyNames() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldLogUserReadableLabelAndPropertyNames() { //noinspection deprecation GraphDatabaseAPI db = DbRule.GraphDatabaseAPI; string labelName = "User"; string property = "name"; // when CreateIndex(db, labelName, property); // then AssertableLogProvider.LogMatcherBuilder match = inLog(typeof(IndexPopulationJob)); IndexProviderMap indexProviderMap = Db.DependencyResolver.resolveDependency(typeof(IndexProviderMap)); IndexProvider defaultProvider = indexProviderMap.DefaultProvider; IndexProviderDescriptor providerDescriptor = defaultProvider.ProviderDescriptor; _logProvider.assertAtLeastOnce(match.info("Index population started: [%s]", ":User(name) [provider: {key=" + providerDescriptor.Key + ", version=" + providerDescriptor.Version + "}]")); assertEventually((ThrowingSupplier <object, Exception>)() => null, new LogMessageMatcher(this, match, providerDescriptor), 1, TimeUnit.MINUTES); }
internal LogMessageMatcher(SchemaLoggingIT outerInstance, AssertableLogProvider.LogMatcherBuilder match, IndexProviderDescriptor descriptor) { this._outerInstance = outerInstance; this.Match = match; this.Descriptor = descriptor; }
public FusionIndexProvider(IndexProvider stringProvider, IndexProvider numberProvider, IndexProvider spatialProvider, IndexProvider temporalProvider, IndexProvider luceneProvider, SlotSelector slotSelector, IndexProviderDescriptor descriptor, IndexDirectoryStructure.Factory directoryStructure, FileSystemAbstraction fs, bool archiveFailedIndex) : base(descriptor, directoryStructure) { this._archiveFailedIndex = archiveFailedIndex; this._slotSelector = slotSelector; this._providers = new InstanceSelector <IndexProvider>(); this._dropAction = new FileSystemIndexDropAction(fs, directoryStructure()); FillProvidersSelector(stringProvider, numberProvider, spatialProvider, temporalProvider, luceneProvider); slotSelector.ValidateSatisfied(_providers); }
public static IndexDirectoryStructure.Factory SubProviderDirectoryStructure(File databaseDirectory, IndexProviderDescriptor descriptor) { IndexDirectoryStructure parentDirectoryStructure = directoriesByProvider(databaseDirectory).forProvider(descriptor); return(directoriesBySubProvider(parentDirectoryStructure)); }
private StoreIndexDescriptor IndexRule(long ruleId, IndexProviderDescriptor descriptor, int labelId, params int[] propertyIds) { return(IndexDescriptorFactory.forSchema(forLabel(labelId, propertyIds), descriptor).withId(ruleId)); }
private StoreIndexDescriptor UniqueIndexRule(long ruleId, long owningConstraint, IndexProviderDescriptor descriptor, int labelId, params int[] propertyIds) { return(IndexDescriptorFactory.uniqueForSchema(forLabel(labelId, propertyIds), descriptor).withIds(ruleId, owningConstraint)); }
public AdaptorAnonymousInnerClass(LuceneIndexSamplerReleaseTaskControlUnderFusion outerInstance, IndexProviderDescriptor providerDescriptor, IndexDirectoryStructure.Factory directoryFactory) : base(providerDescriptor, directoryFactory) { this.outerInstance = outerInstance; }
protected internal Adaptor(IndexProviderDescriptor descriptor, IndexDirectoryStructure.Factory directoryStructureFactory) : base(descriptor, directoryStructureFactory) { }
private static IDictionary <string, string> GetIndexProviderDescriptorMap(IndexProviderDescriptor providerDescriptor) { return(MapUtil.stringMap("key", providerDescriptor.Key, "version", providerDescriptor.Version)); }