Search in sources :

Example 66 with TypeCode

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);
}
Also used : CorbaTypeMap(org.apache.cxf.binding.corba.CorbaTypeMap) TypeCode(org.omg.CORBA.TypeCode) QName(javax.xml.namespace.QName) Any(org.omg.CORBA.Any) Test(org.junit.Test)

Example 67 with TypeCode

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());
}
Also used : CorbaPrimitiveHandler(org.apache.cxf.binding.corba.types.CorbaPrimitiveHandler) TypeCode(org.omg.CORBA.TypeCode) CorbaStreamable(org.apache.cxf.binding.corba.CorbaStreamable) QName(javax.xml.namespace.QName) Test(org.junit.Test)

Example 68 with TypeCode

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);
}
Also used : CorbaPrimitiveHandler(org.apache.cxf.binding.corba.types.CorbaPrimitiveHandler) TypeCode(org.omg.CORBA.TypeCode) CorbaStreamable(org.apache.cxf.binding.corba.CorbaStreamable) QName(javax.xml.namespace.QName) Test(org.junit.Test)

Example 69 with TypeCode

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());
}
Also used : TypeCode(org.omg.CORBA.TypeCode) QName(javax.xml.namespace.QName) Fixed(org.apache.cxf.binding.corba.wsdl.Fixed) Test(org.junit.Test)

Example 70 with TypeCode

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);
}
Also used : TypeCode(org.omg.CORBA.TypeCode) QName(javax.xml.namespace.QName) Test(org.junit.Test)

Aggregations

TypeCode (org.omg.CORBA.TypeCode)70 QName (javax.xml.namespace.QName)49 Test (org.junit.Test)44 CorbaPrimitiveHandler (org.apache.cxf.binding.corba.types.CorbaPrimitiveHandler)18 InputStream (org.omg.CORBA.portable.InputStream)15 OutputStream (org.omg.CORBA.portable.OutputStream)14 StructMember (org.omg.CORBA.StructMember)9 CorbaBindingException (org.apache.cxf.binding.corba.CorbaBindingException)6 MemberType (org.apache.cxf.binding.corba.wsdl.MemberType)6 Any (org.omg.CORBA.Any)6 NVList (org.omg.CORBA.NVList)6 CorbaStreamable (org.apache.cxf.binding.corba.CorbaStreamable)5 CorbaObjectHandler (org.apache.cxf.binding.corba.types.CorbaObjectHandler)4 Array (org.apache.cxf.binding.corba.wsdl.Array)4 Enum (org.apache.cxf.binding.corba.wsdl.Enum)4 Enumerator (org.apache.cxf.binding.corba.wsdl.Enumerator)4 Sequence (org.apache.cxf.binding.corba.wsdl.Sequence)4 Struct (org.apache.cxf.binding.corba.wsdl.Struct)4 Exchange (org.apache.cxf.message.Exchange)4 IOException (java.io.IOException)3