Examples of NexusRepositoryTypeListResourceResponse


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

   */
  @Test
  public void repoType() {
    final JerseyNexusClient client = (JerseyNexusClient) client();

    final NexusRepositoryTypeListResourceResponse types = client.serviceResource("components/repo_types")
        .get(NexusRepositoryTypeListResourceResponse.class);

    final Collection<String> typeFormats =
        Collections2.transform(types.getData(), new Function<NexusRepositoryTypeListResource, String>()
        {
          @Override
          public String apply(@Nullable final NexusRepositoryTypeListResource input) {
            return input.getFormat();
          }
View Full Code Here

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

    }
    else if ("group".equals(repoType)) {
      templateSet = templateSet.getTemplates(GroupRepository.class);
    }

    NexusRepositoryTypeListResourceResponse result = new NexusRepositoryTypeListResourceResponse();

    if (templateSet.getTemplatesList().isEmpty()) {
      throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND);
    }

    for (Template template : templateSet.getTemplatesList()) {
      NexusRepositoryTypeListResource resource = new NexusRepositoryTypeListResource();

      String providerRole = ((RepositoryTemplate) template).getRepositoryProviderRole();
      String providerHint = ((RepositoryTemplate) template).getRepositoryProviderHint();

      resource.setProvider(providerHint);

      resource.setProviderRole(providerRole);

      resource.setFormat(((AbstractRepositoryTemplate) template).getContentClass().getId());

      // To not disturb the "New repo UI", it's shitty right now: we select templates here that predefines is
      // something a "release" or "snapshot", but
      // UI allows to select that too.
      resource.setDescription(removeBrackets(template.getDescription()));

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

    return result;
  }
View Full Code Here

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

    this.validateXmlHasNoPackageNames(response);
  }

  @Test
  public void testNexusRepositoryTypeListResourceResponse() {
    NexusRepositoryTypeListResourceResponse response = new NexusRepositoryTypeListResourceResponse();

    NexusRepositoryTypeListResource resource = new NexusRepositoryTypeListResource();
    resource.setDescription("description");
    resource.setFormat("format");
    resource.setProvider("provider");
    resource.setProviderRole("providerRole");

    response.addData(resource);

    NexusRepositoryTypeListResource resource2 = new NexusRepositoryTypeListResource();
    resource2.setDescription("description2");
    resource2.setFormat("format2");
    resource2.setProvider("provider2");
    resource2.setProviderRole("providerRole2");

    response.addData(resource2);

    this.marshalUnmarchalThenCompare(response);
    this.validateXmlHasNoPackageNames(response);
  }
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.