List of usage examples for org.springframework.util StopWatch prettyPrint
public String prettyPrint()
From source file:org.kuali.ole.docstore.engine.service.rest.DocstoreRestClient_UT.java
@Test public void testUpdateAndSearchBib() { StopWatch stopWatch = new StopWatch(); stopWatch.start("Create bib"); Bib bib = createBibRecord();/*from www.j av a2s . c o m*/ stopWatch.stop(); String bibId = bib.getId(); stopWatch.start("Search before create bib"); searchBibWithTitleNId(bibId, "Thankfulness to Almighty God"); stopWatch.stop(); stopWatch.start("Update bib"); updateTitle(bibId); stopWatch.stop(); stopWatch.start("Search after update bib"); searchBibWithTitleNId(bibId, "wings of fire"); stopWatch.stop(); System.out.println(stopWatch.prettyPrint()); }
From source file:org.springframework.ws.soap.PerformanceTest.java
public static void main(String[] args) throws Exception { StopWatch stopWatch = new StopWatch(); try {/*from w w w . j ava 2 s.c o m*/ saaj(stopWatch); axiom(stopWatch, false, false); axiom(stopWatch, true, false); axiom(stopWatch, false, true); axiom(stopWatch, true, true); stroap(stopWatch, false, false); stroap(stopWatch, true, false); stroap(stopWatch, false, true); stroap(stopWatch, true, true); } finally { System.out.println(stopWatch.prettyPrint()); } }
From source file:org.springframework.xd.dirt.integration.bus.MessageBusSupportBenchmarkTests.java
@Test public void run() { StopWatch watch = new StopWatch("MessageBusSupport"); watch.start("simple tuple codec"); runBenchmark(TupleBuilder.tuple().of("foo", "bar", "val", 1234)); watch.stop();/*ww w .j a va 2 s .c om*/ watch.start("string payload"); runBenchmark(StringUtils.leftPad("hello", 1000, "*")); watch.stop(); System.out.println(watch.prettyPrint()); }
From source file:ro.cs.cm.ws.client.om.OMWebServiceClient.java
public GetUserAuthBySecurityTokenResponse getUserAuthBySecurityToken(String securityToken) throws XmlMappingException, IOException, WSClientException { logger.debug("getUserAuthBySecurityToken START"); StopWatch sw = new StopWatch(); sw.start("getUserAuthBySecurityToken"); GetUserAuthBySecurityTokenResponse getUserAuthBySecurityTokenResponse = null; try {// w w w. j a va 2 s . com GetUserAuthBySecurityTokenRequest getUserBySecurityTokenRequest = new GetUserAuthBySecurityTokenRequest(); getUserBySecurityTokenRequest.setSecurityToken(securityToken); getUserBySecurityTokenRequest.setModule(IConstant.MODULE_ID); //unmarshall the response to an OrganisationSimple bean getUserAuthBySecurityTokenResponse = (GetUserAuthBySecurityTokenResponse) getWebServiceTemplate() .marshalSendAndReceive(getUserBySecurityTokenRequest); logger.debug(getUserAuthBySecurityTokenResponse.getUserAuth()); } catch (SoapFaultClientException soapFault) { SoapFaultDetail soapFaultDetail = soapFault.getSoapFault().getFaultDetail(); //if the soap fault detail field is empty, it means another type of exception than EndpointException has been thrown if (soapFaultDetail == null) { throw new WSClientException(soapFault.getFaultCode().toString(), soapFault.getFaultStringOrReason(), soapFault); //soap fault detail field not empty means the Web Service has thrown an EndpointException } else { SoapFaultDetailElement soapFaultDetailElement = (SoapFaultDetailElement) soapFaultDetail .getDetailEntries().next(); //unmarshall the soap fault detail element to a WS specific bean named dmeEndpointExceptionBean JAXBElement<OMEndpointExceptionBean> endpointException = (JAXBElement<OMEndpointExceptionBean>) getWebServiceTemplate() .getUnmarshaller().unmarshal(soapFaultDetailElement.getSource()); //throw a new WSClientException with the code and message of the DMEEndpointExceptionBean retrieved previously throw new WSClientException(endpointException.getValue().getCode(), endpointException.getValue().getMessage(), soapFault); } } logger.debug("getUserAuthBySecurityToken END"); sw.stop(); logger.debug(sw.prettyPrint()); return getUserAuthBySecurityTokenResponse; }
From source file:ro.cs.cm.ws.client.om.OMWebServiceClient.java
public List<UserSimple> getUsersSimpleByOrganizationId(int organizationId, boolean isNotDeleted) throws XmlMappingException, IOException, WSClientException { logger.debug("getUsersSimpleByOrganizationId START"); StopWatch sw = new StopWatch(); sw.start("getUsersSimpleByOrganizationId"); List<UserSimple> users = null; try {//from w ww. j a va 2 s . c o m //create the bean marshalled into the request GetUsersSimpleRequest getUsersSimpleRequest = new GetUsersSimpleRequest(); getUsersSimpleRequest.setOrganizationId(organizationId); getUsersSimpleRequest.setNotDeleted(isNotDeleted); //unmarshall the response to an OrganisationSimple bean users = ((GetUsersSimpleResponse) getWebServiceTemplate().marshalSendAndReceive(getUsersSimpleRequest)) .getUsers(); } catch (SoapFaultClientException soapFault) { SoapFaultDetail soapFaultDetail = soapFault.getSoapFault().getFaultDetail(); //if the soap fault detail field is empty, it means another type of exception than EndpointException has been thrown if (soapFaultDetail == null) { throw new WSClientException(soapFault.getFaultCode().toString(), soapFault.getFaultStringOrReason(), soapFault); //soap fault detail field not empty means the Web Service has thrown an EndpointException } else { SoapFaultDetailElement soapFaultDetailElement = (SoapFaultDetailElement) soapFaultDetail .getDetailEntries().next(); //unmarshall the soap fault detail element to a WS specific bean named dmeEndpointExceptionBean JAXBElement<OMEndpointExceptionBean> endpointException = (JAXBElement<OMEndpointExceptionBean>) getWebServiceTemplate() .getUnmarshaller().unmarshal(soapFaultDetailElement.getSource()); //throw a new WSClientException with the code and message of the DMEEndpointExceptionBean retrieved previously throw new WSClientException(endpointException.getValue().getCode(), endpointException.getValue().getMessage(), soapFault); } } logger.debug("getUsersSimpleByOrganizationId END"); sw.stop(); logger.debug(sw.prettyPrint()); return users; }
From source file:ro.cs.cm.ws.client.om.OMWebServiceClient.java
/** * Get a person by it's id/* w w w . j a v a 2 s .c o m*/ * * @author Adelina * * @param personId * @return * @throws XmlMappingException * @throws IOException * @throws WSClientException */ public GetPersonSimpleResponse getPersonSimple(Integer personId) throws XmlMappingException, IOException, WSClientException { logger.debug("getPersonSimple - START"); logger.debug("personId = " + personId); StopWatch sw = new StopWatch(); sw.start("getPersonSimple"); GetPersonSimpleResponse getPersonSimpleResoponse = new GetPersonSimpleResponse(); try { // create the bean marshalled into the request GetPersonSimpleRequest getPersonSimpleRequest = new GetPersonSimpleRequest(); getPersonSimpleRequest.setPersonId(personId); logger.debug("before unmarshal"); //unmarshall the response getPersonSimpleResoponse = (GetPersonSimpleResponse) getWebServiceTemplate() .marshalSendAndReceive(getPersonSimpleRequest); logger.debug( "-------------------------------------------------------------------------------------------------"); WSUser person = getPersonSimpleResoponse.getPerson(); logger.debug("person = " + person); logger.debug( "-------------------------------------------------------------------------------------------------"); } catch (SoapFaultClientException soapFault) { SoapFaultDetail soapFaultDetail = soapFault.getSoapFault().getFaultDetail(); //if the soap fault detail field is empty, it means another type of exception than EndpointException has been thrown if (soapFaultDetail == null) { throw new WSClientException(soapFault.getFaultCode().toString(), soapFault.getFaultStringOrReason(), soapFault); //soap fault detail field not empty means the Web Service has thrown an EndpointException } else { SoapFaultDetailElement soapFaultDetailElement = (SoapFaultDetailElement) soapFaultDetail .getDetailEntries().next(); //unmarshall the soap fault detail element to a WS specific bean named dmeEndpointExceptionBean JAXBElement<OMEndpointExceptionBean> endpointException = (JAXBElement<OMEndpointExceptionBean>) getWebServiceTemplate() .getUnmarshaller().unmarshal(soapFaultDetailElement.getSource()); //throw a new WSClientException with the code and message of the DMEEndpointExceptionBean retrieved previously throw new WSClientException(endpointException.getValue().getCode(), endpointException.getValue().getMessage(), soapFault); } } logger.debug("getPersonSimple - END"); sw.stop(); logger.debug(sw.prettyPrint()); return getPersonSimpleResoponse; }
From source file:ro.cs.cm.ws.client.ts.TSWebServiceClient.java
/** * Deletes the project details//w w w .j av a2 s.c o m * * @author Adelina * * @param projectId * @throws XmlMappingException * @throws IOException * @throws WSClientException * @throws BusinessException */ public void deleteProjectDetails(Integer projectId) throws XmlMappingException, IOException, WSClientException, BusinessException { logger.debug("deleteProjectDetails START"); StopWatch sw = new StopWatch(); sw.start("deleteProjectDetails"); try { //create the bean marshalled into the request GetProjectIdForDeleteRequest getProjectIdForDeleteRequest = new GetProjectIdForDeleteRequest(); getProjectIdForDeleteRequest.setProjectId(projectId); //unmarshall the response Project project = BLProject.getInstance().getWithStatus(projectId); if (project == null) { getWebServiceTemplate().marshalSendAndReceive(getProjectIdForDeleteRequest); } } catch (SoapFaultClientException soapFault) { SoapFaultDetail soapFaultDetail = soapFault.getSoapFault().getFaultDetail(); //if the soap fault detail field is empty, it means another type of exception than EndpointException has been thrown if (soapFaultDetail == null) { throw new WSClientException(soapFault.getFaultCode().toString(), soapFault.getFaultStringOrReason(), soapFault); //soap fault detail field not empty means the Web Service has thrown an EndpointException } else { SoapFaultDetailElement soapFaultDetailElement = (SoapFaultDetailElement) soapFaultDetail .getDetailEntries().next(); //unmarshall the soap fault detail element to a WS specific bean named dmeEndpointExceptionBean JAXBElement<TSEndpointExceptionBean> endpointException = (JAXBElement<TSEndpointExceptionBean>) getWebServiceTemplate() .getUnmarshaller().unmarshal(soapFaultDetailElement.getSource()); //throw a new WSClientException with the code and message of the DMEEndpointExceptionBean retrieved previously throw new WSClientException(endpointException.getValue().getCode(), endpointException.getValue().getMessage(), soapFault); } } logger.debug("deleteProjectDetails END"); sw.stop(); logger.debug(sw.prettyPrint()); }
From source file:ro.cs.cm.ws.client.ts.TSWebServiceClient.java
/** * Finish the project details//from w w w .j a v a 2s.c o m * * @author Adelina * * @param projectId * @throws XmlMappingException * @throws IOException * @throws WSClientException * @throws BusinessException */ public void finishProjectDetails(Integer projectId) throws XmlMappingException, IOException, WSClientException, BusinessException { logger.debug("finishProjectDetails START"); StopWatch sw = new StopWatch(); sw.start("finishProjectDetails"); try { //create the bean marshalled into the request GetProjectIdForFinishRequest getProjectIdForFinishRequest = new GetProjectIdForFinishRequest(); getProjectIdForFinishRequest.setProjectId(projectId); // unmarshall the response Project project = BLProject.getInstance().getWithStatus(projectId); if (project != null) { if (project.getStatus() == IConstant.NOM_PROJECT_STATUS_CLOSED) { getWebServiceTemplate().marshalSendAndReceive(getProjectIdForFinishRequest); } } } catch (SoapFaultClientException soapFault) { SoapFaultDetail soapFaultDetail = soapFault.getSoapFault().getFaultDetail(); //if the soap fault detail field is empty, it means another type of exception than EndpointException has been thrown if (soapFaultDetail == null) { throw new WSClientException(soapFault.getFaultCode().toString(), soapFault.getFaultStringOrReason(), soapFault); //soap fault detail field not empty means the Web Service has thrown an EndpointException } else { SoapFaultDetailElement soapFaultDetailElement = (SoapFaultDetailElement) soapFaultDetail .getDetailEntries().next(); //unmarshall the soap fault detail element to a WS specific bean named dmeEndpointExceptionBean JAXBElement<TSEndpointExceptionBean> endpointException = (JAXBElement<TSEndpointExceptionBean>) getWebServiceTemplate() .getUnmarshaller().unmarshal(soapFaultDetailElement.getSource()); //throw a new WSClientException with the code and message of the DMEEndpointExceptionBean retrieved previously throw new WSClientException(endpointException.getValue().getCode(), endpointException.getValue().getMessage(), soapFault); } } logger.debug("finishProjectDetails END"); sw.stop(); logger.debug(sw.prettyPrint()); }
From source file:ro.cs.cm.ws.client.ts.TSWebServiceClient.java
/** * Abort the project details//w w w . j a v a 2 s . c om * * @author Adelina * * @param projectId * @throws XmlMappingException * @throws IOException * @throws WSClientException * @throws BusinessException */ public void abortProjectDetails(Integer projectId) throws XmlMappingException, IOException, WSClientException, BusinessException { logger.debug("abortProjectDetails START"); StopWatch sw = new StopWatch(); sw.start("abortProjectDetails"); try { //create the bean marshalled into the request GetProjectIdForAbortRequest getProjectIdForAbortRequest = new GetProjectIdForAbortRequest(); getProjectIdForAbortRequest.setProjectId(projectId); // unmarshall the response Project project = BLProject.getInstance().getWithStatus(projectId); logger.debug("project status xxxxxxxxx = " + project.getStatus()); if (project != null) { if (project.getStatus() == IConstant.NOM_PROJECT_STATUS_ABORTED) { logger.debug("yyyyyyyyyyyyyyyyy"); getWebServiceTemplate().marshalSendAndReceive(getProjectIdForAbortRequest); } } } catch (SoapFaultClientException soapFault) { SoapFaultDetail soapFaultDetail = soapFault.getSoapFault().getFaultDetail(); //if the soap fault detail field is empty, it means another type of exception than EndpointException has been thrown if (soapFaultDetail == null) { throw new WSClientException(soapFault.getFaultCode().toString(), soapFault.getFaultStringOrReason(), soapFault); //soap fault detail field not empty means the Web Service has thrown an EndpointException } else { SoapFaultDetailElement soapFaultDetailElement = (SoapFaultDetailElement) soapFaultDetail .getDetailEntries().next(); //unmarshall the soap fault detail element to a WS specific bean named dmeEndpointExceptionBean JAXBElement<TSEndpointExceptionBean> endpointException = (JAXBElement<TSEndpointExceptionBean>) getWebServiceTemplate() .getUnmarshaller().unmarshal(soapFaultDetailElement.getSource()); //throw a new WSClientException with the code and message of the DMEEndpointExceptionBean retrieved previously throw new WSClientException(endpointException.getValue().getCode(), endpointException.getValue().getMessage(), soapFault); } } logger.debug("abortProjectDetails END"); sw.stop(); logger.debug(sw.prettyPrint()); }
From source file:ro.cs.cm.ws.client.ts.TSWebServiceClient.java
/** * Open the project details/*from ww w .j av a2 s.c om*/ * * @author Adelina * * @param projectId * @throws XmlMappingException * @throws IOException * @throws WSClientException * @throws BusinessException */ public void openProjectDetails(Integer projectId) throws XmlMappingException, IOException, WSClientException, BusinessException { logger.debug("openProjectDetails START"); StopWatch sw = new StopWatch(); sw.start("openProjectDetails"); try { //create the bean marshalled into the request GetProjectIdForOpenRequest getProjectIdForOpenRequest = new GetProjectIdForOpenRequest(); getProjectIdForOpenRequest.setProjectId(projectId); // unmarshall the response Project project = BLProject.getInstance().getWithStatus(projectId); if (project != null) { if (project.getStatus() == IConstant.NOM_PROJECT_STATUS_OPENED) { getWebServiceTemplate().marshalSendAndReceive(getProjectIdForOpenRequest); } } } catch (SoapFaultClientException soapFault) { SoapFaultDetail soapFaultDetail = soapFault.getSoapFault().getFaultDetail(); //if the soap fault detail field is empty, it means another type of exception than EndpointException has been thrown if (soapFaultDetail == null) { throw new WSClientException(soapFault.getFaultCode().toString(), soapFault.getFaultStringOrReason(), soapFault); //soap fault detail field not empty means the Web Service has thrown an EndpointException } else { SoapFaultDetailElement soapFaultDetailElement = (SoapFaultDetailElement) soapFaultDetail .getDetailEntries().next(); //unmarshall the soap fault detail element to a WS specific bean named dmeEndpointExceptionBean JAXBElement<TSEndpointExceptionBean> endpointException = (JAXBElement<TSEndpointExceptionBean>) getWebServiceTemplate() .getUnmarshaller().unmarshal(soapFaultDetailElement.getSource()); //throw a new WSClientException with the code and message of the DMEEndpointExceptionBean retrieved previously throw new WSClientException(endpointException.getValue().getCode(), endpointException.getValue().getMessage(), soapFault); } } logger.debug("openProjectDetails END"); sw.stop(); logger.debug(sw.prettyPrint()); }