コード例 #1
0
  @SuppressWarnings("unchecked")
  public void testGetProjectCollaboratorsForProjectId() {
    UserDao udao = new UserDao();
    User collab = udao._get(TEST_USERNAME + ".collab");
    if (collab == null) {
      collab = createUser();
      collab.setUsername(TEST_USERNAME + ".collab");
      udao._add(collab);
    }
    UserProject collabup = new UserProject(collab, project);
    collabup.setUserType(UserPermissionType.USER);
    collabup.setUsage(new Usage());
    collabup.setMss(new ResourceDao(session)._getStorage(TEST_STORAGENAME));
    UserProjectDao.add(collabup);

    String sCollabs =
        service.getProjectCollaborators(TEST_SESSIONTOKEN, project.getId().toString());
    assertNotNull(sCollabs);

    List<UserBean> beans = (List<UserBean>) ServiceUtil.xstream.fromXML(sCollabs);

    assertTrue(beans.size() == 2);

    UserProjectDao.remove(collabup);
    udao = new UserDao();
    udao._remove(collab);
  }
コード例 #2
0
 public void testGetProjectsNullSessionToken() throws Exception {
   try {
     service.getProjects(null);
     fail("Null session token should throw session exception");
   } catch (SessionException e) {
   } catch (Exception e) {
     fail("Null session token should throw session exception");
   }
 }
コード例 #3
0
 public void testGetProjectCollaboratorsForProjectIdInvalidProjectId() throws Exception {
   try {
     service.getProjectCollaborators(TEST_SESSIONTOKEN, "-1");
     fail("Invalid session token should throw session exception");
   } catch (PermissionException e) {
   } catch (Exception e) {
     fail("Invalid session token should throw session exception");
   }
 }
コード例 #4
0
 public void testGetProjectCollaboratorsForProjectIdEmptyProjectId() throws Exception {
   try {
     service.getProjectCollaborators(TEST_SESSIONTOKEN, "");
     fail("Empty session token should throw session exception");
   } catch (SessionException e) {
   } catch (Exception e) {
     fail("Empty session token should throw session exception");
   }
 }
コード例 #5
0
 public void testGetProjectCollaboratorsForProjectIdInvalidSessionToken() throws Exception {
   try {
     service.getProjectCollaborators("-1", project.getId().toString());
     fail("Invalid session token should throw session exception");
   } catch (SessionException e) {
   } catch (Exception e) {
     fail("Invalid session token should throw session exception");
   }
 }
コード例 #6
0
 public void testGetProjectCollaboratorsInvalidSessionToken() throws Exception {
   try {
     service.getCollaborators("-1");
     fail("Invalid session token should throw session exception");
   } catch (SessionException e) {
   } catch (Exception e) {
     fail("Invalid session token should throw session exception");
   }
 }
コード例 #7
0
  @SuppressWarnings("unchecked")
  public void testGetProjects() throws Exception {
    String sProjects = service.getProjects(TEST_SESSIONTOKEN);
    assertNotNull(sProjects);

    List<ProjectBean> beans = (List<ProjectBean>) ServiceUtil.xstream.fromXML(sProjects);

    assertTrue(beans.size() == 1);
  }
コード例 #8
0
 public void testGetProjectsEmptySessionToken() throws Exception {
   try {
     service.getProjects("");
     fail("Empty session token should throw session exception");
   } catch (SessionException e) {
   } catch (Exception e) {
     fail("Empty session token should throw session exception");
   }
 }