//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWriteSomeDataIntoTheLog() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldWriteSomeDataIntoTheLog() { // GIVEN string name = "log"; FileSystemAbstraction fs = _fileSystemRule.get(); LogFiles logFiles = LogFilesBuilder.builder(_directory.databaseLayout(), fs).withTransactionIdStore(_transactionIdStore).withLogVersionRepository(_logVersionRepository).build(); _life.start(); _life.add(logFiles); // WHEN FlushablePositionAwareChannel writer = logFiles.LogFile.Writer; LogPositionMarker positionMarker = new LogPositionMarker(); writer.GetCurrentPosition(positionMarker); int intValue = 45; long longValue = 4854587; writer.PutInt(intValue); writer.PutLong(longValue); writer.PrepareForFlush().flush(); // THEN using (ReadableClosableChannel reader = logFiles.LogFile.getReader(positionMarker.NewPosition())) { assertEquals(intValue, reader.Int); assertEquals(longValue, reader.Long); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public Object read(ReadableClosableChannel from) throws IOException public override object read(ReadableClosableChannel from) { ValueType componentType = typeOf(from.get()); int length = from.Int; object value = Array.CreateInstance(componentType.componentClass(), length); for (int i = 0; i < length; i++) { (( Array )value).SetValue(componentType.Read(from), i); } return(value); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReadOlderLogs() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldReadOlderLogs() { // GIVEN FileSystemAbstraction fs = _fileSystemRule.get(); LogFiles logFiles = LogFilesBuilder.builder(_directory.databaseLayout(), fs).withTransactionIdStore(_transactionIdStore).withLogVersionRepository(_logVersionRepository).build(); _life.start(); _life.add(logFiles); // WHEN LogFile logFile = logFiles.LogFile; FlushablePositionAwareChannel writer = logFile.Writer; LogPositionMarker positionMarker = new LogPositionMarker(); writer.GetCurrentPosition(positionMarker); LogPosition position1 = positionMarker.NewPosition(); int intValue = 45; long longValue = 4854587; sbyte[] someBytes = someBytes(40); writer.PutInt(intValue); writer.PutLong(longValue); writer.Put(someBytes, someBytes.Length); writer.PrepareForFlush().flush(); writer.GetCurrentPosition(positionMarker); LogPosition position2 = positionMarker.NewPosition(); long longValue2 = 123456789L; writer.PutLong(longValue2); writer.Put(someBytes, someBytes.Length); writer.PrepareForFlush().flush(); // THEN using (ReadableClosableChannel reader = logFile.GetReader(position1)) { assertEquals(intValue, reader.Int); assertEquals(longValue, reader.Long); assertArrayEquals(someBytes, ReadBytes(reader, 40)); } using (ReadableClosableChannel reader = logFile.GetReader(position2)) { assertEquals(longValue2, reader.Long); assertArrayEquals(someBytes, ReadBytes(reader, 40)); } }
public object Read(ReadableClosableChannel from) throws IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static byte[] readBytes(ReadableClosableChannel reader, int length) throws java.io.IOException private static sbyte[] ReadBytes(ReadableClosableChannel reader, int length) { sbyte[] result = new sbyte[length]; reader.Get(result, length); return(result); }