Package uk.ac.osswatch.simal.model

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


  public void testAddAndRemoveDeveloper() throws SimalRepositoryException,
      DuplicateURIException {
    Set<IPerson> prePeople = project1.getDevelopers();

    String uri = RDFUtils.PERSON_NAMESPACE_URI + "TestingPersonFromScratch";
    IPerson person = SimalRepositoryFactory.getPersonService().create(uri);

    project1.addDeveloper(person);
    Set<IPerson> postPeople = project1.getDevelopers();
    assertTrue("Failed to add a developer to the project",
        prePeople.size() < postPeople.size());

    project1.removeDeveloper(person);
    postPeople = project1.getDevelopers();
    assertTrue("Failed to remove a developer from the project", prePeople
        .size() == postPeople.size());

    person.delete();
  }
View Full Code Here


    if (!repository.isInitialised()) {
      repository.setIsTest(true);
      repository.initialise(System.getProperty("java.io.tmpdir"));
    }
    project1 = SimalRepositoryFactory.getProjectService().findProjectBySeeAlso(TEST_PROJECT_URI);
    IPerson developer = SimalRepositoryFactory.getPersonService().findBySeeAlso("http://foo.org/~developer/#me");
    testDeveloperID = developer.getUniqueSimalID();
    testDeveloperEMail = developer.getEmail().iterator().next().getAddress();
   
    IPerson documentor = SimalRepositoryFactory.getPersonService().findBySeeAlso("http://foo.org/~documentor/#me");
    documentor.setUsername("author");
    documentor.setPassword("password");
    String documentorID = documentor.getUniqueSimalID();

    testProjectID = project1.getUniqueSimalID();
    testProjectURI = RDFUtils.getDefaultProjectURI(testProjectID);
    testDeveloperURI = RDFUtils.getDefaultPersonURI(testDeveloperID);
    testDocumentorURI = RDFUtils.getDefaultPersonURI(documentorID);
View Full Code Here

      public void onSubmit() {
        if (passwordRequested.equals(passwordConfirm)) {
          try {
            IPersonService service = SimalRepositoryFactory.getPersonService();
            IPerson user = service.findByUsername(usernameRequested);
            if (user == null) {
              String id = SimalRepositoryFactory.getPersonService().getNewID();
              String uri = RDFUtils.getDefaultPersonURI(id);
              IPerson person = service.create(uri);
              person.setUsername(usernameRequested);
              person.setPassword(passwordRequested);
             
              SimalSession.get().authenticate(usernameRequested, passwordRequested);
            } else {
              error(DUPLICATE_USERNAME_ERROR);
            }
View Full Code Here

    if (username.equals(adminUsername) && password.equals(adminPassword)) {
      setUsername(username);
      setAuthenticated(true);
    } else {
      IPersonService service = SimalRepositoryFactory.getPersonService();
      IPerson user = service.findByUsername(username);
      if (user == null) {
        setAuthenticated(false);
      } else {
        if (user.getPassword().equals(password)) {
          setAuthenticated(true);
          setUsername(username);
        } else {
          setAuthenticated(false);
        }
View Full Code Here

    }
   
    int peopleAfter = SimalRepositoryFactory.getPersonService().getAll().size();
    Iterator<IPerson> people = SimalRepositoryFactory.getPersonService().getAll().iterator();
    while (people.hasNext()) {
      IPerson person = people.next();
      logger.debug("We have got a person labelled " + person.getLabel() + " from " + person.getSeeAlso().toString());
    }   
    assertEquals("We have more people after adding a duplicate than we did before", peopleBefore, peopleAfter);
   
    project1 = SimalRepositoryFactory.getProjectService().findProjectBySeeAlso(TEST_PROJECT_URI);
    assertNotNull("We don't seem to have added the test data as expected",
View Full Code Here

  public void testDuplicatePeople() throws SimalRepositoryException {
    int beforeSize = SimalRepositoryFactory.getPersonService().getAll().size();
    Iterator<IPerson> itr = SimalRepositoryFactory.getPersonService().getAll().iterator();
    logger.debug("People before second data addition:");
    while (itr.hasNext()) {
      IPerson person = itr.next();
      logger.debug(person.toString());
    }

    ModelSupport.addSimalData(getRepository());

    int afterSize = SimalRepositoryFactory.getPersonService().getAll().size();
    itr = SimalRepositoryFactory.getPersonService().getAll().iterator();
    logger.debug("People after second data addition are:");
    while (itr.hasNext()) {
      IPerson person = itr.next();
      logger.debug(person.toString());
    }
    assertEquals(
        "Adding the test data a second time has resulted in duplicate people entries",
        beforeSize, afterSize);
  }
View Full Code Here

  @Test
  public void testAddPersonFromScratch() throws SimalRepositoryException,
      DuplicateURIException, URISyntaxException {
    String sourceURI = RDFUtils.PERSON_NAMESPACE_URI + "TestingPersonFromScratch";
    IPerson person;
    person = SimalRepositoryFactory.getPersonService().create(sourceURI);

    person = SimalRepositoryFactory.getPersonService().get(person.getURI());
    assertNotNull("Person has not been added to repository", person);
    assertNotNull("Person simalID should not be null", person.getSimalID());
    assertNotNull("Person simalID is invalid", getRepository().isUniqueSimalID(
        person.getSimalID()));

    person.delete();
  }
View Full Code Here

  @Test
  public void testKnows() throws SimalRepositoryException {
    Set<IPerson> knows = developer.getKnows();
    assertNotNull("Should know some people", knows);
    IPerson person = knows.iterator().next();
    String name = (String) person.getNames().toArray()[0];
    assertTrue("Should know a person", name.contains("Known Person"));
  }
View Full Code Here

  public void testGetColleagues() throws SimalRepositoryException {
    Set<IPerson> colleagues = developer.getColleagues();
    assertNotNull(colleagues);
    Iterator<IPerson> people = colleagues.iterator();
    while (people.hasNext()) {
      IPerson person = people.next();
      logger.debug("Got colleague: " + person);
      assertNotNull("No person should have a null ID (see " + person.getURI()
          + ")", person.getSimalID());
    }
    assertEquals("Got an incorrect number of colleagues", BaseRepositoryTest
        .getNumberOfParticipants() - 1, colleagues.size());
  }
View Full Code Here

  public static RepeatingView getRepeatingPersonPanel(String repeaterWicketID,
      String personWicketID, Set<IPerson> people) {
    Iterator<IPerson> itr = people.iterator();
    RepeatingView repeating = new RepeatingView(repeaterWicketID);
    WebMarkupContainer item;
    IPerson person;
    while (itr.hasNext()) {
      item = new WebMarkupContainer(repeating.newChildId());
      repeating.add(item);
      person = itr.next();
      try {
        item.add(new PersonSummaryPanel(personWicketID, person));
      } catch (SimalRepositoryException e) {
        LOGGER.warn("Can't display person: " + person.toString(), e);
      }
    }
    return repeating;
  }
View Full Code Here

TOP

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

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.