use of org.omg.CORBA.TypeCode in project cxf by apache.
the class CorbaAnyHandlerTest method testCorbaAnyHandler.
@Test
public void testCorbaAnyHandler() {
Any a = orb.create_any();
a.insert_string("TestMessage");
QName anyName = new QName("AnyHandlerName");
QName anyIdlType = CorbaConstants.NT_CORBA_ANY;
TypeCode anyTC = orb.get_primitive_tc(TCKind.from_int(TCKind._tk_any));
CorbaTypeMap tm = new CorbaTypeMap(CorbaConstants.NU_WSDL_CORBA);
CorbaAnyHandler anyHandler = new CorbaAnyHandler(anyName, anyIdlType, anyTC, null);
anyHandler.setTypeMap(tm);
// Test the get/set value methods
anyHandler.setValue(a);
Any resultAny = anyHandler.getValue();
assertNotNull(resultAny);
String value = resultAny.extract_string();
assertEquals("TestMessage", value);
// Test get/set CorbaTypeMap methods
CorbaTypeMap resultTM = anyHandler.getTypeMap();
assertEquals(resultTM.getTargetNamespace(), CorbaConstants.NU_WSDL_CORBA);
}
use of org.omg.CORBA.TypeCode in project cxf by apache.
the class CorbaStreamableTest method testGetStreamableAttributes.
@Test
public void testGetStreamableAttributes() {
QName objName = new QName("object");
QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "float", CorbaConstants.NP_WSDL_CORBA);
TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_float);
CorbaPrimitiveHandler obj = new CorbaPrimitiveHandler(objName, objIdlType, objTypeCode, null);
CorbaStreamable streamable = new CorbaStreamableImpl(obj, objName);
TypeCode type = streamable._type();
assertTrue(type.kind().value() == objTypeCode.kind().value());
CorbaPrimitiveHandler storedObj = (CorbaPrimitiveHandler) streamable.getObject();
assertNotNull(storedObj);
int mode = streamable.getMode();
assertTrue(mode == org.omg.CORBA.ARG_OUT.value);
String name = streamable.getName();
assertEquals(name, objName.getLocalPart());
}
use of org.omg.CORBA.TypeCode in project cxf by apache.
the class CorbaStreamableTest method testSetStreamableAttributes.
@Test
public void testSetStreamableAttributes() {
QName objName = new QName("object");
QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "boolean", CorbaConstants.NP_WSDL_CORBA);
TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_boolean);
CorbaPrimitiveHandler obj = new CorbaPrimitiveHandler(objName, objIdlType, objTypeCode, null);
CorbaStreamable streamable = new CorbaStreamableImpl(obj, objName);
streamable.setMode(org.omg.CORBA.ARG_IN.value);
int mode = streamable.getMode();
assertTrue(mode == org.omg.CORBA.ARG_IN.value);
}
use of org.omg.CORBA.TypeCode in project cxf by apache.
the class CorbaFixedHandlerTest method testCorbaFixedHandler.
@Test
public void testCorbaFixedHandler() {
Fixed fixedType = new Fixed();
fixedType.setName("FixedType");
fixedType.setDigits(3);
fixedType.setScale(2);
QName fixedName = new QName(fixedType.getName());
QName fixedIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "FixedType", CorbaConstants.NP_WSDL_CORBA);
TypeCode fixedTC = orb.create_fixed_tc((short) fixedType.getDigits(), (short) fixedType.getScale());
CorbaFixedHandler obj = new CorbaFixedHandler(fixedName, fixedIdlType, fixedTC, fixedType);
assertNotNull(obj);
java.math.BigDecimal value = new java.math.BigDecimal("123.45");
obj.setValue(value);
assertEquals(value, obj.getValue());
String valueData = obj.getValueData();
assertEquals(valueData, value.toString());
assertTrue(fixedType.getDigits() == obj.getDigits());
assertTrue(fixedType.getScale() == obj.getScale());
}
use of org.omg.CORBA.TypeCode in project cxf by apache.
the class CorbaObjectHandlerTest method testGetObjectAttributes.
@Test
public void testGetObjectAttributes() {
QName objName = new QName("object");
QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "long", CorbaConstants.NP_WSDL_CORBA);
TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_long);
CorbaObjectHandler obj = new CorbaObjectHandler(objName, objIdlType, objTypeCode, null);
QName name = obj.getName();
assertNotNull(name);
assertEquals(name, objName);
QName idlType = obj.getIdlType();
assertNotNull(idlType);
assertEquals(idlType, objIdlType);
TypeCode tc = obj.getTypeCode();
assertNotNull(tc);
assertTrue(tc.kind().value() == objTypeCode.kind().value());
Object objDef = obj.getType();
assertNull(objDef);
}
Aggregations