Exemplo n.º 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));
        }
Exemplo n.º 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));
            }
Exemplo n.º 3
0
//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));
        }
Exemplo n.º 4
0
//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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 6
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(_inputStream.Read());
        }
Exemplo n.º 7
0
 public override void InjectFailure(params Type[] failureTypes)
 {
     Adversary.injectFailure(failureTypes);
 }
Exemplo n.º 8
0
//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);
        }
Exemplo n.º 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());
        }
Exemplo n.º 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();
        }
Exemplo n.º 11
0
 public override sbyte getByte(int offset)
 {
     _adversary.injectFailure(typeof(System.IndexOutOfRangeException));
     return(Delegate.getByte(offset));
 }