//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 shouldDropIndexGivenDropSchemaRuleCommand() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldDropIndexGivenDropSchemaRuleCommand() { // Given //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.storageengine.api.schema.StoreIndexDescriptor indexRule = indexRule(1, 42, 42, INDEX_DESCRIPTOR); StoreIndexDescriptor indexRule = indexRule(1, 42, 42, _indexDescriptor); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final IndexBatchTransactionApplier applier = newIndexTransactionApplier(); IndexBatchTransactionApplier applier = NewIndexTransactionApplier(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final Command.SchemaRuleCommand command = new Command.SchemaRuleCommand(singleton(createdDynamicRecord(1)), singleton(dynamicRecord(1, false)), indexRule); Command.SchemaRuleCommand command = new Command.SchemaRuleCommand(singleton(CreatedDynamicRecord(1)), singleton(dynamicRecord(1, false)), indexRule); // When bool result; using (TransactionApplier txApplier = applier.StartTx(_transactionToApply)) { result = txApplier.VisitSchemaRuleCommand(command); } // Then assertFalse(result); verify(_indexingService).dropIndex(indexRule); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldUpdateLabelStoreScanOnNodeCommands() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldUpdateLabelStoreScanOnNodeCommands() { // given //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final IndexBatchTransactionApplier applier = newIndexTransactionApplier(); IndexBatchTransactionApplier applier = NewIndexTransactionApplier(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.impl.store.record.NodeRecord before = new org.neo4j.kernel.impl.store.record.NodeRecord(11); NodeRecord before = new NodeRecord(11); before.SetLabelField(17, _emptyDynamicRecords); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.impl.store.record.NodeRecord after = new org.neo4j.kernel.impl.store.record.NodeRecord(12); NodeRecord after = new NodeRecord(12); after.SetLabelField(18, _emptyDynamicRecords); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final Command.NodeCommand command = new Command.NodeCommand(before, after); Command.NodeCommand command = new Command.NodeCommand(before, after); LabelScanWriter labelScanWriter = mock(typeof(LabelScanWriter)); when(_labelScanStore.get()).thenReturn(labelScanWriter); // when bool result; using (TransactionApplier txApplier = applier.StartTx(_transactionToApply)) { result = txApplier.VisitNodeCommand(command); } // then assertFalse(result); }
//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); }