Examples of PlexusComponentListResource


Examples of org.sonatype.nexus.rest.model.PlexusComponentListResource

    // now for a more controled test
    result = runGetForRole("MULTI_TEST");
    Assert.assertEquals(2, result.getData().size());

    // the order is undefined
    PlexusComponentListResource resource1 = null;
    PlexusComponentListResource resource2 = null;

    for (PlexusComponentListResource resource : (List<PlexusComponentListResource>) result.getData()) {
      if (resource.getRoleHint().endsWith("1")) {
        resource1 = resource;
      }
      else {
        resource2 = resource;
      }
    }

    // make sure we found both
    Assert.assertNotNull(resource1);
    Assert.assertNotNull(resource2);

    Assert.assertEquals("Description-1", resource1.getDescription());
    Assert.assertEquals("hint-1", resource1.getRoleHint());

    Assert.assertEquals("Description-2", resource2.getDescription());
    Assert.assertEquals("hint-2", resource2.getRoleHint());

  }
View Full Code Here

Examples of org.sonatype.nexus.rest.model.PlexusComponentListResource

  {
    PlexusComponentListResourceResponse result = runGetForRole("TEST_ROLE");

    Assert.assertTrue(result.getData().size() == 1);

    PlexusComponentListResource resource = (PlexusComponentListResource) result.getData().get(0);

    Assert.assertEquals("Test Description.", resource.getDescription());
    Assert.assertEquals("test-hint", resource.getRoleHint());
  }
View Full Code Here

Examples of org.sonatype.nexus.rest.model.PlexusComponentListResource

  {
    PlexusComponentListResourceResponse result = runGetForRole("TEST_NULL");

    Assert.assertTrue(result.getData().size() == 1);

    PlexusComponentListResource resource = (PlexusComponentListResource) result.getData().get(0);

    Assert.assertEquals("default", resource.getDescription());
    Assert.assertEquals("default", resource.getRoleHint());
  }
View Full Code Here

Examples of org.sonatype.nexus.rest.model.PlexusComponentListResource

  {
    PlexusComponentListResourceResponse result = runGetForRole("TEST_EMPTY");

    Assert.assertTrue(result.getData().size() == 1);

    PlexusComponentListResource resource = (PlexusComponentListResource) result.getData().get(0);

    Assert.assertEquals("default", resource.getDescription());
    Assert.assertEquals("default", resource.getRoleHint());
  }
View Full Code Here

Examples of org.sonatype.nexus.rest.model.PlexusComponentListResource

  @Test
  public void testPlexusComponentListResourceResponse() {
    PlexusComponentListResourceResponse resourceResponse = new PlexusComponentListResourceResponse();

    PlexusComponentListResource resource1 = new PlexusComponentListResource();
    resource1.setDescription("description1");
    resource1.setRoleHint("role-hint1");
    resourceResponse.addData(resource1);

    PlexusComponentListResource resource2 = new PlexusComponentListResource();
    resource2.setDescription("description2");
    resource2.setRoleHint("role-hint2");
    resourceResponse.addData(resource2);

    this.marshalUnmarchalThenCompare(resourceResponse);
    this.validateXmlHasNoPackageNames(resourceResponse);
View Full Code Here

Examples of org.sonatype.nexus.rest.model.PlexusComponentListResource

      if (!components.iterator().hasNext()) {
        throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND);
      }

      for (BeanEntry<Named, ?> entry : components) {
        PlexusComponentListResource resource = new PlexusComponentListResource();

        String hint = entry.getKey().value();
        String description = entry.getDescription();

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

        // add it to the collection
        result.addData(resource);
      }
    }
View Full Code Here

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

    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);
      }
    }
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.