Example #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);
  }
Example #2
0
 @SuppressWarnings("unchecked")
 @Test
 public void getBranch() {
   String branchId = "main";
   CMSResponse resp =
       branchResource.getBranch(
           nullMockUri,
           CMSPriority.NEUTRAL.toString(),
           null,
           RAPTOR_REPO,
           branchId,
           new MockHttpServletRequest());
   assertOkAndNotNullResult(resp);
   List<Branch> branches = (List<Branch>) resp.get(CMSResponse.RESULT_KEY);
   Assert.assertEquals(1, branches.size());
   Assert.assertEquals(branchId, branches.get(0).getId());
 }
Example #3
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) {

    }
  }