本文整理汇总了Java中org.apache.axiom.om.OMElement.toString方法的典型用法代码示例。如果您正苦于以下问题:Java OMElement.toString方法的具体用法?Java OMElement.toString怎么用?Java OMElement.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axiom.om.OMElement
的用法示例。
在下文中一共展示了OMElement.toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formatResponse
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
/**
* Format the sent in response as required by OpenSAML
*
* @param xacmlResponse : received XACML response
* @return formatted response
*/
private String formatResponse(String xacmlResponse) throws Exception {
xacmlResponse = xacmlResponse.replace("\n", "");
OMElement omElemnt;
try {
omElemnt = org.apache.axiom.om.util.AXIOMUtil.stringToOM(xacmlResponse);
omElemnt.setNamespace(xacmlContextNS);
if (omElemnt.getChildren() != null) {
Iterator childIterator = omElemnt.getChildElements();
setXACMLNamespace(childIterator);
}
} catch (Exception e) {
log.error("Error while generating the OMElement from the XACML request.", e);
throw new Exception("Error while generating the OMElement from the XACML request.", e);
}
return omElemnt.toString();
}
示例2: setConfigurations
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
public static OMElement setConfigurations(OMElement synapseConfig) throws XMLStreamException {
if (true) {
//return same configurations as for the ActiveMQ
return synapseConfig;
} else {
//changing the configurations to work with WSO2 MB instead of ActiveMQ
String config = synapseConfig.toString();
config = config.replace("org.apache.activemq.jndi.ActiveMQInitialContextFactory"
, "org.wso2.andes.jndi.PropertiesFileInitialContextFactory");
config = config.replace("tcp://127.0.0.1:61616", "repository/conf/jndi.properties");
config = config.replace("tcp://localhost:61616", "repository/conf/jndi.properties");
return AXIOMUtil.stringToOM(config);
}
}
示例3: getMultipleResponse
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
/**
* This is used to send a multiple stockquote request
*
* @param address service address
* @param symbol stock quote symbol
* @return
* @throws java.io.IOException
*/
public String getMultipleResponse(String address, String symbol, int iterations)
throws IOException {
AxisOperationClient operationClient = new AxisOperationClient();
OMElement response = null;
try {
response = operationClient.send(address, null, createMultipleQuoteRequestBody(symbol, iterations), "urn:getQuote");
} finally {
operationClient.destroy();
}
Assert.assertNotNull(response, "Response null");
return response.toString();
}
示例4: setEndpoint
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
public static OMElement setEndpoint(String relativePath)
throws XMLStreamException, FileNotFoundException, XPathExpressionException {
ESBTestCaseUtils util = new ESBTestCaseUtils();
relativePath = relativePath.replaceAll("[\\\\/]", File.separator);
OMElement synapse = util.loadResource(relativePath);
//if builder is enable, keep current configuration
if (TestConfigurationProvider.isIntegration()) {
return synapse;
}
String config = synapse.toString();
String secureStockQuoteService = EndpointGenerator.getBackEndServiceEndpointUrl("");
config = config.replace("http://localhost:9009/services/"
, secureStockQuoteService);
config = config.replace("http://127.0.0.1:9009/services/"
, secureStockQuoteService);
return AXIOMUtil.stringToOM(config);
}
示例5: getMultipleCustomResponse
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
/**
* This is used to send a multiple custom stockquote request
*
* @param address service address
* @param symbol stock quote symbol
* @return
* @throws java.io.IOException
*/
public String getMultipleCustomResponse(String address, String symbol, int iterations)
throws IOException {
AxisOperationClient operationClient = new AxisOperationClient();
OMElement response = null;
try {
response = operationClient.send(address, null, createMultipleCustomQuoteRequestBody(symbol, iterations), "urn:getQuote");
} finally {
operationClient.destroy();
}
Assert.assertNotNull(response, "Response null");
return response.toString();
}
示例6: getGetQuotesResponse
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
/**
* This is used to send a request which contains several getquote elements
*
* @param address service address
* @param symbol stock quote symbol
* @return
* @throws java.io.IOException
*/
public String getGetQuotesResponse(String address, String symbol, int iterations)
throws IOException {
AxisOperationClient operationClient = new AxisOperationClient();
OMElement response = null;
try {
response = operationClient.send(address, null, createGetQuotesRequestBody(symbol, iterations), "urn:getQuote");
} finally {
operationClient.destroy();
}
Assert.assertNotNull(response, "Response null");
return response.toString();
}
示例7: testEncloseElementToResponseAggregatorCheck
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
@Test(groups = {"wso2.esb"}, description = "enclose the element to response aggregator")
public void testEncloseElementToResponseAggregatorCheck() throws IOException, XMLStreamException {
no_of_requests = 1;
aggregatedRequestClient.setNoOfIterations(no_of_requests);
OMElement response = aggregatedRequestClient.getResponsenew();
Assert.assertNotNull(response);
String responseStr = response.toString();
Assert.assertTrue(responseStr.contains("WSO2"));
Assert.assertTrue(responseStr.contains("rootelement"));
Assert.assertTrue(responseStr.contains("www.wso2esb.com"));
}
示例8: getResponse
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
public String getResponse() throws IOException {
AxisOperationClient operationClient = new AxisOperationClient();
OMElement response = null;
try {
response = operationClient.send(proxyServiceUrl, null,
createMultipleQuoteRequestBody(symbol, no_of_iterations), "urn:getQuote");
} finally {
operationClient.destroy();
}
Assert.assertNotNull(response, "Response Message is null");
return response.toString();
}
示例9: getResponse
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
private String getResponse() throws IOException {
AxisOperationClient operationClient = new AxisOperationClient();
OMElement response = null;
try {
response = operationClient.send(getProxyServiceURLHttp(proxyServiceName), null,
createMultipleQuoteRequestBody(symbol, iterations), "urn:getQuote");
} finally {
operationClient.destroy();
}
Assert.assertNotNull(response, "Response null");
return response.toString();
}
示例10: getResponse
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
private String getResponse() throws IOException {
AxisOperationClient operationClient = new AxisOperationClient();
OMElement response = null;
try {
response = operationClient.send(getProxyServiceURLHttp("enrichReplaceEnvelopeTestProxy"), null,
createQuoteRequestBody("WSO2"), "urn:getQuote");
} finally {
operationClient.destroy();
}
Assert.assertNotNull(response, "Response null");
return response.toString();
}
示例11: enrichMediatorTest
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
@Test(groups = {"wso2.esb"}, description = "Enrichment of response message")
public void enrichMediatorTest() throws XMLStreamException, AxisFault {
AxisOperationClient operationClient = new AxisOperationClient();
OMElement response = null;
try {
response = operationClient.send(getProxyServiceURLHttp("enrichOrderTest"), null, getRequest(), "urn:mediate");
} finally {
operationClient.destroy();
}
String strResponse = response.toString();
int tag1 = strResponse.indexOf("<price>50.00</price>");
int tag2 = strResponse.indexOf("<comment>REF 10053</comment>");
assertEquals(tag1 < tag2, true, "Tag order not preserved after enrich mediator is used.");
}
示例12: send
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
public String send(String address, OMElement payload, String soapAction) throws IOException {
AxisOperationClient operationClient = new AxisOperationClient();
OMElement response = null;
try {
response = operationClient.send(address, null, payload, soapAction);
} finally {
operationClient.destroy();
}
Assert.assertNotNull(response, "Response null");
return response.toString();
}
示例13: getResponse
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
/**
* @param address
* @param symbol
* @return
* @throws java.io.IOException
*/
public String getResponse(String address, String symbol) throws IOException {
AxisOperationClient operationClient = new AxisOperationClient();
OMElement response = null;
try {
response = operationClient.send(address, null, createSimpleQuoteRequestBody(symbol), "urn:getQuote");
} finally {
operationClient.destroy();
}
Assert.assertNotNull(response, "Response null");
return response.toString();
}
示例14: assertInstanceInfo
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
public boolean assertInstanceInfo(String status, String variableName, String expectedVarValue,
List<String> instanceIds)
throws RemoteException, InstanceManagementException {
boolean variableFound = false;
for (String iid : instanceIds) {
InstanceInfoType instanceInfo = instanceManagementServiceStub.
getInstanceInfo(Long.parseLong(iid));
if (status != null) {
log.info("Validating instance status, expected: " + status +
" actual: " + instanceInfo.getStatus());
}
if (variableName == null) {
variableFound = true;
} else {
Variables_type0 variables = instanceInfo.getRootScope().getVariables();
VariableInfoType[] variableList = variables.getVariableInfo();
for (VariableInfoType variable : variableList) {
String varName = variable.getSelf().getName();
String varValue = null;
for (OMElement varElement : variable.getValue().getExtraElement()) {
if (varValue == null) {
varValue = varElement.toString();
} else {
varValue += varElement.toString();
}
if (expectedVarValue != null) {
if (varName.equals(variableName)) {
if (varValue.contains(expectedVarValue)) {
variableFound = true;
} else {
log.info("Incorrect Test Result: " + varValue +
" Expected" + expectedVarValue + "in the result");
}
}
} else {
variableFound = true;
}
log.info("Variable name: " + varName + "\nVariable Value: " +
varValue);
}
}
}
}
return variableFound;
}
示例15: editFaultyService
import org.apache.axiom.om.OMElement; //导入方法依赖的package包/类
@Test(groups = "wso2.dss", dependsOnMethods = {"isFaultyService"}, description = "Fix the fault and redeploy")
public void editFaultyService()
throws Exception {
DataServiceAdminClient dataServiceAdminService =
new DataServiceAdminClient(dssContext.getContextUrls().getBackEndUrl(),
sessionCookie);
String serviceContent;
String newServiceContent;
SqlDataSourceUtil dssUtil =
new SqlDataSourceUtil(sessionCookie,
dssContext.getContextUrls().getBackEndUrl());
dssUtil.createDataSource(getSqlScript());
serviceContent = dataServiceAdminService.getDataServiceContent(serviceName);
try {
OMElement dbsFile = AXIOMUtil.stringToOM(serviceContent);
OMElement dbsConfig = dbsFile.getFirstChildWithName(new QName("config"));
Iterator configElement1 = dbsConfig.getChildElements();
while (configElement1.hasNext()) {
OMElement property = (OMElement) configElement1.next();
String value = property.getAttributeValue(new QName("name"));
if ("org.wso2.ws.dataservice.protocol".equals(value)) {
property.setText(dssUtil.getJdbcUrl());
} else if ("org.wso2.ws.dataservice.driver".equals(value)) {
property.setText(dssUtil.getDriver());
} else if ("org.wso2.ws.dataservice.user".equals(value)) {
property.setText(dssUtil.getDatabaseUser());
} else if ("org.wso2.ws.dataservice.password".equals(value)) {
property.setText(dssUtil.getDatabasePassword());
}
}
if (log.isDebugEnabled()) {
log.debug(dbsFile);
}
newServiceContent = dbsFile.toString();
} catch (XMLStreamException e) {
log.error("XMLStreamException while handling data service content ", e);
throw new XMLStreamException("XMLStreamException while handling data service content ", e);
}
Assert.assertNotNull("Could not edited service content", newServiceContent);
dataServiceAdminService.editDataService(serviceName, "", newServiceContent);
log.info(serviceName + " edited");
}