Package com.sun.jini.test.spec.io.util

Examples of com.sun.jini.test.spec.io.util.FakeMarshalInputStream


            // Attempt to read from MarshalInputStream

            ByteArrayInputStream bios = new ByteArrayInputStream(
                baos.toByteArray());
            MarshalInputStream input = new FakeMarshalInputStream(
                bios,readAnnotationException,null);

            // verify result

            try {
                System.out.println("readObject: " + input.readObject());
                throw new AssertionError("readObject() call should fail");
            } catch (Throwable caught) {
                assertion(readAnnotationException.equals(caught),
                    caught.toString());
            }
View Full Code Here


    // inherit javadoc
    public void run() throws Exception {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        MarshalOutputStream output =
            new MarshalOutputStream(baos,new ArrayList());
        FakeMarshalInputStream input = new FakeMarshalInputStream(
            new ByteArrayInputStream(baos.toByteArray()),null,null);

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case 1: resolveClass(null)");
        logger.log(Level.FINE,"");

        try {
            input.resolveClass(null);
        } catch (NullPointerException ignore) { }

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case 2: resolveProxyClass(null)");
        logger.log(Level.FINE,"");

        try {
            input.resolveProxyClass(null);
        } catch (NullPointerException ignore) { }

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case 3: "
            + "resolveProxyClass(String[] with a null element)");
        logger.log(Level.FINE,"");

        try {
            input.resolveProxyClass(new String[] {null,"bar"});
        } catch (NullPointerException ignore) { }
    }
View Full Code Here

            output.close();

            // Read transferObject from MarshalInputStream
            ByteArrayInputStream bios =
                new ByteArrayInputStream(baos.toByteArray());
            MarshalInputStream input = new FakeMarshalInputStream(
                bios,null,readAnnotationReturnVal,false);
            if (callUseCodebaseAnnotations) {
                input.useCodebaseAnnotations();
            }

            // Setup FakeRMIClassLoaderSpi static fields
            if (transferObject instanceof Proxy) {
                FakeRMIClassLoaderSpi.initLoadProxyClass(
                    loadClassException,
                    (callUseCodebaseAnnotations ?
                        readAnnotationReturnVal : null),
                    new String[] {interfaceName},
                    null);
            } else {
                FakeRMIClassLoaderSpi.initLoadClass(
                    loadClassException,
                    (callUseCodebaseAnnotations ?
                        readAnnotationReturnVal : null),
                    transferObject.getClass().getName(),
                    null);
            }

            // verify result
            try {
                input.readObject();
                throw new TestException("should have never reached here");
            } catch (Throwable caught) {
                if (loadClassException instanceof
                    ClassNotFoundException)
                {
View Full Code Here

            output.close();

            // Read transferObject from MarshalInputStream
            ByteArrayInputStream bios =
                new ByteArrayInputStream(baos.toByteArray());
            MarshalInputStream input = new FakeMarshalInputStream(
                bios,null,null);

            // Setup FakeRMIClassLoaderSpi static fields
            FakeRMIClassLoaderSpi.initLoadClass(
                new ClassNotFoundException(),
                null,
                transferObject.getName(),
                null);

            // verify result
            assertion(input.readObject() == transferObject);
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.jini.test.spec.io.util.FakeMarshalInputStream

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.