}
}
}
public void testUnmarshalSingleInParam() throws Exception {
ObjectMessageContextImpl objContext = null;
CorbaMessageContextImpl corbaContext = null;
Class[] params = null;
// Prepare the arguments
params = new Class[1];
params[0] = short.class;
CorbaPrimitiveHandler handler = new CorbaPrimitiveHandler(new QName("p"),
CorbaConstants.NT_CORBA_SHORT,
orb.get_primitive_tc(TCKind.tk_short),
null);
handler.setValue(new Short((short)123));
CorbaStreamable arg0 = new CorbaStreamable(handler, handler.getName());
corbaContext = new CorbaMessageContextImpl(new GenericMessageContext());
corbaContext.put(ObjectMessageContext.MESSAGE_INPUT, true);
corbaContext.setMessage(new CorbaMessage());
corbaContext.getMessage().addStreamableArgument(arg0);
// First try call the operation using a void return type
objContext = new ObjectMessageContextImpl();
objContext.setMethod(paramModesClass.getMethod("testSingleInParam", params));
objContext.setMessageObjects((short)0);
bindingImpl.unmarshal(corbaContext,
objContext,
new JAXBDataBindingCallback(objContext.getMethod(),
DataBindingCallback.Mode.MESSAGE,
null));
Object[] resultArgs = objContext.getMessageObjects();
assertTrue(resultArgs.length == 1);
// Now try the call with a return type
corbaContext.put(ObjectMessageContext.MESSAGE_INPUT, false);
corbaContext.getMessage().setStreamableReturn(arg0);
objContext = new ObjectMessageContextImpl();
objContext.setMethod(paramModesClass.getMethod("testSingleInParamWithReturn", params));
objContext.setMessageObjects((short)0);
bindingImpl.unmarshal(corbaContext,
objContext,
new JAXBDataBindingCallback(objContext.getMethod(),
DataBindingCallback.Mode.MESSAGE,
null));
resultArgs = objContext.getMessageObjects();
assertTrue(resultArgs.length == 1);
Object ret = objContext.getReturn();
assertNotNull(ret);
}