Examples of IDoapResource


Examples of uk.ac.osswatch.simal.model.IDoapResource

  @Test
  public void testSortByName() throws SimalRepositoryException {
    SortableCategoryDataProvider provider = new SortableCategoryDataProvider();
    int pageSize = NUMBER_OF_TEST_CATEGORIES - 1;
    Iterator<IDoapResource> iterator = provider.iterator(0, pageSize);
    IDoapResource category;
    String prev = null;
    String current;
    int count = 0;
    logger.debug("Category order is:");
    while (iterator.hasNext()) {
      category = iterator.next();
      current = (String) category.getName();
      logger.debug(current);
      if (prev != null) {
        assertTrue("Incorrect sort order: " + prev + " preceeds " + current,
            current.compareTo(prev) >= 0);
      }
View Full Code Here

Examples of uk.ac.osswatch.simal.model.IDoapResource

    SortableProjectDataProvider provider = new SortableProjectDataProvider();
    int pageSize = NUMBER_OF_TEST_PROJECTS - 1;

    // test the default sort is by name
    Iterator<IDoapResource> iterator = provider.iterator(0, pageSize);
    IDoapResource project;
    String prev = null;
    String current;
    int count = 0;
    while (iterator.hasNext()) {
      project = iterator.next();
      current = (String) project.getName();
      if (prev != null) {
        assertTrue("Incorrect sort order: " + prev + " preceeds " + current,
            current.compareTo(prev) >= 0);
      }
      prev = current;
      count = count + 1;
    }

    assertEquals(
        "not returning the right number of elements for the given start point and pageSize",
        pageSize, count);

    // test the sort is by shortDesc
    provider.setSort(SortableProjectDataProvider.SORT_PROPERTY_SHORTDESC, true);
    iterator = provider.iterator(0, 10);
    prev = null;
    count = 0;
    logger.debug("Projects in the project data provider are:");
    while (iterator.hasNext()) {
      project = iterator.next();
      current = project.getShortDesc();
      logger.debug(current);
      if (prev != null && current != null) {
        assertTrue("Incorrect sort order: " + prev + " preceeds " + current,
            current.compareTo(prev) >= 0);
      }
View Full Code Here

Examples of uk.ac.osswatch.simal.model.IDoapResource

    TreeSet<IDoapResource> treeSet = new TreeSet<IDoapResource>(comparator);
    treeSet.addAll(resources);
    TreeSet<IDoapResource> result = new TreeSet<IDoapResource>(comparator);
    int idx = 0;
    Iterator<IDoapResource> all = treeSet.iterator();
    IDoapResource current;
    while (all.hasNext() && idx - (first + count) < 0) {
      current = all.next();
      // FIXME
      if (idx >= first && current.getName() != "") {
        result.add(current);
      }
      idx++;
    }
    return result.iterator();
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.