Beispiel #1
0
  @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;
      }
    }
    assertTrue("No release links found", someReleaseLinkTested);
  }
Beispiel #2
0
 @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());
 }