//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldProvideLabelScanStoreUpdatesSortedByNodeId() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldProvideLabelScanStoreUpdatesSortedByNodeId() { // GIVEN IndexingService indexing = mock(typeof(IndexingService)); when(indexing.ConvertToIndexUpdates(any(), eq(EntityType.NODE))).thenAnswer(o => Iterables.empty()); 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); TransactionToApply tx = mock(typeof(TransactionToApply)); PropertyStore propertyStore = mock(typeof(PropertyStore)); using (IndexBatchTransactionApplier applier = new IndexBatchTransactionApplier(indexing, labelScanSync, indexUpdatesSync, mock(typeof(NodeStore)), mock(typeof(RelationshipStore)), propertyStore, new IndexActivator(indexing))) { using (TransactionApplier txApplier = applier.StartTx(tx)) { // WHEN txApplier.VisitNodeCommand(Node(15)); txApplier.VisitNodeCommand(Node(20)); txApplier.VisitNodeCommand(Node(10)); } } // THEN all assertions happen inside the LabelScanWriter#write and #close verify(labelScanSync).applyAsync(any()); }
//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); }