Search in sources :

Example 6 with WebServiceException

use of com.openmeap.protocol.WebServiceException in project OpenMEAP by OpenMEAP.

the class ApplicationManagementServlet method connectionOpenRequest.

/**
	 * Pulls parameters out of the request and passes them to the ApplicationManagementPortType bean pulled from the WebApplicationContext
	 * 
	 * @param req
	 * @return
	 */
public Result connectionOpenRequest(HttpServletRequest req) {
    WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
    ConnectionOpenRequest request = createConnectionOpenRequest(req);
    Result result = new Result();
    try {
        ConnectionOpenResponse response = ((ApplicationManagementService) context.getBean("applicationManagementService")).connectionOpen(request);
        result.setConnectionOpenResponse(response);
    } catch (WebServiceException wse) {
        Error err = new Error();
        err.setCode(wse.getType().asErrorCode());
        err.setMessage(wse.getMessage());
        result.setError(err);
    }
    return result;
}
Also used : WebServiceException(com.openmeap.protocol.WebServiceException) Error(com.openmeap.protocol.dto.Error) ConnectionOpenRequest(com.openmeap.protocol.dto.ConnectionOpenRequest) ConnectionOpenResponse(com.openmeap.protocol.dto.ConnectionOpenResponse) ApplicationManagementService(com.openmeap.protocol.ApplicationManagementService) WebApplicationContext(org.springframework.web.context.WebApplicationContext) Result(com.openmeap.protocol.dto.Result)

Example 7 with WebServiceException

use of com.openmeap.protocol.WebServiceException in project OpenMEAP by OpenMEAP.

the class ApplicationManagementPortTypeImplTest method testConnectionOpen_verifyNoUpdateIfOnlyInitialVersion.

/**
	 * Verify that no update is set,
	 * if there are no deployments
	 * and the initial version is reported
	 */
@Test
public void testConnectionOpen_verifyNoUpdateIfOnlyInitialVersion() throws Exception {
    com.openmeap.model.dto.Application app = modelManager.getModelService().findByPrimaryKey(Application.class, 1L);
    Iterator<Deployment> i = new ArrayList<Deployment>(app.getDeployments()).iterator();
    while (i.hasNext()) {
        Deployment d = i.next();
        modelManager.delete(d, null);
    }
    app = modelManager.getModelService().findByPrimaryKey(Application.class, 1L);
    Assert.assertTrue(app.getDeployments().size() == 0);
    Assert.assertTrue(app.getVersions().size() == 2);
    thrown = false;
    try {
        response = appMgmtSvc.connectionOpen(request);
    } catch (WebServiceException wse) {
        thrown = true;
    }
    Assert.assertTrue("If no deployments have been made, it should be ok, providing the initial version is reported by SLIC.", !thrown);
    app = modelManager.addModify(app, null);
}
Also used : WebServiceException(com.openmeap.protocol.WebServiceException) Deployment(com.openmeap.model.dto.Deployment) Application(com.openmeap.model.dto.Application) Application(com.openmeap.model.dto.Application) Test(org.junit.Test)

Aggregations

WebServiceException (com.openmeap.protocol.WebServiceException)7 Application (com.openmeap.model.dto.Application)3 ConnectionOpenResponse (com.openmeap.protocol.dto.ConnectionOpenResponse)3 Deployment (com.openmeap.model.dto.Deployment)2 ApplicationManagementService (com.openmeap.protocol.ApplicationManagementService)2 ConnectionOpenRequest (com.openmeap.protocol.dto.ConnectionOpenRequest)2 Result (com.openmeap.protocol.dto.Result)2 Hashtable (java.util.Hashtable)2 Test (org.junit.Test)2 HttpRequestException (com.openmeap.http.HttpRequestException)1 HttpResponse (com.openmeap.http.HttpResponse)1 JSONObjectBuilder (com.openmeap.json.JSONObjectBuilder)1 ModelManager (com.openmeap.model.ModelManager)1 Application (com.openmeap.protocol.dto.Application)1 ApplicationInstallation (com.openmeap.protocol.dto.ApplicationInstallation)1 Error (com.openmeap.protocol.dto.Error)1 SLIC (com.openmeap.protocol.dto.SLIC)1 UpdateHeader (com.openmeap.protocol.dto.UpdateHeader)1 JsUpdateHeader (com.openmeap.protocol.json.JsUpdateHeader)1 LocalStorageException (com.openmeap.thinclient.LocalStorageException)1