Search in sources :

Example 1 with CorbaFixedHandler

use of org.apache.cxf.binding.corba.types.CorbaFixedHandler in project cxf by apache.

the class CorbaObjectReaderTest method testReadFixed.

@Test
public void testReadFixed() {
    if (System.getProperty("java.vendor").contains("IBM")) {
        // to the stream.
        return;
    }
    OutputStream oStream = orb.create_output_stream();
    // create the following fixed
    // fixed<5,2>
    oStream.write_fixed(new java.math.BigDecimal("12345.67").movePointRight(2));
    InputStream iStream = oStream.create_input_stream();
    CorbaObjectReader reader = new CorbaObjectReader(iStream);
    Fixed fixedType = new Fixed();
    fixedType.setDigits(5);
    fixedType.setScale(2);
    // These values don't matter to the outcome of the test but are needed during construction
    QName fixedName = new QName("TestFixed");
    QName fixedIdlType = new QName("corbatm:TestFixed");
    TypeCode fixedTC = orb.create_fixed_tc((short) fixedType.getDigits(), (short) fixedType.getScale());
    CorbaFixedHandler obj = new CorbaFixedHandler(fixedName, fixedIdlType, fixedTC, fixedType);
    reader.readFixed(obj);
    assertEquals(obj.getValue(), new java.math.BigDecimal("12345.67"));
}
Also used : TypeCode(org.omg.CORBA.TypeCode) InputStream(org.omg.CORBA.portable.InputStream) QName(javax.xml.namespace.QName) CorbaFixedHandler(org.apache.cxf.binding.corba.types.CorbaFixedHandler) OutputStream(org.omg.CORBA.portable.OutputStream) Fixed(org.apache.cxf.binding.corba.wsdl.Fixed) Test(org.junit.Test)

Aggregations

QName (javax.xml.namespace.QName)1 CorbaFixedHandler (org.apache.cxf.binding.corba.types.CorbaFixedHandler)1 Fixed (org.apache.cxf.binding.corba.wsdl.Fixed)1 Test (org.junit.Test)1 TypeCode (org.omg.CORBA.TypeCode)1 InputStream (org.omg.CORBA.portable.InputStream)1 OutputStream (org.omg.CORBA.portable.OutputStream)1