Package org.fcrepo.server.journal.readerwriter.multicast.rmi

Examples of org.fcrepo.server.journal.readerwriter.multicast.rmi.RmiTransportWriter


        repositoryHash = "Hash" + new Date().getTime();
    }

    @Test
    public void testConstructorOpensConnection() throws JournalException {
        new RmiTransportWriter(receiver, repositoryHash, "theFilename");
        assertCorrectNumberOfCalls(receiver, 1, 0, 0);
        assertEquals(repositoryHash, receiver.getRepositoryHash());
        assertEquals("theFilename", receiver.getFilename());
    }
View Full Code Here


    }

    @Test(expected = JournalException.class)
    public void testConstructorGetsException() throws JournalException {
        receiver.setOpenFileThrowsException(true);
        new RmiTransportWriter(receiver, repositoryHash, "theFilename");
    }
View Full Code Here

        new RmiTransportWriter(receiver, repositoryHash, "theFilename");
    }

    @Test
    public void testSeriesOfWrites() throws JournalException, IOException {
        RmiTransportWriter writer =
                new RmiTransportWriter(receiver, repositoryHash, "theFilename");
        assertCorrectNumberOfCalls(receiver, 1, 0, 0);

        String text1 = "Some silly text";
        char[] chars = text1.toCharArray();
        writer.write(chars, 0, text1.length());
        assertCorrectNumberOfCalls(receiver, 1, 1, 0);
        assertEquals("unexpected text 1", text1, receiver.getText());
        assertCorrectItemHash(receiver, 0);

        String text2 = "This is something else";
        writer.write(text2);
        assertCorrectNumberOfCalls(receiver, 1, 2, 0);
        assertEquals("unexpected text 2", text2, receiver.getText());
        assertCorrectItemHash(receiver, 1);

        String text3 = "What's going on?";
        writer.write(text3, 3, 8);
        assertCorrectNumberOfCalls(receiver, 1, 3, 0);
        assertEquals("unexpected text 3", text3.substring(3, 11), receiver
                .getText());
        assertCorrectItemHash(receiver, 2);
    }
View Full Code Here

    @Test(expected = IOException.class)
    public void testWriteGetsException() throws JournalException, IOException {
        receiver.setWriteTextThrowsException(true);

        RmiTransportWriter writer =
                new RmiTransportWriter(receiver, repositoryHash, "theFilename");
        writer.write("Throw an exception");
    }
View Full Code Here

        writer.write("Throw an exception");
    }

    @Test
    public void testCloseClosesFile() throws JournalException, IOException {
        RmiTransportWriter writer =
                new RmiTransportWriter(receiver, repositoryHash, "theFilename");
        writer.close();
        assertCorrectNumberOfCalls(receiver, 1, 0, 1);
    }
View Full Code Here

    public void testCloseThrowsException() throws JournalException, IOException {
        // Note that the mock receiver throws a JournalException on close, but
        // the writer wraps it in an IOException.
        receiver.setCloseFileThrowsException(true);

        RmiTransportWriter writer =
                new RmiTransportWriter(receiver, repositoryHash, "theFilename");
        writer.close();
    }
View Full Code Here

        String text1 = "Write a bunch of stuff to the buffer";
        String text2 = "But it doesn't go out to the RmiTransportWriter";
        String text3 = "Until we do a flush or a close.";

        BufferedWriter buffered =
                new BufferedWriter(new RmiTransportWriter(receiver,
                                                          repositoryHash,
                                                          "theFilename"), 10000);
        assertCorrectNumberOfCalls(receiver, 1, 0, 0);

        buffered.write(text1);
View Full Code Here

TOP

Related Classes of org.fcrepo.server.journal.readerwriter.multicast.rmi.RmiTransportWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.