Package org.sonatype.security.rest.model

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


  @Override
  @GET
  public PlexusComponentListResourceResponse get(Context context, Request request, Response response, Variant variant)
      throws ResourceException
  {
    PlexusComponentListResourceResponse result = new PlexusComponentListResourceResponse();

    if (userManagers != null) {
      for (BeanEntry<Named, UserManager> entry : userManagers) {
        String hint = entry.getKey().value();
        String description = entry.getDescription();

        PlexusComponentListResource resource = new PlexusComponentListResource();
        resource.setRoleHint(hint);
        resource.setDescription((StringUtils.isNotEmpty(description)) ? description : hint);

        // add it to the collection
        result.addData(resource);
      }
    }

    if (result.getData().isEmpty()) {
      throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND);
    }

    return result;
  }
View Full Code Here


  {
    PlexusResource resource = this.lookup(PlexusResource.class, "UserLocatorComponentListPlexusResource");
    Object result = resource.get(null, null, null, null);
    assertThat(result, instanceOf(PlexusComponentListResourceResponse.class));

    PlexusComponentListResourceResponse response = (PlexusComponentListResourceResponse) result;

    assertThat("Result: " + new XStream().toXML(response), response.getData().size(), equalTo(3));

    Map<String, String> data = new HashMap<String, String>();
    for (PlexusComponentListResource item : response.getData()) {
      data.put(item.getRoleHint(), item.getDescription());
    }

    assertThat(data.keySet(), containsInAnyOrder("default", "allConfigured", "MockUserManager"));
    assertThat(data.get("default"), equalTo("Default"));
View Full Code Here

TOP

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

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.