Package org.springframework.integration.samples.rest.domain

Examples of org.springframework.integration.samples.rest.domain.EmployeeList


   * @return an instance of <code>{@link Message}</code> that wraps <code>{@link EmployeeList}</code>
   */
  @Secured("ROLE_REST_HTTP_USER")
  public Message<EmployeeList> getEmployee(Message<?> inMessage){
 
    EmployeeList employeeList = new EmployeeList();
    Map<String, Object> responseHeaderMap = new HashMap<String, Object>();
   
    try{
      MessageHeaders headers = inMessage.getHeaders();
      String id = (String)headers.get("employeeId");
      boolean isFound;
      if (id.equals("1")){
        employeeList.getEmployee().add(new Employee(1, "John", "Doe"));
        isFound = true;
      }else if (id.equals("2")){
        employeeList.getEmployee().add(new Employee(2, "Jane", "Doe"));
        isFound = true;
      }else if (id.equals("0")){
        employeeList.getEmployee().add(new Employee(1, "John", "Doe"));
        employeeList.getEmployee().add(new Employee(2, "Jane", "Doe"));       
        isFound = true;
      }else{       
        isFound = false;
      }     
      if (isFound){
View Full Code Here


    Map<String, Object> employeeSearchMap = getEmployeeSearchMap("0");

    final String fullUrl = "http://localhost:8080/rest-http/services/employee/{id}/search";

    EmployeeList employeeList = restTemplate.execute(fullUrl, HttpMethod.GET,
        new RequestCallback() {
          @Override
          public void doWithRequest(ClientHttpRequest request) throws IOException {
            HttpHeaders headers = getHttpHeadersWithUserCredentials(request);
            headers.add("Accept", "application/xml");
          }
    }, responseExtractor, employeeSearchMap);

    logger.info("The employee list size :"+employeeList.getEmployee().size());

    StringWriter sw = new StringWriter();
    StreamResult sr = new StreamResult(sw);

    marshaller.marshal(employeeList, sr);
    logger.info(sr.getWriter().toString());
    assertTrue(employeeList.getEmployee().size() > 0);
  }
View Full Code Here

TOP

Related Classes of org.springframework.integration.samples.rest.domain.EmployeeList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.