use of org.apache.hello_world_doc_lit_bare.types.TradePriceData in project cxf by apache.
the class DOCBareClientServerTest method testAnnotation.
@Test
public void testAnnotation() throws Exception {
Class<PutLastTradedPricePortType> claz = PutLastTradedPricePortType.class;
TradePriceData priceData = new TradePriceData();
Holder<TradePriceData> holder = new Holder<TradePriceData>(priceData);
Method method = claz.getMethod("sayHi", holder.getClass());
assertNotNull("Can not find SayHi method in generated class ", method);
Annotation ann = method.getAnnotation(WebMethod.class);
WebMethod webMethod = (WebMethod) ann;
assertEquals(webMethod.operationName(), "SayHi");
Annotation[][] paraAnns = method.getParameterAnnotations();
for (Annotation[] paraType : paraAnns) {
for (Annotation an : paraType) {
if (an.annotationType() == WebParam.class) {
WebParam webParam = (WebParam) an;
assertNotSame("", webParam.targetNamespace());
}
}
}
}
use of org.apache.hello_world_doc_lit_bare.types.TradePriceData in project cxf by apache.
the class XMLStreamDataReaderTest method testReadBare.
@Test
public void testReadBare() throws Exception {
JAXBDataBinding db = getDataBinding(TradePriceData.class);
reader = getTestReader("../resources/sayHiDocLitBareReq.xml");
assertNotNull(reader);
DataReader<XMLStreamReader> dr = db.createReader(XMLStreamReader.class);
assertNotNull(dr);
QName elName = new QName("http://apache.org/hello_world_doc_lit_bare/types", "inout");
MessagePartInfo part = new MessagePartInfo(elName, null);
part.setElement(true);
part.setElementQName(elName);
part.setTypeClass(TradePriceData.class);
Object val = dr.read(part, reader);
assertNotNull(val);
assertTrue(val instanceof TradePriceData);
assertEquals("CXF", ((TradePriceData) val).getTickerSymbol());
assertEquals(new Float(1.0f), new Float(((TradePriceData) val).getTickerPrice()));
}
use of org.apache.hello_world_doc_lit_bare.types.TradePriceData in project cxf by apache.
the class XMLStreamDataWriterTest method testSetProperty.
@Test
public void testSetProperty() throws Exception {
MyCustomHandler handler = new MyCustomHandler();
DataWriterImpl<XMLStreamWriter> dw = newDataWriter(handler);
// Write Stuff
TradePriceData val = new TradePriceData();
val.setTickerSymbol("This is a symbol");
val.setTickerPrice(1.0f);
QName elName = new QName("http://apache.org/hello_world_doc_lit_bare/types", "inout");
MessagePartInfo part = new MessagePartInfo(elName, null);
part.setElement(true);
part.setElementQName(elName);
dw.write(val, part, streamWriter);
streamWriter.flush();
// Test MyCustomHandler
assertTrue(handler.getUsed());
}
use of org.apache.hello_world_doc_lit_bare.types.TradePriceData in project cxf by apache.
the class OOBHeaderTest method testBasicConnection.
@Test
public void testBasicConnection() throws Exception {
URL wsdl = getClass().getResource("/wsdl/doc_lit_bare.wsdl");
assertNotNull("WSDL is null", wsdl);
SOAPService service = new SOAPService(wsdl, serviceName);
assertNotNull("Service is null", service);
PutLastTradedPricePortType putLastTradedPrice = service.getPort(portName, PutLastTradedPricePortType.class);
updateAddressPort(putLastTradedPrice, PORT);
TradePriceData priceData = new TradePriceData();
priceData.setTickerPrice(1.0f);
priceData.setTickerSymbol("CELTIX");
assertFalse(check(0, putLastTradedPrice, false, true, priceData));
assertFalse(check(1, putLastTradedPrice, false, true, priceData));
assertTrue(check(2, putLastTradedPrice, false, true, priceData));
assertTrue(check(3, putLastTradedPrice, false, true, priceData));
assertFalse(check(0, putLastTradedPrice, true, true, priceData));
assertFalse(check(1, putLastTradedPrice, true, true, priceData));
assertFalse(check(2, putLastTradedPrice, true, true, priceData));
assertFalse(check(3, putLastTradedPrice, true, true, priceData));
assertTrue(check(0, putLastTradedPrice, false, false, priceData));
assertTrue(check(1, putLastTradedPrice, false, false, priceData));
assertTrue(check(2, putLastTradedPrice, false, false, priceData));
assertTrue(check(4, putLastTradedPrice, false, false, priceData));
assertTrue(check(0, putLastTradedPrice, true, false, priceData));
assertTrue(check(1, putLastTradedPrice, true, false, priceData));
assertTrue(check(2, putLastTradedPrice, true, false, priceData));
assertTrue(check(4, putLastTradedPrice, true, false, priceData));
}
use of org.apache.hello_world_doc_lit_bare.types.TradePriceData in project cxf by apache.
the class BareInInterceptorTest method testInterceptorInbound1.
@Test
public void testInterceptorInbound1() throws Exception {
setUpUsingDocLit();
BareInInterceptor interceptor = new BareInInterceptor();
message.setContent(XMLStreamReader.class, XMLInputFactory.newInstance().createXMLStreamReader(getTestStream(getClass(), "resources/sayHiDocLitBareReq.xml")));
message.put(Message.INBOUND_MESSAGE, Message.INBOUND_MESSAGE);
interceptor.handleMessage(message);
assertNull(message.getContent(Exception.class));
List<?> parameters = message.getContent(List.class);
assertEquals(1, parameters.size());
Object obj = parameters.get(0);
assertTrue(obj instanceof TradePriceData);
TradePriceData greet = (TradePriceData) obj;
assertTrue(1.0 == greet.getTickerPrice());
assertEquals("CXF", greet.getTickerSymbol());
}
Aggregations