public IndexBatchTransactionApplier(IndexingService indexingService, WorkSync <System.Func <LabelScanWriter>, LabelUpdateWork> labelScanStoreSync, WorkSync <IndexingUpdateService, IndexUpdatesWork> indexUpdatesSync, NodeStore nodeStore, RelationshipStore relationshipStore, PropertyStore propertyStore, IndexActivator indexActivator) { this._indexingService = indexingService; this._labelScanStoreSync = labelScanStoreSync; this._indexUpdatesSync = indexUpdatesSync; this._propertyStore = propertyStore; this._transactionApplier = new SingleTransactionApplier(this, nodeStore, relationshipStore); this._indexActivator = indexActivator; }
//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); }