Beispiel #1
0
  @SuppressWarnings("unchecked")
  @Test
  public void testCreateMainBranch() {
    Branch branch = new Branch();
    branch.setId("branchresource-test");
    branch.setMainBranch(true);
    branch.setRepositoryName(RAPTOR_REPO);

    branchResource.createBranch(
        nullMockUri,
        CMSPriority.NEUTRAL.toString(),
        null,
        RAPTOR_REPO,
        branch,
        new MockHttpServletRequest());

    CMSResponse resp =
        branchResource.getMainBranches(
            nullMockUri,
            CMSPriority.NEUTRAL.toString(),
            null,
            RAPTOR_REPO,
            new MockHttpServletRequest());

    List<Branch> branches = (List<Branch>) resp.get(CMSResponse.RESULT_KEY);
    Assert.assertNotNull(branches);
    boolean foundCreate = false;
    for (Branch b : branches) {
      if (branch.getId().equals(b.getId())) {
        foundCreate = true;
        break;
      }
    }
    Assert.assertTrue(foundCreate);
  }
Beispiel #2
0
  @Test
  public void testCreateSubBranch() {
    Branch branch = new Branch();
    branch.setId("branhresource-test-subbranch");
    branch.setMainBranch(false);
    branch.setRepositoryName(RAPTOR_REPO);

    try {
      branchResource.createBranch(
          nullMockUri,
          CMSPriority.NEUTRAL.toString(),
          null,
          RAPTOR_REPO,
          branch,
          new MockHttpServletRequest());
      Assert.fail();
    } catch (CMSServerException e) {

    }
  }