List of usage examples for javax.xml.namespace QName valueOf
public static QName valueOf(String qNameAsString)
From source file:org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMappingTest.java
@Test public void invoke() throws Exception { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage request = messageFactory.createMessage(); request.getSOAPBody().addBodyElement(QName.valueOf("{http://springframework.org/spring-ws}Request")); MessageContext messageContext = new DefaultMessageContext(new SaajSoapMessage(request), new SaajSoapMessageFactory(messageFactory)); DefaultMethodEndpointAdapter adapter = new DefaultMethodEndpointAdapter(); adapter.afterPropertiesSet();// w w w . jav a 2s. c o m MessageDispatcher messageDispatcher = new SoapMessageDispatcher(); messageDispatcher.setApplicationContext(applicationContext); messageDispatcher.setEndpointMappings(Collections.<EndpointMapping>singletonList(mapping)); messageDispatcher.setEndpointAdapters(Collections.<EndpointAdapter>singletonList(adapter)); messageDispatcher.receive(messageContext); MyEndpoint endpoint = applicationContext.getBean("endpoint", MyEndpoint.class); assertTrue("doIt() not invoked on endpoint", endpoint.isDoItInvoked()); LogAspect aspect = (LogAspect) applicationContext.getBean("logAspect"); assertTrue("log() not invoked on aspect", aspect.isLogInvoked()); }
From source file:org.wso2.bps.integration.common.clients.bpel.BpelProcessManagementClient.java
public void setStatus(String processID, String status) throws RemoteException, ProcessManagementException { if (ProcessStatus.ACTIVE.getValue().equals(status.toUpperCase())) { processManagementServiceStub.activateProcess(QName.valueOf(processID)); } else if (ProcessStatus.RETIRED.getValue().equals(status.toUpperCase())) { processManagementServiceStub.retireProcess(QName.valueOf(processID)); }/*from ww w. j a v a 2 s .c o m*/ }
From source file:org.wso2.bps.integration.common.clients.bpel.BpelProcessManagementClient.java
public String getStatus(String processID) throws RemoteException, ProcessManagementException { String status = null;/* w w w .j a va 2 s . c om*/ ProcessInfoType processInfo = processManagementServiceStub.getProcessInfo(QName.valueOf(processID)); status = processInfo.getStatus().getValue().toString(); return status; }
From source file:org.wso2.carbon.bpel.core.ode.integration.mgt.services.InstanceManagementServiceSkeleton.java
private void fillInstanceInfo(InstanceInfoType instanceInfo, ProcessInstanceDAO processInstance) throws InstanceManagementException { // ((ProcessConfigurationImpl) getTenantProcessForCurrentSession().getProcessConfiguration(QName.valueOf // (instanceInfo.getPid()))).getEventsEnabled(); instanceInfo.setIid(processInstance.getInstanceId().toString()); instanceInfo.setPid(processInstance.getProcess().getProcessId().toString()); instanceInfo.setDateStarted(toCalendar(processInstance.getCreateTime())); instanceInfo.setDateLastActive(toCalendar(processInstance.getLastActiveTime())); instanceInfo.setStatus(odeInstanceStatusToManagementAPIStatus(processInstance.getState())); instanceInfo.setIsEventsEnabled(((ProcessConfigurationImpl) getTenantProcessForCurrentSession() .getProcessConfiguration(QName.valueOf(instanceInfo.getPid()))).getEventsEnabled()); fillFaultAndFailure(processInstance, instanceInfo); if (processInstance.getRootScope() != null) { instanceInfo.setRootScope(getScopeInfo(processInstance.getRootScope())); }/*from w ww .j av a 2 s . c o m*/ }
From source file:org.wso2.carbon.bpel.ui.bpel2svg.PNGGenarateServlet.java
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. * * @param request servlet request/*from w w w . j a v a2 s .c o m*/ * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Log log = LogFactory.getLog(PNGGenarateServlet.class); HttpSession session = request.getSession(true); String pid = CharacterEncoder.getSafeText(request.getParameter("pid")); ServletConfig config = getServletConfig(); String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session); ConfigurationContext configContext = (ConfigurationContext) config.getServletContext() .getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE); String processDef; ProcessManagementServiceClient client; SVGInterface svg; String svgStr; try { client = new ProcessManagementServiceClient(cookie, backendServerURL, configContext, request.getLocale()); //Gets the bpel process definition needed to create the SVG from the processId processDef = client.getProcessInfo(QName.valueOf(pid)).getDefinitionInfo().getDefinition() .getExtraElement().toString(); BPELInterface bpel = new BPELImpl(); //Converts the bpel process definition to an omElement which is how the AXIS2 Object Model (AXIOM) // represents an XML document OMElement bpelStr = bpel.load(processDef); /** * Process the OmElement containing the bpel process definition * Process the subactivites of the bpel process by iterating through the omElement * */ bpel.processBpelString(bpelStr); //Create a new instance of the LayoutManager for the bpel process LayoutManager layoutManager = BPEL2SVGFactory.getInstance().getLayoutManager(); //Set the layout of the SVG to vertical layoutManager.setVerticalLayout(true); //Get the root activity i.e. the Process Activity layoutManager.layoutSVG(bpel.getRootActivity()); svg = new SVGImpl(); //Set the root activity of the SVG i.e. the Process Activity svg.setRootActivity(bpel.getRootActivity()); //Set the content type of the HTTP response as "image/png" response.setContentType("image/png"); //Create an instance of ServletOutputStream to write the output ServletOutputStream sos = response.getOutputStream(); //Convert the image as a byte array of a PNG byte[] pngBytes = svg.toPNGBytes(); // stream to write binary data into the response sos.write(pngBytes); sos.flush(); sos.close(); } catch (ProcessManagementException e) { log.error("PNG Generation Error", e); } }
From source file:org.wso2.carbon.bpel.ui.bpel2svg.SVGGenerateServlet.java
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. * Handles the HTTP process request which creates the SVG graph for a bpel process * * @param request servlet request/*from w ww.j av a 2s . c o m*/ * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Log log = LogFactory.getLog(SVGGenerateServlet.class); HttpSession session = request.getSession(true); //Get the bpel process id String pid = CharacterEncoder.getSafeText(request.getParameter("pid")); ServletConfig config = getServletConfig(); String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session); ConfigurationContext configContext = (ConfigurationContext) config.getServletContext() .getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE); String processDef = null; ProcessManagementServiceClient client = null; SVGInterface svg = null; String svgStr = null; ServletOutputStream sos = null; sos = response.getOutputStream(); try { client = new ProcessManagementServiceClient(cookie, backendServerURL, configContext, request.getLocale()); //Gets the bpel process definition needed to create the SVG from the processId processDef = client.getProcessInfo(QName.valueOf(pid)).getDefinitionInfo().getDefinition() .getExtraElement().toString(); BPELInterface bpel = new BPELImpl(); //Converts the bpel process definition to an omElement which is how the AXIS2 Object Model (AXIOM) // represents an XML document OMElement bpelStr = bpel.load(processDef); /** * Process the OmElement containing the bpel process definition * Process the subactivites of the bpel process by iterating through the omElement * */ bpel.processBpelString(bpelStr); //Create a new instance of the LayoutManager for the bpel process LayoutManager layoutManager = BPEL2SVGFactory.getInstance().getLayoutManager(); //Set the layout of the SVG to vertical layoutManager.setVerticalLayout(true); //Get the root activity i.e. the Process Activity layoutManager.layoutSVG(bpel.getRootActivity()); svg = new SVGImpl(); //Set the root activity of the SVG i.e. the Process Activity svg.setRootActivity(bpel.getRootActivity()); //Set the content type of the HTTP response as "image/svg+xml" response.setContentType("image/svg+xml"); //Get the SVG graph created for the process as a SVG string svgStr = svg.generateSVGString(); //Checks whether the SVG string generated contains a value if (svgStr != null) { // stream to write binary data into the response sos.write(svgStr.getBytes(Charset.defaultCharset())); sos.flush(); sos.close(); } } catch (ProcessManagementException e) { log.error("SVG Generation Error", e); String errorSVG = "<svg version=\"1.1\"\n" + " xmlns=\"http://www.w3.org/2000/svg\"><text y=\"50\">Could not display SVG</text></svg>"; sos.write(errorSVG.getBytes(Charset.defaultCharset())); sos.flush(); sos.close(); } }
From source file:org.wso2.carbon.connector.integration.test.delicious.DeliciousConnectoreIntegrationTest.java
/** * Positive test case for addNewPost method with mandatory parameters. *///from w w w . j a v a2 s . c o m @Test(priority = 1, groups = { "wso2.esb" }, description = "delicious {addNewPost} integration test with mandatory parameters") public void testDeliciousaddNewPostWithMandatoryParameters() throws Exception { String jsonRequestFilePath = pathToResourcesDirectory + "addNewPost.txt"; String rawString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath); rawString = rawString.replace("test_url", connectorProperties.getProperty("inputDescription")); rawString = rawString.replace("bookmarkurl", connectorProperties.getProperty("inputurl")); final String jsonString = addCredentials(rawString); ConnectorIntegrationUtil responseConnector = new ConnectorIntegrationUtil(); OMElement omElementC = responseConnector.getXmlResponse("POST", getProxyServiceURL("delicious"), jsonString); ConnectorIntegrationUtil responseDirect = new ConnectorIntegrationUtil(); OMElement omElementD = responseDirect.sendXMLRequestWithBasic( connectorProperties.getProperty("Apiurl") + "/v1/posts/recent?&count=1", "", validAuthorization); Assert.assertTrue(omElementD.getFirstElement().getAttributeValue(QName.valueOf("description")) .equals(connectorProperties.getProperty("inputDescription"))); }
From source file:org.wso2.carbon.connector.integration.test.delicious.DeliciousConnectoreIntegrationTest.java
/** * Positive test case for deletePost method with mandatory parameters. *///from w ww . j a v a 2 s .c om @Test(priority = 2, groups = { "wso2.esb" }, description = "delicious {deletePost} integration test with mandatory parameters") public void testDeliciousdeletePostWithMandatoryParameters() throws Exception { String jsonRequestFilePath = pathToResourcesDirectory + "deletePost.txt"; String rawString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath); rawString = rawString.replace("bookmarkurl", connectorProperties.getProperty("inputurl")); final String jsonString = addCredentials(rawString); ConnectorIntegrationUtil responseConnector = new ConnectorIntegrationUtil(); OMElement omElementC = responseConnector.getXmlResponse("POST", getProxyServiceURL("delicious"), jsonString); String parameters = "&url=" + connectorProperties.getProperty("inputurl"); ConnectorIntegrationUtil responseDirect = new ConnectorIntegrationUtil(); OMElement omElementD = responseDirect.sendXMLRequestWithBasic( connectorProperties.getProperty("Apiurl") + "/v1/posts/get?" + parameters, "", validAuthorization); Assert.assertTrue(omElementD.getAttributeValue(QName.valueOf("code")).equals("no bookmarks")); }
From source file:org.wso2.carbon.connector.integration.test.delicious.DeliciousConnectoreIntegrationTest.java
/** * Positive test case for setTagsBundles method with mandatory parameters. *//*from ww w.j av a2s . c o m*/ @Test(priority = 1, groups = { "wso2.esb" }, description = "delicious {setTagsBundles} integration test with mandatory parameters") public void testDelicioussetTagsBundlesWithMandatoryParameters() throws Exception { String jsonRequestFilePath = pathToResourcesDirectory + "setTagsBundles.txt"; String rawString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath); final String jsonString = addCredentials(rawString); ConnectorIntegrationUtil responseConnector = new ConnectorIntegrationUtil(); OMElement omElementC = responseConnector.getXmlResponse("POST", getProxyServiceURL("delicious"), jsonString); String parameters = "&bundle=" + connectorProperties.getProperty("bundle"); ConnectorIntegrationUtil responseDirect = new ConnectorIntegrationUtil(); OMElement omElementD = responseDirect.sendXMLRequestWithBasic( connectorProperties.getProperty("Apiurl") + "/v1/tags/bundles/all?" + parameters, "", validAuthorization); Assert.assertTrue(omElementD.getFirstElement().getAttributeValue(QName.valueOf("name")) .equals(connectorProperties.getProperty("bundle"))); }
From source file:org.wso2.carbon.connector.integration.test.delicious.DeliciousConnectoreIntegrationTest.java
/** * Positive test case for addNewPost method with Optional parameters. *//* ww w .ja v a2s . c o m*/ @Test(priority = 3, groups = { "wso2.esb" }, description = "delicious {addNewPost} integration test with Optional parameters") public void testDeliciousaddNewPostWithOptionalParameters() throws Exception { String jsonRequestFilePath = pathToResourcesDirectory + "optional/addNewPost.txt"; String rawString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath); rawString = rawString.replace("test_url", connectorProperties.getProperty("inputDescriptionWithOptional")); rawString = rawString.replace("bookmarkurl", connectorProperties.getProperty("inputurl")); final String jsonString = addCredentials(rawString); ConnectorIntegrationUtil responseConnector = new ConnectorIntegrationUtil(); OMElement omElementC = responseConnector.getXmlResponse("POST", getProxyServiceURL("delicious"), jsonString); ConnectorIntegrationUtil responseDirect = new ConnectorIntegrationUtil(); OMElement omElementD = responseDirect.sendXMLRequestWithBasic( connectorProperties.getProperty("Apiurl") + "/v1/posts/recent?&count=1", "", validAuthorization); Assert.assertTrue(omElementD.getFirstElement().getAttributeValue(QName.valueOf("description")) .equals(connectorProperties.getProperty("inputDescriptionWithOptional"))); }