org.apache.axiom.om.OMElement Java Examples

The following examples show how to use org.apache.axiom.om.OMElement. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MessageSender.java    From carbon-commons with Apache License 2.0 6 votes vote down vote up
private Config getDiscoveryConfig(AxisService service) {
    Parameter parameter = service.getParameter(DiscoveryConstants.WS_DISCOVERY_PARAMS);
    Config config;
    if (parameter != null) {
        OMElement element = parameter.getParameterElement();

        // For a ProxyService, the parameter defined as XML, is returned as a string value.
        // Until this problem is solved, we'll be adopting the approach below, to make an
        // attempt to construct the parameter element.
        if (element == null) {
            if (parameter.getValue() != null) {
                try {
                    String wrappedElementText = "<wrapper>" + parameter.getValue() + "</wrapper>";
                    element = AXIOMUtil.stringToOM(wrappedElementText);
                } catch (Exception ignored) { }
            } else {
                return getDefaultConfig();
            }
        }

        config = Config.fromOM(element);
    } else {
        return getDefaultConfig();
    }
    return config;
}
 
Example #2
Source File: VFSTransportTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private void addVFSProxy23() throws Exception {

        String proxyName = "VFSProxy23";
        OMElement proxy = AXIOMUtil.stringToOM("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                + "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"VFSProxy23\" transports=\"vfs\">\n"
                + "                <parameter name=\"transport.vfs.FileURI\">file://" + pathToVfsDir + "test"
                + File.separator + proxyName + File.separator + "in" + File.separator + "</parameter> <!--CHANGE-->\n"
                + "                <parameter name=\"transport.vfs.ContentType\">text/xml</parameter>\n"
                + "                <parameter name=\"transport.vfs.FileNamePattern\">.*\\.xml</parameter>\n"
                + "                <parameter name=\"transport.PollInterval\">1</parameter>\n"
                + "                <target>\n" + "                        <endpoint>\n"
                + "                                <address format=\"soap12\" uri=\"http://localhost:9000/services/SimpleStockQuoteService\"/>\n"
                + "                        </endpoint>\n" + "                        <outSequence>\n"
                + "                                <property action=\"set\" name=\"OUT_ONLY\" value=\"true\"/>\n"
                + "                                 <log level=\"full\"/>" + "                                <send>\n"
                + "                                        <endpoint>\n"
                + "                                                <address uri=\"vfs:file://" + pathToVfsDir + "test"
                + File.separator + proxyName + File.separator + "invalid" + File.separator + "out.xml\"/>"
                + "                                        </endpoint>\n" + "                                </send>\n"
                + "                        </outSequence>\n" + "                </target>\n" + "        </proxy>");
        addProxy(proxy, proxyName);
    }
 
Example #3
Source File: PassThroughProxyWithPreserverSecurityHeaderTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
@Test(groups = "wso2.esb", description = "secure Request to a pass through proxy refer secure backend service")
public void secureRequestScenario1() throws Exception {
    applySecurity("UTSecureStockQuoteProxy", 1, getUserRole());
    addProxy();
    OMElement response = new SecureStockQuoteClient().sendSecuredSimpleStockQuoteRequest(userInfo.getUserName()
            , userInfo.getPassword(), getProxyServiceURLHttps(proxyName + "1")
            , policyPath + "scenario1-policy.xml", "Secured");

    String lastPrice = response.getFirstElement().getFirstChildWithName(new QName("http://services.samples/xsd", "last"))
            .getText();
    assertNotNull(lastPrice, "Fault: response message 'last' price null");

    String symbol = response.getFirstElement().getFirstChildWithName(new QName("http://services.samples/xsd", "symbol"))
            .getText();
    assertEquals(symbol, "Secured", "Fault: value 'symbol' mismatched");

}
 
Example #4
Source File: LBService1.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public OMElement loadOperation(OMElement param) throws AxisFault {

        param.build();
        param.detach();

        OMElement loadElement = param.getFirstChildWithName(new QName("load"));
        String l = loadElement.getText();
        long load = Long.parseLong(l);

        for (long i = 0; i < load; i++) {
            System.out.println("Iteration: " + i);
        }

        String sName = System.getProperty("server_name");
        if (sName != null) {
            loadElement.setText("Response from server: " + sName);
        } else {
            loadElement.setText("Response from anonymous server");
        }
        return param;
    }
 
Example #5
Source File: AddScheduleTaskTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private void addEmployee(String employeeNumber) throws AxisFault {
    OMElement payload = fac.createOMElement("addEmployee", omNs);

    OMElement empNo = fac.createOMElement("employeeNumber", omNs);
    empNo.setText(employeeNumber);
    payload.addChild(empNo);

    OMElement lastName = fac.createOMElement("lastName", omNs);
    lastName.setText("BBB");
    payload.addChild(lastName);

    OMElement fName = fac.createOMElement("firstName", omNs);
    fName.setText("AAA");
    payload.addChild(fName);

    OMElement email = fac.createOMElement("email", omNs);
    email.setText("[email protected]");
    payload.addChild(email);

    OMElement salary = fac.createOMElement("salary", omNs);
    salary.setText("50000");
    payload.addChild(salary);

    new AxisServiceClient().sendRobust(payload, serviceEndPoint, "addEmployee");

}
 
Example #6
Source File: SpecifyMaxMessageCountAsExpressionTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@Test(groups = { "wso2.esb" }, description = "number of messages is equal to the minimum")
public void testEqualtoMinimum() throws IOException, XMLStreamException {
    int responseCount = 0;
    no_of_requests = minMessageCount;
    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.assertEquals(responseCount, no_of_requests, "GetQuoteResponse Element count mismatched");

}
 
Example #7
Source File: OAuthServerConfiguration.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
private void parseTokenValidators(OMElement tokenValidators) {
    if (tokenValidators == null) {
        return;
    }

    Iterator validators = tokenValidators.getChildrenWithLocalName(ConfigElements.TOKEN_VALIDATOR);
    if (validators != null) {
        for (; validators.hasNext(); ) {
            OMElement validator = (OMElement) validators.next();
            if (validator != null) {
                String clazzName = validator.getAttributeValue(new QName(ConfigElements.TOKEN_CLASS_ATTR));
                String type = validator.getAttributeValue(new QName(ConfigElements.TOKEN_TYPE_ATTR));
                tokenValidatorClassNames.put(type, clazzName);
            }
        }
    }
}
 
Example #8
Source File: MailToTransportFolderTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void initialize() throws Exception {
    super.init();
    OMElement mailToProxyOMElement = AXIOMUtil.stringToOM(FileUtils.readFileToString(new File(
            getESBResourceLocation() + File.separator + "mailTransport" + File.separator
                    + "mailTransportReceiver" + File.separator + "mail_transport_folder.xml")));
    Utils.deploySynapseConfiguration(mailToProxyOMElement,
            "MailTransportFolder","proxy-services",
            true);
    carbonLogReader = new CarbonLogReader();
    greenMailUser = GreenMailServer.getPrimaryUser();
    greenMailClient = new GreenMailClient(greenMailUser);
    carbonLogReader.start();

    // Since ESB reads all unread emails one by one, we have to delete
    // the all unread emails before run the test
    GreenMailServer.deleteAllEmails("imap");
}
 
Example #9
Source File: Parse.java    From openxds with Apache License 2.0 6 votes vote down vote up
static public OMElement parse_xml_string(String input_string) throws XMLParserException {
		byte[] ba = input_string.getBytes();

//		create the parser
		XMLStreamReader parser=null;

		try {
			parser = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(ba));
		} catch (XMLStreamException e) {
			throw new XMLParserException("gov.nist.registry.common2.xml.Parse: Could not create XMLStreamReader from " + "input stream");
		}
//		create the builder
		StAXOMBuilder builder = new StAXOMBuilder(parser);

//		get the root element (in this case the envelope)
		OMElement documentElement =  builder.getDocumentElement();

		return documentElement;
	}
 
Example #10
Source File: PassThroughProxyServiceTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@Test(groups = "wso2.esb", description = "Pass through proxy https with addressing uri")
public void testHttpsPassThroughProxyWithAddressing() throws Exception {

    OMElement response = axis2Client
            .sendSimpleStockQuoteRequest(getProxyServiceURLHttps("StockQuotePassThroughProxyWithAddressing"),
                    getBackEndServiceUrl(ESBTestConstant.SIMPLE_STOCK_QUOTE_SERVICE), "WSO2");

    String lastPrice = response.getFirstElement()
            .getFirstChildWithName(new QName("http://services.samples/xsd", "last")).getText();
    assertNotNull(lastPrice, "Fault: response message 'last' price null");

    String symbol = response.getFirstElement()
            .getFirstChildWithName(new QName("http://services.samples/xsd", "symbol")).getText();
    assertEquals(symbol, "WSO2", "Fault: value 'symbol' mismatched");

}
 
Example #11
Source File: QueryFactory.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private static CSVQuery createCSVQuery(DataService dataService,
                                          OMElement queryEl) throws DataServiceFault {
	String queryId, configId, inputNamespace;
	EventTrigger[] eventTriggers;
	Result result;
	try {
	    queryId = getQueryId(queryEl);
	    configId = getConfigId(queryEl);
	    eventTriggers = getEventTriggers(dataService, queryEl);
	    result = getResultFromQueryElement(dataService, queryEl);
	    inputNamespace = extractQueryInputNamespace(dataService, result, queryEl);
	} catch (Exception e) {
		throw new DataServiceFault(e, "Error in parsing CSV query element");
	}
	CSVQuery query = new CSVQuery(dataService, queryId,
                                     getQueryParamsFromQueryElement(queryEl), configId, result,
                                     eventTriggers[0], eventTriggers[1],
                                     extractAdvancedProps(queryEl), inputNamespace);
	return query;
}
 
Example #12
Source File: SimpleSoapIdentityTokenResolver.java    From cougar with Apache License 2.0 6 votes vote down vote up
@Override
  public List<IdentityToken> resolve(OMElement input, X509Certificate[] certificateChain) {
      List<IdentityToken> tokens = new ArrayList<IdentityToken>();
if (input != null) {
	for (Iterator i = input.getChildElements(); i.hasNext();) {
		OMElement element = (OMElement) i.next();
              for (SimpleIdentityTokenName t: SimpleIdentityTokenName.values()) {
                  if (element.getLocalName().equalsIgnoreCase(t.name())) {
                      tokens.add(new IdentityToken(t.name(), element.getText()));
                      break;

                  }
              }
	}
}
      return tokens;
  }
 
Example #13
Source File: QueryTest.java    From openxds with Apache License 2.0 6 votes vote down vote up
@Test
public void testFindDocuments_MultipleStatus() throws Exception {
	//Generate StoredQuery request message
	patientId = XdsTest.patientId;
	String message = findDocumentsQuery(patientId);
	OMElement request = OMUtil.xmlStringToOM(message);			
	System.out.println("Request:\n" +request);

	//3. Send a StoredQuery
	ServiceClient sender = getRegistryServiceClient();															 
	OMElement response = sender.sendReceive( request );
	assertNotNull(response); 

	//4. Verify the response is correct
	OMAttribute status = response.getAttribute(new QName("status"));
	assertEquals("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success", status.getAttributeValue()); 

	String result = response.toString();
	System.out.println("Result:\n" +result);
}
 
Example #14
Source File: HeaderFactory.java    From garoon-google with MIT License 6 votes vote down vote up
/**
 * SOAPリクエストで送るヘッダを作成します。
 * 
 * @param actionName 利用するAPI名
 * @param username APIを利用するユーザー名
 * @param password APIを利用するユーザーのパスワード
 * @param createdTime SOAPメッセージの作成日時
 * @param expiredTime SOAPメッセージの有効期限
 * @return org.apache.axiom.om.OMElement 生成されたヘッダ
 */
public static OMElement create(String actionName, String username, String password, Date createdTime,
        Date expiredTime) {
    OMElement soapHeader = getHeaderElement();

    OMElement actionElement = getActionElement(actionName);
    soapHeader.addChild(actionElement);

    OMElement securityElement = getSecurityElement(username, password);
    soapHeader.addChild(securityElement);

    OMElement timestampElement = getTimestampElement(createdTime, expiredTime);
    soapHeader.addChild(timestampElement);

    return soapHeader;
}
 
Example #15
Source File: Sample704TestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private OMElement createPayload() {   // creation of payload for placeOrder

        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ser");
        OMNamespace xsdNs = fac.createOMNamespace("http://services.samples", "xsd");
        OMElement payload = fac.createOMElement("placeOrder", omNs);
        OMElement order = fac.createOMElement("order", omNs);

        OMElement price = fac.createOMElement("price", xsdNs);
        price.setText("10");
        OMElement quantity = fac.createOMElement("quantity", xsdNs);
        quantity.setText("100");
        OMElement symbol = fac.createOMElement("symbol", xsdNs);
        symbol.setText("WSO2");

        order.addChild(price);
        order.addChild(quantity);
        order.addChild(symbol);
        payload.addChild(order);
        return payload;
    }
 
Example #16
Source File: TestkitStructure.java    From openxds with Apache License 2.0 6 votes vote down vote up
List<String> getStepIds(File testplan) {
	ArrayList<String> ids = new ArrayList<String>();
	OMElement tplan;
	try {
		tplan = Util.parse_xml(testplan);
		AXIOMXPath xpathExpression = new AXIOMXPath ("//TestPlan/TestStep");
		List<OMNode> nodes = xpathExpression.selectNodes(tplan);

		for (int i=0; i<nodes.size(); i++) {
			OMElement testStep = (OMElement) nodes.get(i);
			ids.add(testStep.getAttributeValue(MetadataSupport.id_qname));
		}

	} catch (Exception e) {
		e.printStackTrace();
		System.err.println(ExceptionUtil.exception_details(e));
		System.exit(-1);
	}

	return ids;
}
 
Example #17
Source File: ServiceInvoker.java    From product-ei with Apache License 2.0 6 votes vote down vote up
public void run() {

        client.getOptions().setAction(operation);

        try {

            long t1 = System.currentTimeMillis();

            for (long i=0; i < iterations; i++) {
                OMElement response2 = client.sendReceive(msg);
                OMElement loadElement = response2.getFirstChildWithName(new QName("load"));
                System.out.println(invokerName + ": " + loadElement.toString());
            }

            long t2 = System.currentTimeMillis();

            System.out.println("================================================================");
            System.out.println(invokerName + " completed requests.");
            System.out.println("================================================================");
            runningTime = t2 - t1;

        } catch (AxisFault axisFault) {
            System.out.println(axisFault.getMessage());
        }
    }
 
Example #18
Source File: ThrottleHandler.java    From carbon-apimgt with Apache License 2.0 6 votes vote down vote up
/**
 * This method will intialize subscription level throttling context and throttle object.
 * This method need to be called for each and every request of spike arrest is enabled.
 * If throttle context for incoming message is already created method will do nothing. Else
 * it will create throttle object and context.
 */
private void initThrottleForHardLimitThrottling() {
    OMElement hardThrottlingPolicy = createHardThrottlingPolicy();
    if (hardThrottlingPolicy != null) {
        Throttle tempThrottle;
        try {
            tempThrottle = ThrottleFactory.createMediatorThrottle(
                    PolicyEngine.getPolicy(hardThrottlingPolicy));
            ThrottleConfiguration newThrottleConfig = tempThrottle.getThrottleConfiguration(ThrottleConstants
                                                                                                    .ROLE_BASED_THROTTLE_KEY);
            ThrottleContext hardThrottling = ThrottleContextFactory.createThrottleContext(ThrottleConstants
                                                                                                  .ROLE_BASE,
                                                                                          newThrottleConfig);
            tempThrottle.addThrottleContext(APIThrottleConstants.HARD_THROTTLING_CONFIGURATION, hardThrottling);
            if (throttle != null) {
                throttle.addThrottleContext(APIThrottleConstants.HARD_THROTTLING_CONFIGURATION, hardThrottling);
            } else {
                throttle = tempThrottle;
            }
        } catch (ThrottleException e) {
            log.error("Error occurred while creating policy file for Hard Throttling.", e);
        }
    }
}
 
Example #19
Source File: IaasProviderConfigParser.java    From attic-stratos with Apache License 2.0 6 votes vote down vote up
private static void loadClassName(final String fileName, final IaasProvider iaas, final OMElement iaasElt) {

        Iterator<?> it =
                iaasElt.getChildrenWithName(new QName(
                        CloudControllerConstants.CLASS_NAME_ELEMENT));

        if (it.hasNext()) {
            OMElement classNameElt = (OMElement) it.next();
            iaas.setClassName(classNameElt.getText());
        }

        if (it.hasNext()) {
            log.warn(" file contains more than one " +
                    CloudControllerConstants.CLASS_NAME_ELEMENT + " elements!" +
                    " Elements other than the first will be neglected.");
        }

        if (iaas.getClassName() == null) {
            String msg =
                    "Essential '" + CloudControllerConstants.CLASS_NAME_ELEMENT + "' element " +
                            "has not specified in " + fileName;
            handleException(msg);
        }

    }
 
Example #20
Source File: UserStoreConfigXMLProcessor.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
public static OMElement serialize(RealmConfiguration realmConfig) {
    OMFactory factory = OMAbstractFactory.getOMFactory();

    // add the user store manager properties
    OMElement userStoreManagerElement = factory.createOMElement(new QName(
            UserCoreConstants.RealmConfig.LOCAL_NAME_USER_STORE_MANAGER));
    addPropertyElements(factory, userStoreManagerElement, realmConfig.getUserStoreClass(), realmConfig.getUserStoreProperties());

    return userStoreManagerElement;
}
 
Example #21
Source File: SecureStockQuoteClient.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private OMElement createStandardRequest(String symbol) {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
    OMElement method = fac.createOMElement("getQuote", omNs);
    OMElement value1 = fac.createOMElement("request", omNs);
    OMElement value2 = fac.createOMElement("symbol", omNs);

    value2.addChild(fac.createOMText(value1, symbol));
    value1.addChild(value2);
    method.addChild(value1);

    return method;
}
 
Example #22
Source File: ConfigurationLoader.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private static CORSConfiguration getCORSConfiguration(OMElement apiElement) {
    InternalAPICORSConfiguration config = new InternalAPICORSConfiguration();
    OMElement corsElement = apiElement.getFirstChildWithName(new QName("cors"));
    if (corsElement != null) {
        String enabled = corsElement.getFirstChildWithName(new QName("enabled")).getText();
        String origins = corsElement.getFirstChildWithName(new QName("allowedOrigins")).getText();
        String headers = corsElement.getFirstChildWithName(new QName("allowedHeaders")).getText();

        config.setEnabled(Boolean.valueOf(enabled));
        config.setAllowedOrigins(origins);
        config.setAllowedHeaders(headers);
    }
    return config;
}
 
Example #23
Source File: EnrichIntegrationAddContentAsChildTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@Test(groups = { "wso2.esb" }, description = "Enrich mediator:Add as a child to message body")
public void addAsChildToMessageBody() throws Exception {
    String payload =
            "<m:getQuote xmlns:m=\"http://services.samples\">" + "<m:request>" + "</m:request>" + "</m:getQuote>";
    OMElement payloadOM = AXIOMUtil.stringToOM(payload);
    OMElement response = axis2Client
            .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("enrichAddContentAsChildTestProxy"), null,
                    payloadOM);
    assertNotNull(response, "Response is null");
    assertEquals(response.getLocalName(), "getQuoteResponse", "getQuoteResponse mismatch");
    OMElement omElement = response.getFirstElement();
    String symbolResponse = omElement.getFirstChildWithName(new QName("http://services.samples/xsd", "symbol"))
            .getText();
    assertEquals(symbolResponse, "IBM", "Symbol is not match");
}
 
Example #24
Source File: DS1189LeagyTimeStampModeTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * helper method to insert timestamp values to the database
 *
 * @param idString
 * @param timeStamp
 * @throws org.apache.axis2.AxisFault
 */
private void insertTimeStampToDb(String idString, String timeStamp) throws Exception {
    OMElement payload = fac.createOMElement("insertTimeStamp", omNs);

    OMElement idStringElmnt = fac.createOMElement("idString", omNs);
    idStringElmnt.setText(idString + "");
    payload.addChild(idStringElmnt);

    OMElement timeStampElmnt = fac.createOMElement("testTimeStamp", omNs);
    timeStampElmnt.setText(timeStamp + "");
    payload.addChild(timeStampElmnt);

    new AxisServiceClient().sendRobust(payload, backendUrl + serviceName, "insertTimeStamp");
}
 
Example #25
Source File: PropertyIntegrationRegistryValuesTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@Test(groups = "wso2.esb", description = "Set value from config registry (default scope)")
public void testConfVal() throws Exception {
    OMElement response = axis2Client
            .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("propertyConfRegistryTestProxy"), null,
                    "Random Symbol");
    assertTrue(response.toString().contains("Config Reg Test String"), "Property Not Set");
}
 
Example #26
Source File: AbstractNestedQueryServiceTest.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
protected void nestedQuery2ForDateTime(){
	TestUtils.showMessage(this.epr + " - nestedQuery2ForDateTime");
	try {
           TestUtils.checkForService(this.epr);
		OMElement result = TestUtils.callOperation(this.epr,
				"order_details_for_date_time_op", null);
		assertTrue(TestUtils.validateResultStructure(result,
				TestUtils.ORDER_DETAILS_NESTED_WITH_DATETIME_XSD_PATH));
	} catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
Example #27
Source File: PropertyIntegrationOperationScopeTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@Test(groups = "wso2.esb",
      description = "Set action as \"value\" and type Integer (operation scope)")
public void testIntVal() throws Exception {
    OMElement response = axis2Client
            .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("propertyIntOperationTestProxy"), null, "Random Symbol");
    assertTrue(response.toString().contains("123"),
            "Integer Property Not Set in the Operation scope!");
}
 
Example #28
Source File: RequestLogLevelFullResponseLogLevelFullTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@Test(groups = "wso2.esb", description = "- Logging proxy -Request log level full response log level full", enabled = false)
public void testLoggingProxyLoggingLevel() throws Exception {

    OMElement response = axis2Client
            .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("reqLogFullResLogFullLoggingProxy"), null, "WSO2");
    //ToDo Assert Logs
}
 
Example #29
Source File: PropertyIntegrationAxis2ScopeRemovePropertiesTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@Test(groups = "wso2.esb",
      description = "Remove action as \"value\" and type OM (axis2 scope)")
public void testOMVal() throws Exception {
    logViewer.clearLogs();
    OMElement response = axis2Client
            .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("propertyOMAxis2RemoveTestProxy"), null, "Random Symbol");
    assertTrue(response.toString().contains("Property Set and Removed"),
            "Proxy Invocation Failed!");
    assertTrue(isMatchFound("symbol = OMMMMM"),
            "OM Property Not Either Set or Removed in the Axis2 scope!!");
}
 
Example #30
Source File: PersistenceUtils.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * Create EndpointInfo from OMElement
 *
 * @param endpointInfoOM OMElement containing endpoint information
 * @return equivalent EndpointInfo for OMElement
 */
public static Map<String, Set<String>> convertOMToEndpointPollingInfo(OMElement endpointInfoOM) {

    Map<String, Set<String>> endpointInfo = new ConcurrentHashMap<String, Set<String>>();

    Iterator rootElementsItr = endpointInfoOM.getChildrenWithName(INBOUND_POLLING_ENDPOINTS_QN);

    if (!rootElementsItr.hasNext()) {
        return endpointInfo;
    }

    Iterator pollElementsItr = ((OMElement) rootElementsItr.next()).getChildrenWithName(INBOUND_ENDPOINT_POLL_QN);
    while (pollElementsItr.hasNext()) {

        List<InboundEndpointInfoDTO> tenantList = new ArrayList<InboundEndpointInfoDTO>();
        OMElement pollElement = (OMElement) pollElementsItr.next();

        Iterator endpointsItr = pollElement.getChildrenWithName(ENDPOINT_QN);
        while (endpointsItr.hasNext()) {
            OMElement endpointElement = (OMElement) endpointsItr.next();
            String iTenantDomain = endpointElement.getAttributeValue(DOMAIN_QN);
            String strEndpointName = endpointElement.getAttributeValue(NAME_QN);
            Set lNames = endpointInfo.get(iTenantDomain);
            if (lNames == null) {
                lNames = new HashSet<String>();
            }
            lNames.add(strEndpointName);
            endpointInfo.put(iTenantDomain, lNames);
        }
    }
    return endpointInfo;
}