Package com.puppetlabs.geppetto.forge.v3.model

Examples of com.puppetlabs.geppetto.forge.v3.model.Release


    List<Release> releases = moduleService.getReleases(moduleName.getOwner(), moduleName.getName(), null);
    if(releases.isEmpty())
      throw new FileNotFoundException("No releases found for module '" + moduleName + '\'');

    Release best = null;
    for(Release release : releases)
      if((best == null || release.getVersion().compareTo(best.getVersion()) > 0) &&
          (range == null || range.isIncluded(release.getVersion())))
        best = release;

    if(best == null)
      throw new FileNotFoundException("No releases matching '" + range + "' found for module '" + moduleName +
          '\'');

    if(!destinationIncludesTopFolder)
      // Use module name as the default
      destination = new File(destination, moduleName.getName());

    if(destination.exists()) {
      if(!force)
        throw new IOException("Destination folder is not empty: " + destination.getAbsolutePath());

      // Don't remove .project, .settings, .git, .svn, etc. if they are present.
      FileUtils.rmR(destination, FileUtils.DEFAULT_EXCLUDES);
    }

    File moduleFile = cache.retrieve(best.getFullName(), best.getVersion());

    // Unpack closes its input.
    TarUtils.unpack(new GZIPInputStream(new FileInputStream(moduleFile)), destination, true, null);
    return forgeUtil.loadJSONMetadata(new File(destination, METADATA_JSON_NAME));
  }
View Full Code Here


public class ReleaseTestCreate extends ForgeAPITestBase {
  @Test
  public void testCreate() throws IOException {
    ReleaseService service = getTestUserForge().createReleaseService();
    byte[] releaseFile = TestDataProvider.getTestData(TEST_GZIPPED_RELEASE);
    Release newRelease = service.create(
      TEST_USER, TEST_MODULE, "Some notes about this release", new ByteArrayInputStream(releaseFile),
      releaseFile.length);
    assertNotNull("Null Release", newRelease);
    assertEquals("Incorrect release version", newRelease.getVersion(), TEST_RELEASE_VERSION);
  }
View Full Code Here

  */

  @Test
  public void testReleaseDetail() throws IOException {
    ReleaseService service = getTestUserForge().createReleaseService();
    Release release = service.get(TEST_USER, TEST_MODULE, TEST_RELEASE_VERSION);
    assertNotNull("Null release", release);
  }
View Full Code Here

      List<AnnotatedLink> releases = module.getReleases();
      assertNotNull("Null module releases list", releases);
      for(AnnotatedLink release : releases) {
        assertNotNull("Null module release slug", release.getSlug());
        assertNotNull("Null module release link", release.getLink());
        Release resolved = service.resolveLink(release.getLink(), Release.class);
        assertNotNull("Null resolved release", resolved);
        assertEquals("Resolved release version mismatch", resolved.getVersion().toString(), release.getKey());
        someReleaseLinkTested = true;
      }
    }
    assertTrue("No release links found", someReleaseLinkTested);
  }
View Full Code Here

   */
  @Override
  public void accept(Query<T> query, SortBy<T> sortBy, boolean includeDeleted, Visitor<T> visitor,
      ProgressMonitor progressMonitor) throws IOException, InvocationTargetException {
    if(progressMonitor == null)
      progressMonitor = new NullProgressMonitor();

    currentMonitor = progressMonitor;
    try {
      PaginatedResult<T> page = list(query, sortBy, null, includeDeleted);
      progressMonitor.beginTask(page.getTotal());
View Full Code Here

    return client.get(getEndpointSegment(), params, getPaginatedResultType());
  }

  @Override
  public List<T> listAll(Query<T> query, SortBy<T> sortBy, boolean includeDeleted) throws IOException {
    ProgressMonitor monitor = new NullProgressMonitor();
    currentMonitor = monitor;
    try {
      PaginatedResult<T> page = list(query, sortBy, null, includeDeleted);
      monitor.beginTask(page.getTotal());

      int total = page.getTotal();
      if(total == 0)
        return Collections.emptyList();
View Full Code Here

    currentMonitor = progressMonitor;
    try {
      PaginatedResult<T> page = list(query, sortBy, null, includeDeleted);
      progressMonitor.beginTask(page.getTotal());

      PaginationInfo pi = visitPage(page, visitor, progressMonitor);
      while(pi != null)
        pi = visitPage(list(query, sortBy, pi, includeDeleted), visitor, progressMonitor);

      if(!progressMonitor.isCanceled())
        progressMonitor.endTask();
View Full Code Here

          result.add(entity);
        }
      };

      try {
        PaginationInfo pi = visitPage(page, visitor, monitor);
        while(pi != null)
          pi = visitPage(list(query, sortBy, pi, includeDeleted), visitor, monitor);
      }
      catch(InvocationTargetException e) {
        // The visitor never throws that
View Full Code Here

  }

  protected void testList(ForgeService.Compare<T> query) throws IOException {
    PaginatedResult<T> result = getService().list(query, null, null, false);
    assertNotNull("Null result", result);
    PaginationInfo nxt = result.getNext();
    assertNotNull("Null pagination for next page", nxt);
    List<T> entries = result.getResults();
    assertNotNull("Null result list", entries);
    assertFalse("Empty list", entries.isEmpty());
View Full Code Here

    if(left <= 0)
      return null;
    if(limit > left)
      limit = left;

    return new PaginationInfo(last, limit);
  }
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.forge.v3.model.Release

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.