Package org.apache.yoko.orb.CORBA

Examples of org.apache.yoko.orb.CORBA.OutputStream


        assertTrue(doubleValue.doubleValue() == 6543.21);
    }
   
    public void testReadString() {
        Buffer buf = new Buffer();
        OutputStream oStream = new OutputStream(buf);
        oStream.write_string("String");
       
        InputStream iStream = oStream.create_input_stream();
        CorbaObjectReader reader = new CorbaObjectReader(iStream);
       
        String stringValue = reader.readString();
        assertTrue(stringValue.equals("String"));
    }
View Full Code Here


        assertTrue(stringValue.equals("String"));
    }
   
    public void testReadWString() {
        Buffer buf = new Buffer();
        OutputStream oStream = new OutputStream(buf);
        oStream.write_wstring("WString");
       
        InputStream iStream = oStream.create_input_stream();
        CorbaObjectReader reader = new CorbaObjectReader(iStream);
       
        String wstringValue = reader.readWString();
        assertTrue(wstringValue.equals("WString"));
    }
View Full Code Here

    public void testReadArray() {
       
        int data[] = { 1, 1, 2, 3, 5, 8, 13, 21 };
       
        Buffer buf = new Buffer();
        OutputStream oStream = new OutputStream(buf);
        oStream.write_long_array(data, 0, data.length);

        InputStream iStream = oStream.create_input_stream();
        CorbaObjectReader reader = new CorbaObjectReader(iStream);

        // create an array of longs
        QName longIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "long", CorbaConstants.NP_WSDL_CORBA);
        QName arrayIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "array", CorbaConstants.NP_WSDL_CORBA);
View Full Code Here

   
    public void testReadSequence() {
        String data[] = { "one", "one", "two", "three", "five", "eight", "thirteen", "twenty-one" };
       
        Buffer buf = new Buffer();
        OutputStream oStream = new OutputStream(buf);
        oStream.write_long(data.length);
        for (int i = 0; i < data.length; ++i) {
            oStream.write_string(data[i]);
        }

        InputStream iStream = oStream.create_input_stream();
        CorbaObjectReader reader = new CorbaObjectReader(iStream);

        // create an sequence of strings
        QName stringIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "string", CorbaConstants.NP_WSDL_CORBA);
        QName seqIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "sequence", CorbaConstants.NP_WSDL_CORBA);
View Full Code Here

        }
    }
   
    public void testReadStruct() {       
        Buffer buf = new Buffer();
        OutputStream oStream = new OutputStream(buf);

        // create the following struct
        // struct TestStruct {
        //     long member1;
        //     string member2;
        //     boolean member3;
        // }
        int member1 = 12345;
        String member2 = "54321";
        boolean member3 = true;
       
        oStream.write_long(member1);
        oStream.write_string(member2);
        oStream.write_boolean(member3);

        InputStream iStream = oStream.create_input_stream();
        CorbaObjectReader reader = new CorbaObjectReader(iStream);
       
        QName structIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "struct", CorbaConstants.NP_WSDL_CORBA);
        QName longIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "long", CorbaConstants.NP_WSDL_CORBA);
        QName stringIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "string", CorbaConstants.NP_WSDL_CORBA);
View Full Code Here

                   == member3);
    }
 
    public void testReadException() {
        Buffer buf = new Buffer();
        OutputStream oStream = new OutputStream(buf);

        // create the following exception
        // exception TestExcept {
        //     short code;
        //     string message;
        // }
        short code = 12345;
        String message = "54321";
       
        oStream.write_string("IDL:org.apache.yoko.TestException/1.0");
        oStream.write_short(code);
        oStream.write_string(message);

        InputStream iStream = oStream.create_input_stream();
        CorbaObjectReader reader = new CorbaObjectReader(iStream);
       
        QName exceptIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "exception", CorbaConstants.NP_WSDL_CORBA);
        QName shortIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "short", CorbaConstants.NP_WSDL_CORBA);
        QName stringIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "string", CorbaConstants.NP_WSDL_CORBA);
View Full Code Here

        assertTrue(((CorbaPrimitiveHandler)nestedObjs.get(1)).getDataFromValue().equals(message));
    }
   
    public void testReadEnum() {
        Buffer buf = new Buffer();
        OutputStream oStream = new OutputStream(buf);
       
        // create the following enum
        // enum { RED, GREEN, BLUE };
        oStream.write_long(1);
        InputStream iStream = oStream.create_input_stream();
        CorbaObjectReader reader = new CorbaObjectReader(iStream);
       
        String[] enums = {"RED", "GREEN", "BLUE" };
        Enum enumType = new Enum();
        Enumerator enumRed = new Enumerator();
View Full Code Here

        assertTrue(obj.getValue().equals(enums[1]));
    }
   
    public void testReadFixed() {
        Buffer buf = new Buffer();
        OutputStream oStream = new OutputStream(buf);
       
        // create the following fixed
        // fixed<5,2>
        oStream.write_fixed(new java.math.BigDecimal("12345.67").movePointRight((int)2));
        InputStream iStream = oStream.create_input_stream();
        CorbaObjectReader reader = new CorbaObjectReader(iStream);
       
        Fixed fixedType = new Fixed();
        fixedType.setDigits(5);
        fixedType.setScale(2);
View Full Code Here

        }
    }

    public void testReadBoolean() {
        Buffer buf = new Buffer();
        OutputStream oStream = new OutputStream(buf);
        oStream.write_boolean(true);
       
        InputStream iStream = oStream.create_input_stream();
        CorbaObjectReader reader = new CorbaObjectReader(iStream);
       
        Boolean boolValue = reader.readBoolean();
        assertTrue(boolValue.booleanValue() == true);
    }
View Full Code Here

    public synchronized org.omg.CORBA.Any to_any(DynValueWriter dynValueWriter) {
        if (destroyed_)
            throw new org.omg.CORBA.OBJECT_NOT_EXIST();

        org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
        OutputStream out = new OutputStream(buf);
        out._OB_ORBInstance(orbInstance_);

        if (dynValueWriter != null)
            _OB_marshal(out, dynValueWriter);
        else
            _OB_marshal(out);

        InputStream in = (InputStream) out.create_input_stream();
        Any result = new Any(orbInstance_, type_, in);
        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.yoko.orb.CORBA.OutputStream

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.