Package uk.ac.osswatch.simal.model

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


    provider.setSort(SortableCategoryDataProvider.SORT_PROPERTY_PROJECTS, true);
    Iterator<IDoapResource> iterator = provider.iterator(0, pageSize);
    int prev = -1;
    count = 0;
    while (iterator.hasNext()) {
      IDoapCategory category = (IDoapCategory) iterator.next();
      int current = category.getProjects().size();
      if (prev >= 0) {
        assertTrue("Incorrect sort order: " + prev + " preceeds " + current,
            current >= prev);
      }
      prev = current;
View Full Code Here


    provider.setSort(SortableCategoryDataProvider.SORT_PROPERTY_PEOPLE, true);
    Iterator<IDoapResource> iterator = provider.iterator(0, pageSize);
    int prev = 0;
    count = 0;
    while (iterator.hasNext()) {
      IDoapCategory category = (IDoapCategory) iterator.next();
      int current = category.getPeople().size();
      if (prev >= 0) {
        assertTrue("Incorrect sort order: " + prev + " preceeds " + current,
            current >= prev);
      }
      prev = current;
View Full Code Here

        return 0;
      }

      int result;
      if (getSort() != null && isCategorySpecificSort(getSort().getProperty())) {
        IDoapCategory cat1 = (IDoapCategory) resource1;
        IDoapCategory cat2 = (IDoapCategory) resource2;

        String sortField = getSort().getProperty();
        Integer num1 = 0;
        Integer num2 = 0;
        if (sortField.equals(SORT_PROPERTY_PROJECTS)) {
          num1 = cat1.getProjects().size();
          num2 = cat2.getProjects().size();
        } else if (sortField.equals(SORT_PROPERTY_PEOPLE)) {
          num1 = cat1.getPeople().size();
          num2 = cat2.getPeople().size();
        }
        result = num1.compareTo(num2);
        if (result == 0) {
          result = 1;
        }
View Full Code Here

      .getLogger(TestCategory.class);
 
  @Test
  public void testGetCategoryLabel() throws SimalRepositoryException,
      URISyntaxException {
    IDoapCategory category = SimalRepositoryFactory.getCategoryService().get(
        "http://simal.oss-watch.ac.uk/category/socialNews");
    String label = category.getLabel();
    assertEquals("Category Label is incorrect", "Social News", label);

    String uri = "http://example.org/does/not/exist";
    category = SimalRepositoryFactory.getCategoryService().get(uri);
    assertNull("Somehow we have a category that should not exist", category);
View Full Code Here

    assertNull("Somehow we have a category that should not exist", category);
  }

  @Test
  public void testGetProjects() {
    IDoapCategory category = (IDoapCategory) project1.getCategories().toArray()[0];
    Set<IProject> projects = category.getProjects();

    String strProject = project1.toString();
    assertTrue(
        "We haven't got the project we expected from category.getProjects()",
        projects.toString().contains(strProject));
View Full Code Here

        projects.toString().contains(strProject));
  }

  @Test
  public void testSetId() throws SimalRepositoryException {
    IDoapCategory category = (IDoapCategory) project1.getCategories().toArray()[0];
    category.setSimalID("testing");
    String id = category.getSimalID();
    assertEquals("Simal ID has not been changed correctly", id, "testing");
  }
View Full Code Here

    assertEquals("Simal ID has not been changed correctly", id, "testing");
  }

  @Test
  public void testGetId() throws SimalRepositoryException {
    IDoapCategory category = (IDoapCategory) project1.getCategories().toArray()[0];
    String id = category.getSimalID();
    assertNotNull(id);
  }
View Full Code Here

    this.uri = uri;
  }

  @Override
  protected IResource load() {
    IDoapCategory category;
    try {
      category = SimalRepositoryFactory.getCategoryService().get(uri);
    } catch (SimalRepositoryException e) {
      e.printStackTrace();
      category = null;
View Full Code Here

    assertNotNull(id);
  }

  @Test
  public void testGetPeople() throws SimalRepositoryException {
    IDoapCategory category = (IDoapCategory) project1.getCategories().toArray()[0];
    Set<IPerson> people = category.getPeople();
    Iterator<IPerson>itr = people.iterator();
    while (itr.hasNext()) {
      logger.debug("Got person: " + itr.next().toString());
    }
    assertEquals("Not got the right number of people for the test category", 9, people.size());
View Full Code Here

TOP

Related Classes of uk.ac.osswatch.simal.model.IDoapCategory

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.