Package org.sonatype.security.rest.model

Examples of org.sonatype.security.rest.model.UserResourceRequest


    // test user creation with NO status

    // add a user
    PlexusResource resource = this.lookup(PlexusResource.class, "UserListPlexusResource");

    UserResourceRequest resourceRequest = new UserResourceRequest();
    UserResource userResource = new UserResource();
    resourceRequest.setData(userResource);
    userResource.setEmail("testUpdateUserValidation@test.com");
    userResource.setLastName("testUpdateUserValidation");
    userResource.setStatus("active");
    userResource.setUserId("testUpdateUserValidation");
    userResource.addRole("admin");
View Full Code Here


    // test user creation with NO status

    // add a user
    PlexusResource resource = this.lookup(PlexusResource.class, "UserListPlexusResource");

    UserResourceRequest resourceRequest = new UserResourceRequest();
    UserResource userResource = new UserResource();
    resourceRequest.setData(userResource);
    userResource.setEmail("testInvalidEmailUpdateUserValidation@test.com");
    userResource.setLastName("testInvalidEmailUpdateUserValidation");
    userResource.setStatus("active");
    userResource.setUserId("testInvalidEmailUpdateUserValidation");
    userResource.addRole("admin");
View Full Code Here


  @Test
  public void checkValidationErrorsFilter() {
    final UserResource user = new UserResource();
    final UserResourceRequest userRequest = new UserResourceRequest();
    userRequest.setData(user);

    thrown.expect(NexusClientErrorResponseException.class);
    thrown.expectMessage("Users status is not valid");
    client().getSubsystem(UserClient.class).create(userRequest);
  }
View Full Code Here

    return usersClient.get(id()).getData();
  }

  @Override
  protected UserResource doCreate() {
    final UserResourceRequest request = new UserResourceRequest();
    request.setData(settings());
    final UserResource resource = usersClient.post(request).getData();
    resource.setPassword(null);
    return resource;
  }
View Full Code Here

    return resource;
  }

  @Override
  protected UserResource doUpdate() {
    final UserResourceRequest request = new UserResourceRequest();
    request.setData(settings());
    return usersClient.put(id(), request).getData();
  }
View Full Code Here

  }

  @Test
  public void testUserResourceRequest() {
    UserResourceRequest resourceRequest = new UserResourceRequest();

    UserResource user1 = new UserResource();
    user1.setResourceURI("ResourceURI1");
    user1.setEmail("Email1");
    user1.setUserId("UserId1");
    user1.setFirstName("Name1");
    user1.setStatus("Status1");
    user1.addRole("role1");
    user1.addRole("role2");
    resourceRequest.setData(user1);

    this.marshalUnmarchalThenCompare(resourceRequest);
    this.validateXmlHasNoPackageNames(resourceRequest);
  }
View Full Code Here

        "{\"data\":{\"userId\":\"myuser\",\"firstName\":\"johnny test\",\"email\":\"test@email.com\",\"status\":\"active\","
            + "\"roles\":[\"roleId\"]}}}";
    XStreamRepresentation representation =
        new XStreamRepresentation(xstream, jsonString, MediaType.APPLICATION_JSON);

    UserResourceRequest request = (UserResourceRequest) representation.getPayload(new UserResourceRequest());

    assert request.getData().getUserId().equals("myuser");
    assert request.getData().getFirstName().equals("johnny test");
    assert request.getData().getEmail().equals("test@email.com");
    assert request.getData().getStatus().equals("active");
    assert request.getData().getRoles().size() == 1;
    assert request.getData().getRoles().get(0).equals("roleId");
  }
View Full Code Here

        ensureAuthenticated();

        URI uri = baseUri().path("users").build();

        UserResourceRequest request = new UserResourceRequest();
        request.setData(user);

        String content = client.post(uri, marshal(UserResourceRequest.class, request));
        return unmarshal(UserResourceResponse.class, content).getData();
    }
View Full Code Here

        String userId = user.getUserId();
        assert userId != null;

        URI uri = baseUri().path("users").path(userId).build();

        UserResourceRequest request = new UserResourceRequest();
        request.setData(user);

        String content = client.put(uri, marshal(UserResourceRequest.class, request));
        return unmarshal(UserResourceResponse.class, content).getData();
    }
View Full Code Here

TOP

Related Classes of org.sonatype.security.rest.model.UserResourceRequest

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.