Package uk.ac.osswatch.simal.model

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


        .getUniqueSimalID());

    String uri1 = RDFUtils.PROJECT_NAMESPACE_URI + "TestingId1";
    String uri2 = RDFUtils.PROJECT_NAMESPACE_URI + "TestingId2";

    IProject project;
    project = SimalRepositoryFactory.getProjectService().createProject(uri1);
    project = SimalRepositoryFactory.getProjectService().getProject(uri1);
    String id1 = project.getSimalID();

    project = SimalRepositoryFactory.getProjectService().createProject(uri2);
    project = SimalRepositoryFactory.getProjectService().getProject(uri2);
    String id2 = project.getSimalID();

    assertFalse("Project IDs are not unique: " + id1 + " == " + id2, id1
        .equals(id2));

    // check IDs are being written to the repository
    project = SimalRepositoryFactory.getProjectService().getProject(uri1);
    String id3 = project.getSimalID();
    assertTrue("Project IDs don't appear to be written to the repo", id1
        .equals(id3));
   
    // check we are retrieving projects by ID correctly
    project = SimalRepositoryFactory.getProjectService().getProjectById(id1);
    assertNotNull(project);
   
    project.delete();
    project = SimalRepositoryFactory.getProjectService().getProject(uri2);
    project.delete();
  }
View Full Code Here


          SimalRepositoryFactory.getProjectService().createProject(
              RDFXMLUtils.convertXmlStringToDom(data));
        }
      } finally {
        fis.close();
        IProject project1 = SimalRepositoryFactory.getProjectService()
            .getProject(PROJECT_URIS[i]);
        if (project1 != null) {
          project1.delete();
        }
        i++;
      }
    }
  }
View Full Code Here

  public void testGetAllProjects() throws SimalRepositoryException, IOException {
    logger.debug("Starting testGetAllProjects()");
    Set<IProject> projects = getRepository().getAllProjects();

    Iterator<IProject> itrProjects = projects.iterator();
    IProject project;
    while (itrProjects.hasNext()) {
      project = itrProjects.next();
      assertNotNull(project.getName());
      logger.debug("Got project: " + project.getName() + " with URI " + project.getURI());
    }

    assertEquals(9, projects.size());
    logger.debug("Finished testGetAllProjects()");
  }
View Full Code Here

  public void testNullQNameHandling() throws SimalRepositoryException {
    logger.debug("Starting testNullQNameHandling()");
    Set<IProject> projects = getRepository().getAllProjects();

    Iterator<IProject> itrProjects = projects.iterator();
    IProject project;
    while (itrProjects.hasNext()) {
      project = itrProjects.next();
      assertNotNull("All projects must have a QName", project.getURI());
    }
    logger.debug("Finished testNullQNameHandling()");
  }
View Full Code Here

   *
   * @return
   * @throws SimalRepositoryException
   */
  public IProject getFeaturedProject() throws SimalRepositoryException {
    IProject project;
    Set<IProject> allProjects = getAllProjects();
      Random rand = new Random();
      int size = allProjects.size();
      if (size > 0) {
        int idx = rand.nextInt(size);
View Full Code Here

   * @refactor should be moved to ProjectService class
   */
  public String getAllProjectsAsJSON() throws SimalRepositoryException {
    StringBuffer json = new StringBuffer("{ \"items\": [");
    Iterator<IProject> projects = getAllProjects().iterator();
    IProject project;
    while (projects.hasNext()) {
      project = projects.next();
      json.append(project.toJSONRecord());
      if (projects.hasNext()) {
        json.append(",");
      }
    }
    json.append("]}");
View Full Code Here

    if (projects.size() == 0) {
      throw new SimalException("No project recorded for review: ");
    } else if (projects.size() > 1) {
      throw new SimalException("More than one project recorded for review ");
    }
    IProject project = new Project(projects.get(0).getResource());
    return project;
  }
View Full Code Here

TOP

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

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.