//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPerformSuccessfulStoreCopyProcess() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldPerformSuccessfulStoreCopyProcess() { // given StoreStreamingProcess process = new StoreStreamingProcess(_protocol, _checkPointerSupplier, _mutex, _resourceStream); // mocked behaviour ImmediateEventExecutor eventExecutor = ImmediateEventExecutor.INSTANCE; Promise <Void> completionPromise = eventExecutor.newPromise(); long lastCheckpointedTxId = 1000L; RawCursor <StoreResource, IOException> resources = rawCursorOf(); when(_checkPointer.tryCheckPoint(any())).thenReturn(lastCheckpointedTxId); when(_checkPointer.lastCheckPointedTransactionId()).thenReturn(lastCheckpointedTxId); when(_protocol.end(_ctx, SUCCESS)).thenReturn(completionPromise); when(_resourceStream.create()).thenReturn(resources); // when process.Perform(_ctx); // then InOrder inOrder = Mockito.inOrder(_protocol, _checkPointer); inOrder.verify(_checkPointer).tryCheckPoint(any()); inOrder.verify(_protocol).end(_ctx, SUCCESS); inOrder.verifyNoMoreInteractions(); assertEquals(1, @lock.ReadLockCount); // when completionPromise.Success = null; // then assertEquals(0, @lock.ReadLockCount); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldTrackOffsetAfterRewind() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldTrackOffsetAfterRewind() { // given Stream actual = mock(typeof(Stream)); ProgressListener progressListener = mock(typeof(ProgressListener)); ProgressTrackingOutputStream.Progress progress = new ProgressTrackingOutputStream.Progress(progressListener, 0); using (ProgressTrackingOutputStream @out = new ProgressTrackingOutputStream(actual, progress)) { @out.WriteByte(new sbyte[20]); // when progress.RewindTo(15); // i.e. the next 5 bytes we don't track @out.WriteByte(new sbyte[3]); // now there should be 2 untracked bytes left @out.WriteByte(new sbyte[9]); // this one should report 7 } progress.Done(); // then InOrder inOrder = inOrder(progressListener); inOrder.verify(progressListener).add(20); inOrder.verify(progressListener).add(7); inOrder.verify(progressListener).done(); verifyNoMoreInteractions(progressListener); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotNotifyOutputWhenOutputItselfFails() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotNotifyOutputWhenOutputItselfFails() { PackOutput output = mock(typeof(PackOutput)); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = mock(typeof(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer)); IOException error = new IOException("Unable to flush"); doThrow(error).when(output).messageSucceeded(); BoltResponseMessageWriterV1 writer = NewWriter(output, packer); try { writer.Write(new RecordMessage(() => new AnyValue[] { longValue(1), longValue(2) })); fail("Exception expected"); } catch (IOException e) { assertEquals(error, e); } InOrder inOrder = inOrder(output, packer); inOrder.verify(output).beginMessage(); inOrder.verify(packer).pack(longValue(1)); inOrder.verify(packer).pack(longValue(2)); inOrder.verify(output).messageSucceeded(); verify(output, never()).messageFailed(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldPrintUsageForACommand() internal virtual void ShouldPrintUsageForACommand() { // given AdminCommand_Provider commandProvider = MockCommand("bam", "A summary", AdminCommandSection.General()); AdminCommand_Provider[] commands = new AdminCommand_Provider[] { commandProvider }; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final Usage usage = new Usage("neo4j-admin", new CannedLocator(commands)); Usage usage = new Usage("neo4j-admin", new CannedLocator(commands)); // when usage.PrintUsageForCommand(commandProvider, @out); // then InOrder ordered = inOrder(@out); ordered.verify(@out).accept("usage: neo4j-admin bam "); ordered.verify(@out).accept(""); ordered.verify(@out).accept("environment variables:"); ordered.verify(@out).accept(" NEO4J_CONF Path to directory which contains neo4j.conf."); ordered.verify(@out).accept(" NEO4J_DEBUG Set to anything to enable debug output."); ordered.verify(@out).accept(" NEO4J_HOME Neo4j home directory."); ordered.verify(@out).accept(" HEAP_SIZE Set JVM maximum heap size during command execution."); ordered.verify(@out).accept(" Takes a number and a unit, for example 512m."); ordered.verify(@out).accept(""); ordered.verify(@out).accept("description"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldPrintUsageWithConfiguration() internal virtual void ShouldPrintUsageWithConfiguration() { AdminCommand_Provider[] commands = new AdminCommand_Provider[] { MockCommand("bam", "A summary", AdminCommandSection.General()) }; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final Usage usage = new Usage("neo4j-admin", new CannedLocator(commands)); Usage usage = new Usage("neo4j-admin", new CannedLocator(commands)); usage.Print(@out); InOrder ordered = inOrder(@out); ordered.verify(@out).accept("usage: neo4j-admin <command>"); ordered.verify(@out).accept(""); ordered.verify(@out).accept("Manage your Neo4j instance."); ordered.verify(@out).accept(""); ordered.verify(@out).accept("environment variables:"); ordered.verify(@out).accept(" NEO4J_CONF Path to directory which contains neo4j.conf."); ordered.verify(@out).accept(" NEO4J_DEBUG Set to anything to enable debug output."); ordered.verify(@out).accept(" NEO4J_HOME Neo4j home directory."); ordered.verify(@out).accept(" HEAP_SIZE Set JVM maximum heap size during command execution."); ordered.verify(@out).accept(" Takes a number and a unit, for example 512m."); ordered.verify(@out).accept(""); ordered.verify(@out).accept("available commands:"); ordered.verify(@out).accept("General"); ordered.verify(@out).accept(" bam"); ordered.verify(@out).accept(" A summary"); ordered.verify(@out).accept(""); ordered.verify(@out).accept("Use neo4j-admin help <command> for more details."); ordered.verifyNoMoreInteractions(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSimpleHistoricExternalTaskLogGet() public virtual void testSimpleHistoricExternalTaskLogGet() { given().pathParam("id", MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_ID).then().expect().statusCode(Status.OK.StatusCode).body("id", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_ID)).body("timestamp", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_TIMESTAMP)).body("removalTime", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_REMOVAL_TIME)).body("externalTaskId", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_EXTERNAL_TASK_ID)).body("topicName", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_TOPIC_NAME)).body("workerId", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_WORKER_ID)).body("retries", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_RETRIES)).body("priority", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_PRIORITY)).body("errorMessage", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_ERROR_MSG)).body("activityId", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_ACTIVITY_ID)).body("activityInstanceId", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_ACTIVITY_INSTANCE_ID)).body("executionId", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_EXECUTION_ID)).body("processInstanceId", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_PROC_INST_ID)).body("processDefinitionId", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_PROC_DEF_ID)).body("processDefinitionKey", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_PROC_DEF_KEY)).body("tenantId", equalTo(MockProvider.EXAMPLE_TENANT_ID)).body("rootProcessInstanceId", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_ROOT_PROC_INST_ID)).body("creationLog", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_IS_CREATION_LOG)).body("failureLog", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_IS_FAILURE_LOG)).body("successLog", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_IS_SUCCESS_LOG)).body("deletionLog", equalTo(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_IS_DELETION_LOG)).when().get(SINGLE_HISTORIC_EXTERNAL_TASK_LOG_RESOURCE_URL); InOrder inOrder = inOrder(mockQuery); inOrder.verify(mockQuery).logId(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_ID); inOrder.verify(mockQuery).singleResult(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSimpleHistoricJobLogGet() public virtual void testSimpleHistoricJobLogGet() { given().pathParam("id", MockProvider.EXAMPLE_HISTORIC_JOB_LOG_ID).then().expect().statusCode(Status.OK.StatusCode).body("id", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_ID)).body("timestamp", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_TIMESTAMP)).body("removalTime", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_REMOVAL_TIME)).body("jobId", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_JOB_ID)).body("jobDueDate", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_JOB_DUE_DATE)).body("jobRetries", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_JOB_RETRIES)).body("jobPriority", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_JOB_PRIORITY)).body("jobExceptionMessage", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_JOB_EXCEPTION_MSG)).body("jobDefinitionId", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_JOB_DEF_ID)).body("jobDefinitionType", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_JOB_DEF_TYPE)).body("jobDefinitionConfiguration", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_JOB_DEF_CONFIG)).body("activityId", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_ACTIVITY_ID)).body("executionId", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_EXECUTION_ID)).body("processInstanceId", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_PROC_INST_ID)).body("processDefinitionId", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_PROC_DEF_ID)).body("processDefinitionKey", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_PROC_DEF_KEY)).body("deploymentId", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_DEPLOYMENT_ID)).body("tenantId", equalTo(MockProvider.EXAMPLE_TENANT_ID)).body("rootProcessInstanceId", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_ROOT_PROC_INST_ID)).body("creationLog", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_IS_CREATION_LOG)).body("failureLog", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_IS_FAILURE_LOG)).body("successLog", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_IS_SUCCESS_LOG)).body("deletionLog", equalTo(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_IS_DELETION_LOG)).when().get(SINGLE_HISTORIC_JOB_LOG_RESOURCE_URL); InOrder inOrder = inOrder(mockQuery); inOrder.verify(mockQuery).logId(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_ID); inOrder.verify(mockQuery).singleResult(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void switchToPendingTest() public virtual void SwitchToPendingTest() { _modeSwitcher.switchToSlave(); verify(_slaveUpdatePuller).start(); _modeSwitcher.switchToSlave(); InOrder inOrder = inOrder(_slaveUpdatePuller); inOrder.verify(_slaveUpdatePuller).stop(); inOrder.verify(_slaveUpdatePuller).start(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testGetBatch() public virtual void testGetBatch() { Response response = given().pathParam("id", MockProvider.EXAMPLE_BATCH_ID).then().expect().statusCode(Status.OK.StatusCode).when().get(SINGLE_BATCH_RESOURCE_URL); InOrder inOrder = inOrder(queryMock); inOrder.verify(queryMock).batchId(MockProvider.EXAMPLE_BATCH_ID); inOrder.verify(queryMock).singleResult(); inOrder.verifyNoMoreInteractions(); verifyBatchJson(response.asString()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mustDeleteLogFilesThatCanBePruned() public virtual void MustDeleteLogFilesThatCanBePruned() { when(_factory.strategyFromConfigValue(eq(_fs), eq(_logFiles), eq(_clock), anyString())).thenReturn(upTo => LongStream.range(3, upTo)); LogPruning pruning = new LogPruningImpl(_fs, _logFiles, _logProvider, _factory, _clock, _config); pruning.PruneLogs(5); InOrder order = inOrder(_fs); order.verify(_fs).deleteFile(new File("3")); order.verify(_fs).deleteFile(new File("4")); // Log file 5 is not deleted; it's the lowest version expected to remain after pruning. verifyNoMoreInteractions(_fs); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testClose() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TestClose() { // WHEN _facade.close(); // THEN InOrder inOrder = inOrder(_txApplier1, _txApplier2, _txApplier3); // Verify reverse order inOrder.verify(_txApplier3).close(); inOrder.verify(_txApplier2).close(); inOrder.verify(_txApplier1).close(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void closeFileSystemOnShutdown() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void CloseFileSystemOnShutdown() { BatchInserter batchInserter = mock(typeof(BatchInserter)); IndexConfigStoreProvider configStoreProvider = mock(typeof(IndexConfigStoreProvider)); FileSystemAbstraction fileSystem = mock(typeof(FileSystemAbstraction)); FileSystemClosingBatchInserter inserter = new FileSystemClosingBatchInserter(batchInserter, configStoreProvider, fileSystem); inserter.Shutdown(); InOrder verificationOrder = inOrder(batchInserter, fileSystem); verificationOrder.verify(batchInserter).shutdown(); verificationOrder.verify(fileSystem).close(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSucceess() public virtual void testSucceess() { // given foo.getFoo(); foo.Bar; // when InOrder inOrder = Mockito.inOrder(foo); inOrder.verify(foo).Foo; // then inOrder.verify(foo, immediatelyAfter()).Bar; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void closeShouldBeDoneInReverseOrder() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void CloseShouldBeDoneInReverseOrder() { // No idea why it was done like this before refactoring // WHEN _facade.close(); // THEN InOrder inOrder = inOrder(_applier1, _applier2, _applier3); inOrder.verify(_applier3).close(); inOrder.verify(_applier2).close(); inOrder.verify(_applier1).close(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldDeleteJustWhatTheThresholdSays() public virtual void ShouldDeleteJustWhatTheThresholdSays() { // Given when(_threshold.reached(any(), eq(6L), any())).thenReturn(false); when(_threshold.reached(any(), eq(5L), any())).thenReturn(false); when(_threshold.reached(any(), eq(4L), any())).thenReturn(false); when(_threshold.reached(any(), eq(3L), any())).thenReturn(true); File fileName1 = new File("logical.log.v1"); File fileName2 = new File("logical.log.v2"); File fileName3 = new File("logical.log.v3"); File fileName4 = new File("logical.log.v4"); File fileName5 = new File("logical.log.v5"); File fileName6 = new File("logical.log.v6"); when(_files.getLogFileForVersion(6)).thenReturn(fileName6); when(_files.getLogFileForVersion(5)).thenReturn(fileName5); when(_files.getLogFileForVersion(4)).thenReturn(fileName4); when(_files.getLogFileForVersion(3)).thenReturn(fileName3); when(_files.getLogFileForVersion(2)).thenReturn(fileName2); when(_files.getLogFileForVersion(1)).thenReturn(fileName1); when(_fileSystem.fileExists(fileName6)).thenReturn(true); when(_fileSystem.fileExists(fileName5)).thenReturn(true); when(_fileSystem.fileExists(fileName4)).thenReturn(true); when(_fileSystem.fileExists(fileName3)).thenReturn(true); when(_fileSystem.fileExists(fileName2)).thenReturn(true); when(_fileSystem.fileExists(fileName1)).thenReturn(true); when(_fileSystem.getFileSize(any())).thenReturn(LOG_HEADER_SIZE + 1L); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final ThresholdBasedPruneStrategy strategy = new ThresholdBasedPruneStrategy(fileSystem, files, threshold); ThresholdBasedPruneStrategy strategy = new ThresholdBasedPruneStrategy(_fileSystem, _files, _threshold); // When strategy.FindLogVersionsToDelete(7L).forEachOrdered(v => _fileSystem.deleteFile(_files.getLogFileForVersion(v))); // Then InOrder order = inOrder(_threshold, _fileSystem); order.verify(_threshold, times(1)).init(); order.verify(_fileSystem, times(1)).deleteFile(fileName1); order.verify(_fileSystem, times(1)).deleteFile(fileName2); order.verify(_fileSystem, times(1)).deleteFile(fileName3); verify(_fileSystem, never()).deleteFile(fileName4); verify(_fileSystem, never()).deleteFile(fileName5); verify(_fileSystem, never()).deleteFile(fileName6); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void availabilityGuardRaisedBeforeDataSourceManagerIsStoppedForStoreCopy() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void AvailabilityGuardRaisedBeforeDataSourceManagerIsStoppedForStoreCopy() { AvailabilityGuard guard = mock(typeof(DatabaseAvailabilityGuard)); DataSourceManager dataSourceManager = mock(typeof(DataSourceManager)); LocalDatabase localDatabase = NewLocalDatabase(guard, dataSourceManager); localDatabase.StopForStoreCopy(); InOrder inOrder = inOrder(guard, dataSourceManager); // guard should be raised twice - once during construction and once during stop inOrder.verify(guard, times(2)).require(any()); inOrder.verify(dataSourceManager).stop(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCleanupMultipleObjectsInReverseAddedOrder() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCleanupMultipleObjectsInReverseAddedOrder() { // GIVEN CleanupRule rule = new CleanupRule(); AutoCloseable closeable = rule.Add(mock(typeof(AutoCloseable))); Dirt dirt = rule.Add(mock(typeof(Dirt))); // WHEN SimulateTestExecution(rule); // THEN InOrder inOrder = inOrder(dirt, closeable); inOrder.verify(dirt, times(1)).shutdown(); inOrder.verify(closeable, times(1)).close(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWriteIgnoredMessage() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldWriteIgnoredMessage() { PackOutput output = mock(typeof(PackOutput)); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = mock(typeof(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer)); BoltResponseMessageWriterV1 writer = NewWriter(output, packer); writer.Write(IgnoredMessage.IGNORED_MESSAGE); InOrder inOrder = inOrder(output, packer); inOrder.verify(output).beginMessage(); inOrder.verify(packer).packStructHeader(0, IGNORED.signature()); inOrder.verify(output).messageSucceeded(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBlockTransactionsForLargeBatch() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBlockTransactionsForLargeBatch() { // given long safeZone = 10; TransactionBatchCommitter committer = NewBatchCommitter(safeZone); TransactionChain chain = CreateTxChain(100, 1, 10); // when committer.Apply(chain.First, chain.Last); // then InOrder inOrder = inOrder(_kernelTransactions); inOrder.verify(_kernelTransactions).blockNewTransactions(); inOrder.verify(_kernelTransactions).unblockNewTransactions(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWriteRecordMessage() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldWriteRecordMessage() { PackOutput output = mock(typeof(PackOutput)); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = mock(typeof(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer)); BoltResponseMessageWriterV1 writer = NewWriter(output, packer); writer.Write(new RecordMessage(() => new AnyValue[] { longValue(42), stringValue("42") })); InOrder inOrder = inOrder(output, packer); inOrder.verify(output).beginMessage(); inOrder.verify(packer).pack(longValue(42)); inOrder.verify(packer).pack(stringValue("42")); inOrder.verify(output).messageSucceeded(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReturnFalseIfLogHistoryDoesNotMatch() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldReturnFalseIfLogHistoryDoesNotMatch() { _raft.handle(appendEntriesRequest().from(_otherMember).leaderTerm(0).prevLogIndex(0).prevLogTerm(0).logEntry(new RaftLogEntry(0, Data(1))).build()); _raft.handle(appendEntriesRequest().from(_otherMember).leaderTerm(0).prevLogIndex(1).prevLogTerm(0).logEntry(new RaftLogEntry(0, Data(2))).build()); _raft.handle(appendEntriesRequest().from(_otherMember).leaderTerm(0).prevLogIndex(2).prevLogTerm(0).logEntry(new RaftLogEntry(0, Data(3))).build()); // will conflict // when _raft.handle(appendEntriesRequest().from(_otherMember).leaderTerm(2).prevLogIndex(3).prevLogTerm(1).logEntry(new RaftLogEntry(2, Data(4))).build()); // should reply false because of prevLogTerm // then InOrder invocationOrder = inOrder(_outbound); invocationOrder.verify(_outbound, times(1)).send(same(_otherMember), eq(appendEntriesResponse().from(_myself).term(0).matchIndex(1).appendIndex(1).success().build())); invocationOrder.verify(_outbound, times(1)).send(same(_otherMember), eq(appendEntriesResponse().from(_myself).term(0).matchIndex(2).appendIndex(2).success().build())); invocationOrder.verify(_outbound, times(1)).send(same(_otherMember), eq(appendEntriesResponse().from(_myself).term(0).matchIndex(3).appendIndex(3).success().build())); invocationOrder.verify(_outbound, times(1)).send(same(_otherMember), eq(appendEntriesResponse().from(_myself).term(2).matchIndex(-1).appendIndex(3).failure().build())); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWriteSuccessMessage() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldWriteSuccessMessage() { PackOutput output = mock(typeof(PackOutput)); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = mock(typeof(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer)); BoltResponseMessageWriterV1 writer = NewWriter(output, packer); MapValue metadata = map(new string[] { "a", "b", "c" }, new AnyValue[] { intValue(1), stringValue("2"), date(2010, 0x2, 0x2) }); writer.Write(new SuccessMessage(metadata)); InOrder inOrder = inOrder(output, packer); inOrder.verify(output).beginMessage(); inOrder.verify(packer).pack(metadata); inOrder.verify(output).messageSucceeded(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testVisit() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TestVisit() { Command cmd = mock(typeof(Command)); // WHEN bool result = _facade.visit(cmd); // THEN InOrder inOrder = inOrder(cmd); inOrder.verify(cmd).handle(_txApplier1); inOrder.verify(cmd).handle(_txApplier2); inOrder.verify(cmd).handle(_txApplier3); inOrder.verifyNoMoreInteractions(); assertFalse(result); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCramMultipleDecoratorsIntoOne() public virtual void ShouldCramMultipleDecoratorsIntoOne() { // GIVEN Decorator decorator1 = spy(new IdentityDecorator()); Decorator decorator2 = spy(new IdentityDecorator()); Decorator multi = decorators(decorator1, decorator2); // WHEN InputEntityVisitor node = mock(typeof(InputEntityVisitor)); multi.apply(node); // THEN InOrder order = inOrder(decorator1, decorator2); order.verify(decorator1, times(1)).apply(node); order.verify(decorator2, times(1)).apply(node); order.verifyNoMoreInteractions(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testVisitRelationshipCountsCommand() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TestVisitRelationshipCountsCommand() { Command.RelationshipCountsCommand cmd = mock(typeof(Command.RelationshipCountsCommand)); when(cmd.Handle(any(typeof(CommandVisitor)))).thenCallRealMethod(); // WHEN bool result = _facade.visitRelationshipCountsCommand(cmd); // THEN InOrder inOrder = inOrder(_txApplier1, _txApplier2, _txApplier3); inOrder.verify(_txApplier1).visitRelationshipCountsCommand(cmd); inOrder.verify(_txApplier2).visitRelationshipCountsCommand(cmd); inOrder.verify(_txApplier3).visitRelationshipCountsCommand(cmd); inOrder.verifyNoMoreInteractions(); assertFalse(result); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testVisitNeoStoreCommand() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TestVisitNeoStoreCommand() { // Make sure it just calls through to visit Command.NeoStoreCommand cmd = mock(typeof(Command.NeoStoreCommand)); when(cmd.Handle(any(typeof(CommandVisitor)))).thenCallRealMethod(); // WHEN bool result = _facade.visitNeoStoreCommand(cmd); // THEN InOrder inOrder = inOrder(_txApplier1, _txApplier2, _txApplier3); inOrder.verify(_txApplier1).visitNeoStoreCommand(cmd); inOrder.verify(_txApplier2).visitNeoStoreCommand(cmd); inOrder.verify(_txApplier3).visitNeoStoreCommand(cmd); inOrder.verifyNoMoreInteractions(); assertFalse(result); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWriteFailureMessage() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldWriteFailureMessage() { PackOutput output = mock(typeof(PackOutput)); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = mock(typeof(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer)); BoltResponseMessageWriterV1 writer = NewWriter(output, packer); Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction errorStatus = Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction.DeadlockDetected; string errorMessage = "Hi Deadlock!"; writer.Write(new FailureMessage(errorStatus, errorMessage)); InOrder inOrder = inOrder(output, packer); inOrder.verify(output).beginMessage(); inOrder.verify(packer).pack(errorStatus.code().serialize()); inOrder.verify(packer).pack(errorMessage); inOrder.verify(output).messageSucceeded(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testStartTxCorrectOrder() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TestStartTxCorrectOrder() { // GIVEN TransactionToApply tx = mock(typeof(TransactionToApply)); // WHEN TransactionApplierFacade result = ( TransactionApplierFacade )_facade.startTx(tx); // THEN InOrder inOrder = inOrder(_applier1, _applier2, _applier3); inOrder.verify(_applier1).startTx(tx); inOrder.verify(_applier2).startTx(tx); inOrder.verify(_applier3).startTx(tx); assertEquals(_txApplier1, result.Appliers[0]); assertEquals(_txApplier2, result.Appliers[1]); assertEquals(_txApplier3, result.Appliers[2]); assertEquals(3, result.Appliers.Length); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testFailureWhenInvocationNotPresentCase2() public virtual void testFailureWhenInvocationNotPresentCase2() { // given foo.getFoo(); // when InOrder inOrder = Mockito.inOrder(foo); inOrder.verify(foo).Foo; // then try { inOrder.verify(foo, immediatelyAfter()).Bar; Assert.fail("should not verify"); } catch (MockitoAssertionError) { // happy path } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldAbortLoadingGroupChainIfComeTooFar() public virtual void ShouldAbortLoadingGroupChainIfComeTooFar() { // GIVEN a node with relationship group chain 2-->4-->10-->23 LogProvider logProvider = NullLogProvider.Instance; StoreFactory storeFactory = new StoreFactory(_testDirectory.databaseLayout(), Config.defaults(), new DefaultIdGeneratorFactory(_fs.get()), _pageCache.getPageCache(_fs.get()), _fs.get(), logProvider, EmptyVersionContextSupplier.EMPTY); using (NeoStores stores = storeFactory.OpenNeoStores(true, StoreType.RELATIONSHIP_GROUP)) { RecordStore <RelationshipGroupRecord> store = spy(stores.RelationshipGroupStore); RelationshipGroupRecord group2 = Group(0, 2); RelationshipGroupRecord group4 = Group(1, 4); RelationshipGroupRecord group10 = Group(2, 10); RelationshipGroupRecord group23 = Group(3, 23); Link(group2, group4, group10, group23); store.UpdateRecord(group2); store.UpdateRecord(group4); store.UpdateRecord(group10); store.UpdateRecord(group23); RelationshipGroupGetter groupGetter = new RelationshipGroupGetter(store); NodeRecord node = new NodeRecord(0, true, group2.Id, -1); // WHEN trying to find relationship group 7 RecordAccess <RelationshipGroupRecord, int> access = new DirectRecordAccess <RelationshipGroupRecord, int>(store, Loaders.relationshipGroupLoader(store)); RelationshipGroupGetter.RelationshipGroupPosition result = groupGetter.GetRelationshipGroup(node, 7, access); // THEN only groups 2, 4 and 10 should have been loaded InOrder verification = inOrder(store); verification.verify(store).getRecord(eq(group2.Id), any(typeof(RelationshipGroupRecord)), any(typeof(RecordLoad))); verification.verify(store).getRecord(eq(group4.Id), any(typeof(RelationshipGroupRecord)), any(typeof(RecordLoad))); verification.verify(store).getRecord(eq(group10.Id), any(typeof(RelationshipGroupRecord)), any(typeof(RecordLoad))); verification.verify(store, never()).getRecord(eq(group23.Id), any(typeof(RelationshipGroupRecord)), any(typeof(RecordLoad))); // it should also be reported as not found assertNull(result.Group()); // with group 4 as closes previous one assertEquals(group4, result.ClosestPrevious().forReadingData()); } }