Examples of CloudsealUser


Examples of com.cloudseal.rest.jaxb.CloudsealUser

   */
  @Override
  public CloudsealUser getUser(String username) {
    StringBuilder builder = new StringBuilder("/rest/user/");
    builder.append(username);
    CloudsealUser user = restClient.get(builder.toString());
    return user;
  }
View Full Code Here

Examples of com.cloudseal.rest.jaxb.CloudsealUser

   * .CloudsealUser)
   */
  @Override
  public CloudsealUser addUser(CloudsealUser user) {
    try {
      CloudsealUser newUser = restClient.post("/rest/user", user);
      return newUser;
    } catch (RestException ex) {
      if (ex.getCause() != null && ex.getCause().getMessage().contains("DUPLICATE_USER")) {
        throw new DuplicateUserException(ex.getCause().getMessage());
      }
View Full Code Here

Examples of com.cloudseal.rest.jaxb.CloudsealUser

  @Override
  public CloudsealUser updateUser(CloudsealUser user) {
    try {
      StringBuilder builder = new StringBuilder("/rest/user/");
      builder.append(user.getUsername());
      CloudsealUser updatedUser = restClient.put(builder.toString(), user);
      return updatedUser;
    } catch (RestException ex) {
      if (ex.getCause() != null && ex.getCause().getMessage().contains("USER_NOT_FOUND")) {
        throw new UserNotFoundException(ex.getCause().getMessage());
      }
View Full Code Here

Examples of com.cloudseal.rest.jaxb.CloudsealUser

    when(response.getEntity()).thenReturn(responseBody);
    when(response.getStatusLine()).thenReturn(statusLine);
    when(response.getAllHeaders()).thenReturn(buildHeaders());
    when(httpClient.execute(any(HttpUriRequest.class))).thenReturn(response);
   
    CloudsealUser user = classUnderTest.get("/rest/user/test");
    assertEquals("test", user.getUsername());
    assertEquals("test", user.getFirstName());
    assertEquals("user", user.getLastName());
    assertEquals("password", user.getPassword());
  }
View Full Code Here

Examples of com.cloudseal.rest.jaxb.CloudsealUser

    when(response.getEntity()).thenReturn(responseBody);
    when(response.getStatusLine()).thenReturn(statusLine);
    when(response.getAllHeaders()).thenReturn(buildHeaders());
    when(httpClient.execute(any(HttpUriRequest.class))).thenReturn(response);
   
    CloudsealUser user = classUnderTest.get("/rest/user/test");
    assertNull(user);
  }
View Full Code Here

Examples of com.cloudseal.rest.jaxb.CloudsealUser

    when(response.getEntity()).thenReturn(responseBody);
    when(response.getStatusLine()).thenReturn(statusLine);
    when(response.getAllHeaders()).thenReturn(buildHeaders());
    when(httpClient.execute(any(HttpUriRequest.class))).thenReturn(response);
   
    CloudsealUser newUser = new CloudsealUser();
    newUser.setUsername("test");
    newUser.setFirstName("test");
    newUser.setLastName("user");
    newUser.setEmail("test@test.com");
   
    CloudsealUser user = classUnderTest.post("/rest/users", newUser);
    assertEquals("test", user.getUsername());
    assertEquals("test", user.getFirstName());
    assertEquals("user", user.getLastName());
    assertEquals("password", user.getPassword());
  }
View Full Code Here

Examples of com.cloudseal.rest.jaxb.CloudsealUser

    when(response.getEntity()).thenReturn(responseBody);
    when(response.getStatusLine()).thenReturn(statusLine);
    when(response.getAllHeaders()).thenReturn(buildHeaders());
    when(httpClient.execute(any(HttpUriRequest.class))).thenReturn(response);
   
    CloudsealUser newUser = new CloudsealUser();
    newUser.setUsername("test");
    newUser.setFirstName("test");
    newUser.setLastName("user");
    newUser.setEmail("test@test.com");
   
    CloudsealUser user = classUnderTest.put("/rest/user/test", newUser);
    assertEquals("test", user.getUsername());
    assertEquals("test", user.getFirstName());
    assertEquals("user", user.getLastName());
    assertEquals("password", user.getPassword());
  }
View Full Code Here

Examples of com.cloudseal.rest.jaxb.CloudsealUser

    HttpResponse response = mock(HttpResponse.class);
    when(response.getStatusLine()).thenReturn(statusLine);
    when(response.getAllHeaders()).thenReturn(buildHeaders());
    when(httpClient.execute(any(HttpUriRequest.class))).thenReturn(response);
   
    CloudsealUser newUser = new CloudsealUser();
    newUser.setUsername("test");
    newUser.setFirstName("test");
    newUser.setLastName("user");
    newUser.setEmail("test@test.com");
   
    try {
      classUnderTest.put("/rest/user/test", newUser);
      fail("Expected exception");
    } catch (RestException ex) {
View Full Code Here

Examples of com.cloudseal.rest.jaxb.CloudsealUser

    when(response.getEntity()).thenReturn(responseBody);
    when(response.getStatusLine()).thenReturn(statusLine);
    when(response.getAllHeaders()).thenReturn(buildHeaders());
    when(httpClient.execute(any(HttpUriRequest.class))).thenReturn(response);
   
    CloudsealUser user = classUnderTest.delete("/rest/user/test");
    assertEquals("test", user.getUsername());
    assertEquals("test", user.getFirstName());
    assertEquals("user", user.getLastName());
    assertEquals("password", user.getPassword());
  }
View Full Code Here

Examples of com.cloudseal.rest.jaxb.CloudsealUser

    when(response.getEntity()).thenReturn(responseBody);
    when(response.getStatusLine()).thenReturn(statusLine);
    when(response.getAllHeaders()).thenReturn(buildHeaders());
    when(httpClient.execute(any(HttpUriRequest.class))).thenReturn(response);
   
    CloudsealUser user = classUnderTest.getUser("test");
    assertEquals("test", user.getUsername());
    assertEquals("test", user.getFirstName());
    assertEquals("user", user.getLastName());
    assertEquals("password", user.getPassword());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.