Package com.puppetlabs.geppetto.forge.v2.api.it

Examples of com.puppetlabs.geppetto.forge.v2.api.it.ModuleTestCreate


        return System.getProperty("forge.base.url");
      }
    };

    String owner = System.getProperty("forge.login");
    ForgeAPI forge = new ForgeAPI(getCommonModule(), GsonModule.INSTANCE, createCredentialsModule(
      props, owner, System.getProperty("forge.password")), forgeModule);

    // Create the modules used in publishing tests
    ModuleService moduleService = forge.createModuleService();
    ReleaseService releaseService = forge.createReleaseService();
    try {
      releaseService.delete(owner, "test_module_a", Version.create(1, 0, 0));
      moduleService.delete(owner, "test_module_a");
    }
    catch(Exception e) {
View Full Code Here


    return new String[] { FORGE_CLIENT_ID, FORGE_CLIENT_SECRET };
  }

  protected static ForgeAPI getTestUserForge() {
    if(testUserForge == null)
      testUserForge = new ForgeAPI(new TestModule());
    return testUserForge;
  }
View Full Code Here

  @Override
  protected void configure() {
    bind(ForgeClient.class).to(ForgeHttpClient.class);
    install(new V1Module());
    install(new V2Module());
    install(new V3Module());
    bind(MetadataRepository.class).to(MetadataRepositoryImpl.class);
  }
View Full Code Here

    ModuleTemplate template = new ModuleTemplate();
    template.setOwner(TEST_USER);
    template.setName(TEST_MODULE);
    template.setDescription("A Dummy Test Module");
    Module newModule = service.create(template);
    assertNotNull("Null Module", newModule);
  }
View Full Code Here

    int max = 3;
    if(max > moduleCount)
      max = moduleCount;

    for(int idx = 0; idx < max; ++idx) {
      Module module = modules.get(idx);
      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);
View Full Code Here

    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

  }

  @Test
  public void testUserDetail() throws IOException {
    UserService service = getTestUserForge().createUserService();
    User user = service.get(TEST_USER);
    assertNotNull("Null user", user);
  }
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.forge.v2.api.it.ModuleTestCreate

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.