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

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


  }

  @Test
  public void testListUsersSorted() throws IOException {
    UserService service = getTestUserForge().createUserService();
    ListPreferences listPrefs = new ListPreferences();
    listPrefs.setLimit(4);
    listPrefs.setOffset(1);
    listPrefs.setSortBy("username");
    listPrefs.setSortOrder("descending");
    List<User> Users = service.list(listPrefs);
    assertNotNull("Null User list", Users);
    assertFalse("Empty User list", Users.isEmpty());
  }
View Full Code Here


  }

  @Test
  public void testListModulesSorted() throws IOException {
    ModuleService service = getTestUserForge().createModuleService();
    ListPreferences listPrefs = new ListPreferences();
    listPrefs.setLimit(4);
    listPrefs.setOffset(2);
    listPrefs.setSortBy("name");
    listPrefs.setSortOrder("descending");
    List<Module> modules = service.search(null, listPrefs);
    assertNotNull("Null module list", modules);
    assertFalse("Empty module list", modules.isEmpty());
  }
View Full Code Here

    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) {
    }
    try {
      releaseService.delete(owner, "test_module_b", Version.create(1, 0, 0));
      moduleService.delete(owner, "test_module_b");
    }
    catch(Exception e) {
    }
    try {
      releaseService.delete(owner, "test_module_c", Version.create(1, 0, 0));
      moduleService.delete(owner, "test_module_c");
    }
    catch(Exception e) {
    }
    try {
      releaseService.delete(owner, "test_module_d", Version.create(1, 0, 0));
      moduleService.delete(owner, "test_module_d");
    }
    catch(Exception e) {
    }
    try {
      moduleService.delete(System.getProperty("forge.login.second"), "test_module_wrong_owner");
    }
    catch(Exception e) {
    }
  }
View Full Code Here

*
*/
public class ModuleTestDelete extends ForgeAPITestBase {
  @Test
  public void testDeleteModule() throws IOException {
    ModuleService service = getTestUserForge().createModuleService();
    service.delete(TEST_USER, TEST_MODULE);
    try {
      service.get(TEST_USER, TEST_MODULE);
      fail("Expected 404");
    }
    catch(HttpResponseException e) {
      assertEquals("Wrong response code", 404, e.getStatusCode());
    }
View Full Code Here

*
*/
public class ModuleTestCreate extends ForgeAPITestBase {
  @Test
  public void testCreate() throws IOException {
    ModuleService service = getTestUserForge().createModuleService();

    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

*
*/
public class ModuleTests extends ForgeAPITestBase {
  @Test
  public void testListModules() throws IOException {
    ModuleService service = getTestUserForge().createModuleService();
    List<Module> modules = service.search("puppetlabs", null);
    assertNotNull("Null module list", modules);
    assertFalse("Empty module list", modules.isEmpty());

    boolean someReleaseLinkTested = false;
    int moduleCount = modules.size();
    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);
        assertNotNull("Null resolved release", resolved);
        assertEquals("Resolved release version mismatch", resolved.getVersion().toString(), release.getKey());
        someReleaseLinkTested = true;
      }
    }
View Full Code Here

    assertTrue("No release links found", someReleaseLinkTested);
  }

  @Test
  public void testListModulesSorted() throws IOException {
    ModuleService service = getTestUserForge().createModuleService();
    ListPreferences listPrefs = new ListPreferences();
    listPrefs.setLimit(4);
    listPrefs.setOffset(2);
    listPrefs.setSortBy("name");
    listPrefs.setSortOrder("descending");
    List<Module> modules = service.search(null, listPrefs);
    assertNotNull("Null module list", modules);
    assertFalse("Empty module list", modules.isEmpty());
  }
View Full Code Here

public class ModuleTestCreate extends ForgeAPITestBase {
  @Test
  public void testCreate() throws IOException {
    ModuleService service = getTestUserForge().createModuleService();

    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

    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) {
    }
    try {
      releaseService.delete(owner, "test_module_b", Version.create(1, 0, 0));
      moduleService.delete(owner, "test_module_b");
    }
    catch(Exception e) {
    }
    try {
      releaseService.delete(owner, "test_module_c", Version.create(1, 0, 0));
      moduleService.delete(owner, "test_module_c");
    }
    catch(Exception e) {
    }
    try {
      releaseService.delete(owner, "test_module_d", Version.create(1, 0, 0));
      moduleService.delete(owner, "test_module_d");
    }
    catch(Exception e) {
    }
    try {
View Full Code Here

*
*/
public class ReleaseTestDelete extends ForgeAPITestBase {
  @Test
  public void testDeleteRelease() throws IOException {
    ReleaseService service = getTestUserForge().createReleaseService();
    service.delete(TEST_USER, TEST_MODULE, TEST_RELEASE_VERSION);
    try {
      service.get(TEST_USER, TEST_MODULE, TEST_RELEASE_VERSION);
      fail("Expected 404");
    }
    catch(HttpResponseException e) {
      assertEquals("Wrong response code", 404, e.getStatusCode());
    }
View Full Code Here

TOP

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

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.