Exemple #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.io.pagecache.PageCursor io(long pageId, int pf_flags) throws java.io.IOException
        public override PageCursor Io(long pageId, int pfFlags)
        {
            _adversary.injectFailure(typeof(System.InvalidOperationException));
            PageCursor pageCursor = @delegate.Io(pageId, pfFlags);

            if ((pfFlags & Org.Neo4j.Io.pagecache.PagedFile_Fields.PF_SHARED_READ_LOCK) == Org.Neo4j.Io.pagecache.PagedFile_Fields.PF_SHARED_READ_LOCK)
            {
                return(new AdversarialReadPageCursor(pageCursor, _adversary));
            }
            return(new AdversarialWritePageCursor(pageCursor, _adversary));
        }
Exemple #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public java.io.OutputStream openAsOutputStream(java.io.File fileName, boolean append) throws java.io.IOException
            public override Stream OpenAsOutputStream(File fileName, bool append)
            {
                // Default adversarial might throw a java.lang.SecurityException here, which is an exception
                // that should not be survived
                Adversary.injectFailure(typeof(FileNotFoundException));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.io.OutputStream outputStream = delegate.openAsOutputStream(fileName, append);
                Stream outputStream = Delegate.openAsOutputStream(fileName, append);

                return(new AdversarialOutputStreamAnonymousInnerClass(this, outputStream, Adversary));
            }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.io.pagecache.PagedFile map(java.io.File file, int pageSize, java.nio.file.OpenOption... openOptions) throws java.io.IOException
        public override PagedFile Map(File file, int pageSize, params OpenOption[] openOptions)
        {
            if (ArrayUtils.contains(openOptions, StandardOpenOption.CREATE))
            {
                _adversary.injectFailure(typeof(IOException), typeof(SecurityException));
            }
            else
            {
                _adversary.injectFailure(typeof(FileNotFoundException), typeof(IOException), typeof(SecurityException));
            }
            PagedFile pagedFile = @delegate.Map(file, pageSize, openOptions);

            return(new AdversarialPagedFile(pagedFile, _adversary));
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void writeAll(ByteBuffer src, long position) throws java.io.IOException
        public override void WriteAll(ByteBuffer src, long position)
        {
            _adversary.injectFailure(typeof(IOException));
            @delegate.WriteAll(src, position);
        }
Exemple #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void write(int c) throws java.io.IOException
        public override void Write(int c)
        {
            _adversary.injectFailure(typeof(IOException));
            _writer.write(c);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public int read() throws java.io.IOException
        public override int Read()
        {
            _adversary.injectFailure(typeof(IOException));
            return(_inputStream.Read());
        }
 public override void InjectFailure(params Type[] failureTypes)
 {
     Adversary.injectFailure(failureTypes);
 }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void write(int b) throws java.io.IOException
        public override void Write(int b)
        {
            _adversary.injectFailure(typeof(IOException));
            _outputStream.WriteByte(b);
        }
Exemple #9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public int read() throws java.io.IOException
        public override int Read()
        {
            _adversary.injectFailure(typeof(IOException));
            return(_reader.read());
        }
Exemple #10
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void close() throws java.io.IOException
        public override void Close()
        {
            _adversary.injectFailure(typeof(IOException));
            _fileWatcher.Dispose();
        }
Exemple #11
0
 public override sbyte getByte(int offset)
 {
     _adversary.injectFailure(typeof(System.IndexOutOfRangeException));
     return(Delegate.getByte(offset));
 }