本文整理匯總了Java中org.apache.axiom.om.OMElement.getFirstElement方法的典型用法代碼示例。如果您正苦於以下問題:Java OMElement.getFirstElement方法的具體用法?Java OMElement.getFirstElement怎麽用?Java OMElement.getFirstElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.axiom.om.OMElement
的用法示例。
在下文中一共展示了OMElement.getFirstElement方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testSequence
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@SetEnvironment(executionEnvironments = {ExecutionEnvironment.STANDALONE})
@Test(groups = "wso2.esb", description = "Tests http address")
public void testSequence() throws Exception {
String response = client.getResponse(getMainSequenceURL(), "WSO2");
Assert.assertNotNull(response, "Response Message is null");
OMElement envelope = client.toOMElement(response);
OMElement soapBody = envelope.getFirstElement();
Iterator iterator =
soapBody.getChildrenWithName(new QName("http://services.samples",
"getQuoteResponse"));
int i = 0;
while (iterator.hasNext()) {
i++;
OMElement getQuote = (OMElement) iterator.next();
Assert.assertTrue(getQuote.toString().contains("WSO2"));
}
Assert.assertEquals(i, 2, "Child Element mismatched");
}
示例2: testTemplateWithValuesAndExpressions
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = {"wso2.esb"}, description = "Template with values and expressions")
public void testTemplateWithValuesAndExpressions() throws IOException, XMLStreamException {
String soapResponse = getResponse();
assertNotNull(soapResponse, "Response message is null");
OMElement response = AXIOMUtil.stringToOM(soapResponse);
OMElement soapBody = response.getFirstElement();
Iterator quoteBody = soapBody.getChildElements();
int count = 0;
while (quoteBody.hasNext()) {
OMElement getQuote = (OMElement) quoteBody.next();
String test = getQuote.getLocalName();
assertEquals(test, "getQuoteResponse", "getQuoteResponse not match");
OMElement omElement = getQuote.getFirstElement();
String symbolResponse = omElement.getFirstChildWithName(
new QName("http://services.samples/xsd", "symbol")).getText();
assertEquals(symbolResponse, "WSO2", "Request symbol not changed");
count++;
}
assertEquals(count, iterations, "number of responses different from requests");
}
示例3: testSequentialProperty
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = "wso2.esb", description = "Tests sequential='true' property")
public void testSequentialProperty() throws Exception {
AxisOperationClient operationClient = new AxisOperationClient();
String response = operationClient.send(getProxyServiceURLHttp("iterateSequentialTestProxy"),
null, createMultipleQuoteRequestBody("WSO2", 10),
"urn:getQuote").toString();
operationClient.destroy();
Assert.assertNotNull(response);
OMElement envelope = AXIOMUtil.stringToOM(response);
OMElement soapBody = envelope.getFirstElement();
Iterator iterator =
soapBody.getChildrenWithName(new QName("http://services.samples",
"getQuoteResponse"));
int i = 0;
while (iterator.hasNext()) {
i++;
OMElement getQuote = (OMElement) iterator.next();
Assert.assertTrue(getQuote.toString().contains("WSO2"));
}
Assert.assertEquals(i , 10, "Chile Element mismatched");
}
示例4: testAttachPath
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = "wso2.esb", description = "Tests attach path property ")
public void testAttachPath() throws IOException, XMLStreamException {
IterateClient client = new IterateClient();
String response = client.getMultipleResponse(
getProxyServiceURLHttp("iterateWithAttachPathTestProxy"), "WSO2", 2);
//TODO has to check the line message and assert attach path has executed properly using logs
//Since that is still not available it is tested using below method
Assert.assertNotNull(response);
OMElement envelope = client.toOMElement(response);
OMElement soapBody = envelope.getFirstElement();
Iterator iterator =
soapBody.getChildrenWithName(new QName("http://services.samples",
"getQuoteResponse"));
int i = 0;
while (iterator.hasNext()) {
i++;
OMElement getQuote = (OMElement) iterator.next();
Assert.assertTrue(getQuote.toString().contains("WSO2"));
}
Assert.assertEquals(i ,2, "Response count mismatched");
}
示例5: testMoreNumberThanMaximum
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = {"wso2.esb"}, description = "more number of messages than maximum count")
public void testMoreNumberThanMaximum() throws IOException, XMLStreamException {
int responseCount = 0;
no_of_requests = 15;
aggregatedRequestClient.setNoOfIterations(no_of_requests);
String Response = aggregatedRequestClient.getResponse();
Assert.assertNotNull(Response);
OMElement Response2 = AXIOMUtil.stringToOM(Response);
OMElement soapBody = Response2.getFirstElement();
Iterator iterator = soapBody.getChildrenWithName(new QName("http://services.samples",
"getQuoteResponse"));
while (iterator.hasNext()) {
responseCount++;
OMElement getQuote = (OMElement) iterator.next();
Assert.assertTrue(getQuote.toString().contains("IBM"));
}
Assert.assertTrue(minMessageCount <= responseCount && responseCount <= maxMessageCount);
}
示例6: testLessNumberThanMaximum
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = {"wso2.esb"}, description = "less number of messages than maximum count")
public void testLessNumberThanMaximum() throws IOException, XMLStreamException {
int responseCount=0;
no_of_requests=60;
aggregatedRequestClient.setNoOfIterations(no_of_requests);
String Response= aggregatedRequestClient.getResponse();
Assert.assertNotNull(Response);
OMElement Response2= AXIOMUtil.stringToOM(Response);
OMElement soapBody = Response2.getFirstElement();
Iterator iterator =soapBody.getChildrenWithName(new QName("http://services.samples",
"getQuoteResponse"));
while (iterator.hasNext()) {
responseCount++;
OMElement getQuote = (OMElement) iterator.next();
Assert.assertTrue(getQuote.toString().contains("IBM"));
}
Assert.assertTrue(2<=responseCount&&responseCount<=no_of_requests);
}
示例7: testMoreNumberThanMinimum
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = {"wso2.esb"}, description = "higher number of messages than minimum count")
public void testMoreNumberThanMinimum() throws IOException, XMLStreamException {
int responseCount=0;
no_of_requests=8;
aggregatedRequestClient.setNoOfIterations(no_of_requests);
String Response= aggregatedRequestClient.getResponse();
Assert.assertNotNull(Response);
OMElement Response2= AXIOMUtil.stringToOM(Response);
OMElement soapBody = Response2.getFirstElement();
Iterator iterator =soapBody.getChildrenWithName(new QName("http://services.samples",
"getQuoteResponse"));
while (iterator.hasNext()) {
responseCount++;
OMElement getQuote = (OMElement) iterator.next();
Assert.assertTrue(getQuote.toString().contains("IBM"));
}
Assert.assertTrue(minMessageCount<=responseCount&&responseCount<=no_of_requests);
}
示例8: testMoreNumberThanMinimum
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = {"wso2.esb"}, description = "higher number of messages than minimum count")
public void testMoreNumberThanMinimum() throws IOException, XMLStreamException {
int responseCount=0;
no_of_requests=10;
aggregatedRequestClient.setNoOfIterations(no_of_requests);
String Response= aggregatedRequestClient.getResponse();
Assert.assertNotNull(Response);
OMElement Response2= AXIOMUtil.stringToOM(Response);
OMElement soapBody = Response2.getFirstElement();
Iterator iterator =soapBody.getChildrenWithName(new QName("http://services.samples",
"getQuoteResponse"));
while (iterator.hasNext()) {
responseCount++;
OMElement getQuote = (OMElement) iterator.next();
Assert.assertTrue(getQuote.toString().contains("IBM"));
}
Assert.assertTrue(2<=responseCount&&responseCount<=no_of_requests);
}
示例9: testEnrichMediator
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = "wso2.esb", description = "Add custom content as a child to the part of message" +
" specified by xpath expression ")
public void testEnrichMediator() throws Exception {
String soapResponse = getResponse();
assertNotNull(soapResponse, "Response message null");
OMElement response = AXIOMUtil.stringToOM(soapResponse);
OMElement soapBody = response.getFirstElement();
OMElement getQuoteElement = soapBody.getFirstChildWithName(
new QName("http://services.samples", "getQuote"));
assertNotNull(getQuoteElement, "sibling null");
OMElement requestElement = getQuoteElement.getFirstElement();
OMElement symbolTagInsideRequestSibling = requestElement.getFirstElement();
assertEquals(requestElement.getLocalName(), "request", "Fault, child");
assertEquals(symbolTagInsideRequestSibling.getLocalName(), "symbol", "Fault, child");
assertEquals(symbolTagInsideRequestSibling.getText(), "WSO2", "Fault, child");
}
示例10: test
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = {"wso2.esb"}, description = "Sending request for aggregation")
public void test() throws IOException, XMLStreamException {
int responseCount = 0;
OMElement response = AXIOMUtil.stringToOM(aggregatedRequestClient.getResponse());
OMElement soapBody = response.getFirstElement();
Iterator iterator = soapBody.getChildrenWithName(new QName("http://services.samples",
"getQuoteResponse"));
while (iterator.hasNext()) {
responseCount++;
OMElement getQuote = (OMElement) iterator.next();
Assert.assertTrue(getQuote.toString().contains("IBM Company"));
}
Assert.assertEquals(no_of_requests, responseCount, "Response Aggregation not as expected");
}
示例11: testNestedAggregateWithLargeMessage
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = {"wso2.esb"}, description = "sending nested aggregate request > request iterator count 2500")
public void testNestedAggregateWithLargeMessage() throws IOException, XMLStreamException {
int messageItr = 15;
String response = aggregatedRequestClient.getResponse(createNestedQuoteRequestBody("WSO2", messageItr));
OMElement response2 = AXIOMUtil.stringToOM(response);
OMElement soapBody = response2.getFirstElement();
Iterator iterator = soapBody.getChildrenWithName(new QName("http://services.samples",
"getQuoteResponse"));
int responseCount = 0;
while (iterator.hasNext()) {
responseCount++;
OMElement getQuote = (OMElement) iterator.next();
Assert.assertTrue(getQuote.toString().contains("WSO2 Company"));
}
Assert.assertEquals(responseCount, messageItr * messageItr, "Response count Mismatched");
}
示例12: testEnrichMediator
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = "wso2.esb", description = "Add custom content as a child to the part of message" +
" specified by xpath expression ")
public void testEnrichMediator() throws Exception {
OMElement response;
response = axis2Client.sendSimpleStockQuoteRequest(getProxyServiceURLHttp("enrichAddBodyToChildTestProxy"), null,
"WSO2");
assertNotNull(response, "Response message null");
OMElement returnTag = response.getFirstElement();
OMElement symbolResponse = returnTag.getFirstChildWithName(
new QName("http://services.samples", "getQuoteResponse")).getFirstElement();
assertEquals(symbolResponse.getLocalName(), "return", "child symbol not added.");
}
示例13: testEqualtoMaximum
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = {"wso2.esb"}, description = "number of messages is equal to the maximum")
public void testEqualtoMaximum() throws IOException, XMLStreamException {
int responseCount = 0;
no_of_requests = maxMessageCount;
aggregatedRequestClient.setNoOfIterations(no_of_requests);
String Response = aggregatedRequestClient.getResponse();
Assert.assertNotNull(Response);
OMElement Response2 = AXIOMUtil.stringToOM(Response);
OMElement soapBody = Response2.getFirstElement();
Iterator iterator = soapBody.getChildrenWithName(new QName("http://services.samples",
"getQuoteResponse"));
while (iterator.hasNext()) {
responseCount++;
OMElement getQuote = (OMElement) iterator.next();
Assert.assertTrue(getQuote.toString().contains("IBM"));
}
Assert.assertTrue(minMessageCount <= responseCount && responseCount <= no_of_requests);
}
示例14: testMoreNumberThanMinimum
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = {"wso2.esb"}, description = "higher number of messages than minimum count")
public void testMoreNumberThanMinimum() throws IOException, XMLStreamException {
int responseCount = 0;
no_of_requests = 8;
aggregatedRequestClient.setNoOfIterations(no_of_requests);
String Response = aggregatedRequestClient.getResponse();
Assert.assertNotNull(Response);
OMElement Response2 = AXIOMUtil.stringToOM(Response);
OMElement soapBody = Response2.getFirstElement();
Iterator iterator = soapBody.getChildrenWithName(new QName("http://services.samples",
"getQuoteResponse"));
while (iterator.hasNext()) {
responseCount++;
OMElement getQuote = (OMElement) iterator.next();
Assert.assertTrue(getQuote.toString().contains("IBM"));
}
Assert.assertTrue(minMessageCount <= responseCount && responseCount <= no_of_requests);
}
示例15: testSymbolSunChangedToIBM
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(enabled = false,
description = "Simple Message Transformation - Rule Mediator for Message Transformation- SUN changed to IBM")
public void testSymbolSunChangedToIBM() throws Exception {
OMElement response = axis2Client.sendSimpleStockQuoteRequest(
getMainSequenceURL(), null, "SUN");
Assert.assertNotNull(response, "Response is null");
OMElement returnElement = response.getFirstElement();
OMElement symbolElement = returnElement.getFirstChildWithName(
new QName("http://services.samples/xsd", "symbol"));
assertEquals(symbolElement.getText(), "IBM", "Fault, invalid response");
}