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"));
}
Aggregations