Examples of TestInputStream


Examples of org.apache.derbyTesting.functionTests.util.TestInputStream

              
        st.executeUpdate("create table clob_tab(c1 int,clob_col clob(10K))");
        conn.commit();
       
        pSt=conn.prepareStatement("INSERT INTO clob_tab values (?,?)");  
        stream = new TestInputStream(size, val);
       
        //this insert fails(size>10K)
        pSt.setInt(1, val);
        pSt.setAsciiStream(2, stream, size);
        assertStatementError("XJ001", pSt);
        pSt.close();
       
        conn.rollback();
       
        st.executeUpdate("ALTER TABLE clob_tab ALTER COLUMN "
                +"clob_col SET DATA TYPE clob(20K)");
       
        pSt=conn.prepareStatement("INSERT INTO clob_tab values (?,?)");
        stream = new TestInputStream(size, val);
       
        //this insert succeed (maximum blob size not increased to 20K)
        pSt.setInt(1, val);
        pSt.setAsciiStream(2, stream, size);
        pSt.executeUpdate();
        pSt.close();
       
       
        //increase the maximum size of the blob       
       
        st.executeUpdate("CREATE TABLE blob_tab ( C1 INTEGER," +
                                "blob_col BLOB(10K) NOT NULL)");
       
        conn.commit();
       
        pSt=conn.prepareStatement("INSERT INTO blob_tab values (?,?)");
        stream = new TestInputStream(size, val);
       
        //this insert fails(size>10K)
        pSt.setInt(1, val);
        pSt.setBinaryStream(2, stream, size);
        assertStatementError("22001", pSt);
        pSt.close();
       
        conn.rollback();
       
        st.executeUpdate("ALTER TABLE blob_tab ALTER COLUMN "
                +"blob_col SET DATA TYPE blob(20K)")
       
        pSt=conn.prepareStatement("INSERT INTO blob_tab values (?,?)");
        stream = new TestInputStream(size, val);
       
        //this insert succeed (maximum blob size not increased to 20K)
        pSt.setInt(1, val);
        pSt.setBinaryStream(2, stream, size);
        pSt.executeUpdate();
View Full Code Here

Examples of org.apache.derbyTesting.functionTests.util.TestInputStream

              
        st.executeUpdate("create table clob_tab(c1 int,clob_col clob(10K))");
        conn.commit();
       
        pSt=conn.prepareStatement("INSERT INTO clob_tab values (?,?)");  
        stream = new TestInputStream(size, val);
       
        //this insert fails(size>10K)
        pSt.setInt(1, val);
        pSt.setAsciiStream(2, stream, size);
        assertStatementError("XJ001", pSt);
        pSt.close();
       
        conn.rollback();
       
        st.executeUpdate("ALTER TABLE clob_tab ALTER COLUMN "
                +"clob_col SET DATA TYPE clob(20K)");
       
        pSt=conn.prepareStatement("INSERT INTO clob_tab values (?,?)");
        stream = new TestInputStream(size, val);
       
        //this insert succeed (maximum blob size not increased to 20K)
        pSt.setInt(1, val);
        pSt.setAsciiStream(2, stream, size);
        pSt.executeUpdate();
        pSt.close();
       
       
        //increase the maximum size of the blob       
       
        st.executeUpdate("CREATE TABLE blob_tab ( C1 INTEGER," +
                                "blob_col BLOB(10K) NOT NULL)");
       
        conn.commit();
       
        pSt=conn.prepareStatement("INSERT INTO blob_tab values (?,?)");
        stream = new TestInputStream(size, val);
       
        //this insert fails(size>10K)
        pSt.setInt(1, val);
        pSt.setBinaryStream(2, stream, size);
        assertStatementError("22001", pSt);
        pSt.close();
       
        conn.rollback();
       
        st.executeUpdate("ALTER TABLE blob_tab ALTER COLUMN "
                +"blob_col SET DATA TYPE blob(20K)")
       
        pSt=conn.prepareStatement("INSERT INTO blob_tab values (?,?)");
        stream = new TestInputStream(size, val);
       
        //this insert succeed (maximum blob size not increased to 20K)
        pSt.setInt(1, val);
        pSt.setBinaryStream(2, stream, size);
        pSt.executeUpdate();
View Full Code Here

Examples of org.apache.jackrabbit.mk.test.util.TestInputStream

        testBlobs(32 * 1024 * 1024, 1024 * 1024);
    }

    private void testBlobs(int size, int bufferSize) {
        // write data
        TestInputStream in = new TestInputStream(size);
        String id = mk.write(in);
        assertNotNull(id);
        assertTrue(in.isClosed());

        // write identical data
        in = new TestInputStream(size);
        String id1 = mk.write(in);
        assertNotNull(id1);
        assertTrue(in.isClosed());
        // both id's must be identical since they refer to identical data
        assertEquals(id, id1);

        // verify length
        assertEquals(mk.getLength(id), size);

        // verify data
        InputStream in1 = new TestInputStream(size);
        InputStream in2 = new BufferedInputStream(
                new MicroKernelInputStream(mk, id), bufferSize);
        try {
            while (true) {
                int x = in1.read();
                int y = in2.read();
                if (x == -1 || y == -1) {
                    if (x == y) {
                        break;
                    }
View Full Code Here

Examples of org.apache.jackrabbit.mk.test.util.TestInputStream

        testBlobs(32 * 1024 * 1024, 1024 * 1024);
    }

    private void testBlobs(int size, int bufferSize) {
        // write data
        TestInputStream in = new TestInputStream(size);
        String id = mk.write(in);
        assertNotNull(id);
        assertTrue(in.isClosed());

        // write identical data
        in = new TestInputStream(size);
        String id1 = mk.write(in);
        assertNotNull(id1);
        assertTrue(in.isClosed());
        // both id's must be identical since they refer to identical data
        assertEquals(id, id1);

        // verify length
        assertEquals(mk.getLength(id), size);

        // verify data
        InputStream in1 = new TestInputStream(size);
        InputStream in2 = new BufferedInputStream(
                new MicroKernelInputStream(mk, id), bufferSize);
        try {
            while (true) {
                int x = in1.read();
                int y = in2.read();
                if (x == -1 || y == -1) {
                    if (x == y) {
                        break;
                    }
View Full Code Here

Examples of org.apache.jackrabbit.mk.test.util.TestInputStream

        testBlobs(32 * 1024 * 1024);
    }

    private void testBlobs(int size) {
        // write data
        TestInputStream in = new TestInputStream(size);
        String id = mk.write(in);
        assertNotNull(id);
        assertTrue(in.isClosed());

        // write identical data
        in = new TestInputStream(size);
        String id1 = mk.write(in);
        assertNotNull(id1);
        assertTrue(in.isClosed());
        // both id's must be identical since they refer to identical data
        assertEquals(id, id1);

        // verify length
        assertEquals(mk.getLength(id), size);

        // verify data
        InputStream in1 = new TestInputStream(size);
        InputStream in2 = new BufferedInputStream(new MicroKernelInputStream(mk, id));
        try {
            while (true) {
                int x = in1.read();
                int y = in2.read();
                if (x == -1 || y == -1) {
                    if (x == y) {
                        break;
                    }
View Full Code Here

Examples of org.apache.jackrabbit.mk.test.util.TestInputStream

        testBlobs(32 * 1024 * 1024);
    }

    private void testBlobs(int size) {
        // write data
        TestInputStream in = new TestInputStream(size);
        String id = mk.write(in);
        assertNotNull(id);
        assertTrue(in.isClosed());

        // write identical data
        in = new TestInputStream(size);
        String id1 = mk.write(in);
        assertNotNull(id1);
        assertTrue(in.isClosed());
        // both id's must be identical since they refer to identical data
        assertEquals(id, id1);

        // verify length
        assertEquals(mk.getLength(id), size);

        // verify data
        InputStream in1 = new TestInputStream(size);
        InputStream in2 = new BufferedInputStream(new MicroKernelInputStream(mk, id));
        try {
            while (true) {
                int x = in1.read();
                int y = in2.read();
                if (x == -1 || y == -1) {
                    if (x == y) {
                        break;
                    }
View Full Code Here

Examples of org.apache.jackrabbit.mk.test.util.TestInputStream

        testBlobs(32 * 1024 * 1024, 1024 * 1024);
    }

    private void testBlobs(int size, int bufferSize) {
        // write data
        TestInputStream in = new TestInputStream(size);
        String id = mk.write(in);
        assertNotNull(id);
        assertTrue(in.isClosed());

        // write identical data
        in = new TestInputStream(size);
        String id1 = mk.write(in);
        assertNotNull(id1);
        assertTrue(in.isClosed());
        // both id's must be identical since they refer to identical data
        assertEquals(id, id1);

        // verify length
        assertEquals(mk.getLength(id), size);

        // verify data
        InputStream in1 = new TestInputStream(size);
        InputStream in2 = new BufferedInputStream(
                new MicroKernelInputStream(mk, id), bufferSize);
        try {
            while (true) {
                int x = in1.read();
                int y = in2.read();
                if (x == -1 || y == -1) {
                    if (x == y) {
                        break;
                    }
View Full Code Here

Examples of org.apache.jackrabbit.mk.test.util.TestInputStream

        testBlobs(32 * 1024 * 1024, 1024 * 1024);
    }

    private void testBlobs(int size, int bufferSize) {
        // write data
        TestInputStream in = new TestInputStream(size);
        String id = mk.write(in);
        assertNotNull(id);
        assertTrue(in.isClosed());

        // write identical data
        in = new TestInputStream(size);
        String id1 = mk.write(in);
        assertNotNull(id1);
        assertTrue(in.isClosed());
        // both id's must be identical since they refer to identical data
        assertEquals(id, id1);

        // verify length
        assertEquals(mk.getLength(id), size);

        // verify data
        InputStream in1 = new TestInputStream(size);
        InputStream in2 = new BufferedInputStream(
                new MicroKernelInputStream(mk, id), bufferSize);
        try {
            while (true) {
                int x = in1.read();
                int y = in2.read();
                if (x == -1 || y == -1) {
                    if (x == y) {
                        break;
                    }
View Full Code Here

Examples of org.apache.jackrabbit.mk.test.util.TestInputStream

        testBlobs(32 * 1024 * 1024, 1024 * 1024);
    }

    private void testBlobs(int size, int bufferSize) {
        // write data
        TestInputStream in = new TestInputStream(size);
        String id = mk.write(in);
        assertNotNull(id);
        assertTrue(in.isClosed());

        // write identical data
        in = new TestInputStream(size);
        String id1 = mk.write(in);
        assertNotNull(id1);
        assertTrue(in.isClosed());
        // both id's must be identical since they refer to identical data
        assertEquals(id, id1);

        // verify length
        assertEquals(mk.getLength(id), size);

        // verify data
        InputStream in1 = new TestInputStream(size);
        InputStream in2 = new BufferedInputStream(
                new MicroKernelInputStream(mk, id), bufferSize);
        try {
            while (true) {
                int x = in1.read();
                int y = in2.read();
                if (x == -1 || y == -1) {
                    if (x == y) {
                        break;
                    }
View Full Code Here

Examples of org.apache.jackrabbit.mk.test.util.TestInputStream

        }
    }

    @Test
    public void testReadReturnsNonNegative() {
        TestInputStream in = new TestInputStream(0);
        String id = mk.write(in);
        assertNotNull(id);
        assertTrue(in.isClosed());

        assertTrue("read returns negative value", mk.read(id, 0, new byte[1], 0, 1) >= 0);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.