Ejemplo n.º 1
0
 /** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */
 protected void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   MyHttpServletRequest myRequest = new MyHttpServletRequest(request);
   ServiceResponse sr = new ServiceResponse();
   sr.initServiceResponse(myRequest, "AddAttendee");
   Integer sessionId = Integer.valueOf(myRequest.getParameter(REQUEST_PARAMETERS.SESSION_ID));
   String email = myRequest.getParameter(REQUEST_PARAMETERS.EMAIL);
   EasyShareServices easyshare = ServicesMapper.getEasyShareServicesProxyInstance();
   Boolean isAssigned = null;
   try {
     isAssigned = easyshare.addAttendee(sessionId, email);
     sr.setCode("SUCCESS");
     sr.setMessage("SUCCESS");
     sr.setData(isAssigned);
   } catch (SessionNotFoundException e) {
     sr.setCode("FAILURE");
     sr.setMessage(e.getMessage());
   } catch (PresentAsOtherUserTypeException e) {
     sr.setCode("FAILURE");
     sr.setMessage(e.getMessage());
   } catch (UserNotFoundException e) {
     sr.setCode("FAILURE");
     sr.setMessage(e.getMessage());
   } catch (PresentAsSameUserTypeException e) {
     sr.setCode("FAILURE");
     sr.setMessage(e.getMessage());
   }
   RenderResponse r = new RenderResponse();
   r.render(response, sr);
 }
Ejemplo n.º 2
0
  /** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    MyHttpServletRequest myRequest = new MyHttpServletRequest(request);
    ServiceResponse sr = new ServiceResponse();
    sr.initServiceResponse(myRequest, "GetResources");
    EasyShareServices easyshare = ServicesMapper.getEasyShareServicesProxyInstance();
    Integer sessionId = Integer.valueOf(myRequest.getParameter(REQUEST_PARAMETERS.SESSION_ID));
    Set<Resource> resources = null;
    try {
      resources = easyshare.getResources(sessionId);
      sr.setCode("SUCCESS");
      sr.setMessage("SUCCESS");
      sr.setData(resources);
    } catch (SessionNotFoundException e) {
      sr.setCode("FAILURE");
      sr.setMessage(e.getMessage());
    }

    RenderResponse r = new RenderResponse();
    r.render(response, sr);
  }
Ejemplo n.º 3
0
 public void testCreateDuplicateSession() {
   String sessionName = "Spring5.6";
   String description = "features";
   Integer sessionId = null;
   try {
     if (sp.isServReqValid(sd, "anupama.charles", null)) {
       sessionId = easy.createSession(sessionName, description);
       fail("should raise a DuplicateSessionException ");
     } else {
       throw new InvalidServiceInvocationException();
     }
   } catch (DuplicateSessionException e) {
     assertTrue("success", true);
   } catch (InvalidServiceInvocationException e) {
     fail("Invalid service invocation");
   } catch (UserTypeNotValidException e) {
     fail("UserTypeNotValidException : Should not occur");
   } catch (SessionNotFoundException e) {
     fail("SessionNotFoundException : Should not occur");
   }
 }