Esempio n. 1
0
  @Test
  public void advancedGet() throws IOException, ClearCaseException {
    File path = createTempPath();
    String viewTag = ccenv.getUniqueName() + "_TAG2b";

    Stream oneInt = ccenv.context.streams.get("one_int");
    Baseline model1 = ccenv.context.baselines.get("model-1");
    Baseline model2 = ccenv.context.baselines.get("model-2");

    Stream container = Stream.create(oneInt, "container2b", true, model1);

    GetView gv = new GetView(path, viewTag).createIfAbsent().setStream(container);
    SnapshotView view = gv.get();

    SnapshotView.LoadRules lr = new SnapshotView.LoadRules(view, SnapshotView.Components.ALL);
    new UpdateView(view).setLoadRules(lr).update();

    /* Verify first */
    listFiles(view.getViewRoot());
    verifyView(gv, ccenv.getUniqueName() + "/Model/model.h", "#1");

    new Rebase(container).addBaseline(model2).rebase(true);

    /* Verify second */
    GetView gv2 = new GetView(path, viewTag);
    verifyView(gv2, ccenv.getUniqueName() + "/Model/model.h", "#1#2");
  }
  @Test
  @TestDescription(
      title = "JENKINS-13944",
      text =
          "A baseline ís built successfully, but the tagging is not done, because the tag tyoe is not installed",
      configurations = {"Tag = true"})
  public void jenkins13944() throws Exception {

    /* First build to create a view */
    AbstractBuild<?, ?> build =
        jenkins.initiateBuild(
            ccenv.getUniqueName(),
            "self",
            "_System@" + ccenv.getPVob(),
            "one_int@" + ccenv.getPVob(),
            false,
            true,
            false,
            false,
            false,
            false);
    Baseline baseline = ccenv.context.baselines.get("model-1");
    new SystemValidator(build)
        .validateBuild(Result.UNSTABLE)
        .validateBaselineTag(baseline, false)
        .validate();
  }
Esempio n. 3
0
  @Test(expected = ViewException.class)
  public void testNonExistent() throws IOException, ClearCaseException {
    File path = createTempPath();
    String viewTag = ccenv.getUniqueName() + "_TAG3";

    Stream oneInt = ccenv.context.streams.get("one_int");
    Baseline model1 = ccenv.context.baselines.get("model-1");

    Stream container = Stream.create(oneInt, "container3", true, model1);

    GetView gv = new GetView(path, viewTag).createIfAbsent().setStream(container);
    SnapshotView view = gv.get();

    SnapshotView.LoadRules lr = new SnapshotView.LoadRules(view, SnapshotView.Components.ALL);
    new UpdateView(view).setLoadRules(lr).update();

    /* Verify first */
    listFiles(view.getViewRoot());
    verifyView(gv, ccenv.getUniqueName() + "/Model/model.h", "#1");

    /* Verify second */
    GetView gv2 =
        new GetView(
            new File(path.getParent(), "98u2n918u2n9831u2n3981nu23981u2398/hahahaha"), viewTag);
    gv2.get();
  }
Esempio n. 4
0
  @Test
  @ClearCaseUniqueVobName(name = "story01b")
  @TestDescription(
      title = "Story 01b",
      text = "New baseline, bl1, on integration stream, poll on self, wrong component.")
  public void story01b() throws Exception {

    AbstractBuild<?, ?> build =
        jenkins.initiateBuild(
            ccenv.getUniqueName(),
            "self",
            "_System2@" + ccenv.getPVob(),
            "one_int@" + ccenv.getPVob(),
            false,
            false,
            false,
            false,
            false);

    SystemValidator validator =
        new SystemValidator(build)
            .validateBuild(Result.FAILURE)
            .validateBuiltBaselineNotFound()
            .validate();
  }
Esempio n. 5
0
  @Test
  @ClearCaseUniqueVobName(name = "story01d")
  @TestDescription(
      title = "Story 01d, polling",
      text = "New baseline, bl1, on integration stream, poll on self, wrong component.")
  public void story01d() throws Exception {

    /* First build must succeed to get a workspace */
    AbstractBuild<?, ?> build =
        jenkins.initiateBuild(
            ccenv.getUniqueName(),
            "self",
            "_System@" + ccenv.getPVob(),
            "one_int@" + ccenv.getPVob(),
            false,
            false,
            false,
            false,
            false);
    AbstractProject<?, ?> project = build.getProject();
    assertTrue(build.getResult().isBetterOrEqualTo(Result.SUCCESS));

    /* New scm with wrong component */
    CCUCMScm scm =
        new CCUCMScm(
            "_System2@" + ccenv.getPVob(),
            "INITIAL",
            "ALL",
            false,
            "self",
            "one_int@" + ccenv.getPVob(),
            "successful",
            false,
            "",
            true,
            false,
            false,
            false,
            "jenkins");
    project.setScm(scm);

    TaskListener listener = jenkins.createTaskListener();
    PollingResult result = project.poll(listener);

    /* Polling result validation */
    assertEquals(PollingResult.NO_CHANGES, result);
  }
Esempio n. 6
0
  @Test
  public void basicCreate() throws IOException, ClearCaseException {
    File path = createTempPath();
    String viewTag = ccenv.getUniqueName() + "_TAG1";

    Stream oneInt = ccenv.context.streams.get("one_int");
    Baseline model1 = ccenv.context.baselines.get("model-1");

    Stream container = Stream.create(oneInt, "container1", true, model1);

    GetView gv = new GetView(path, viewTag).createIfAbsent().setStream(container);
    SnapshotView view = gv.get();

    SnapshotView.LoadRules lr = new SnapshotView.LoadRules(view, SnapshotView.Components.ALL);
    new UpdateView(view).setLoadRules(lr).update();

    listFiles(view.getViewRoot());

    verifyView(gv, ccenv.getUniqueName() + "/Model/model.h", "#1");
  }
 public AbstractBuild<?, ?> initiateBuild(
     String projectName, boolean recommend, boolean tag, boolean description, boolean fail)
     throws Exception {
   return jenkins.initiateBuild(
       projectName,
       "sibling",
       "_System@" + ccenv.getPVob(),
       "two_int@" + ccenv.getPVob(),
       recommend,
       tag,
       description,
       fail,
       true);
 }
  @Test
  public void basicSibling() throws Exception {

    Stream one = ccenv.context.streams.get("one_int");
    Stream two = ccenv.context.streams.get("two_int");
    one.setDefaultTarget(two);

    /* The baseline that should be built */
    Baseline baseline = ccenv.context.baselines.get("model-1");

    AbstractBuild<?, ?> build =
        initiateBuild("no-options-" + ccenv.getUniqueName(), false, false, false, false);

    /* Validate */
    SystemValidator validator =
        new SystemValidator(build)
            .validateBuild(build.getResult())
            .validateBuiltBaseline(PromotionLevel.BUILT, baseline, false)
            .validateCreatedBaseline(true);
    validator.validate();
  }
  // @Test
  @ClearCaseUniqueVobName(name = "interproject")
  @TestDescription(
      title = "JENKINS-18278",
      text =
          "When the foundation of a Stream has changed, the change set is miscalculated, because -pred selects the foundation baseline of the other Stream - interproject")
  public void jenkins18278() throws Exception {

    Stream source = ccenv.context.streams.get("one_int");
    Stream target = ccenv.context.streams.get("two_int");
    Component component = ccenv.context.components.get("_System");

    /* Create first baseline on int and rebase dev */
    ClearCaseRule.ContentCreator cc_target1 =
        ccenv
            .getContentCreator()
            .setBaselineName("bl-target-1")
            .setFilename("foo.bar")
            .setActivityName("target-act1")
            .setStreamName("two_int")
            .setPostFix("_two_int")
            .setNewElement(true)
            .create();
    new Rebase(source).addBaseline(cc_target1.getBaseline()).rebase(true);

    /* Create first baseline on dev */
    ClearCaseRule.ContentCreator cc_source1 =
        ccenv
            .getContentCreator()
            .setBaselineName("bl-source-1")
            .setFilename("foo.bar")
            .setActivityName("source-act1")
            .create();

    /* Create baselines on int and rebase the last to dev */
    ClearCaseRule.ContentCreator cc_target2 =
        ccenv
            .getContentCreator()
            .setBaselineName("bl-target-2")
            .setFilename("foo.bar")
            .setActivityName("target-act2")
            .setStreamName("two_int")
            .setPostFix("_two_int")
            .create();
    ClearCaseRule.ContentCreator cc_target3 =
        ccenv
            .getContentCreator()
            .setBaselineName("bl-target-3")
            .setFilename("foo.bar")
            .setActivityName("target-act3")
            .setStreamName("two_int")
            .setPostFix("_two_int")
            .create();
    ClearCaseRule.ContentCreator cc_target4 =
        ccenv
            .getContentCreator()
            .setBaselineName("bl-target-4")
            .setFilename("foo.bar")
            .setActivityName("target-act4")
            .setStreamName("two_int")
            .setPostFix("_two_int")
            .create();

    new Rebase(source).addBaseline(cc_target4.getBaseline()).rebase(true);

    /* Create the last baseline on dev */
    ClearCaseRule.ContentCreator cc_source2 =
        ccenv
            .getContentCreator()
            .setBaselineName("bl-source-2")
            .setFilename("foo.bar")
            .setActivityName("source-act2")
            .create();

    /* Create the Jenkins project for the dev stream */
    Project project =
        new CCUCMRule.ProjectCreator(
                "JENKINS-18278-interproject",
                "_System@" + ccenv.getPVob(),
                "one_int@" + ccenv.getPVob())
            .getProject();

    /* I need a first build */
    jenkins.getProjectBuilder(project).build();

    printDiffs(cc_source1.getBaseline(), cc_source2.getBaseline(), cc_source2.getPath());
    printDiffs(cc_target4.getBaseline(), cc_source2.getBaseline(), cc_source2.getPath());

    AbstractBuild build2 = jenkins.getProjectBuilder(project).build();

    printChangeLog(build2);
    FilePath path = null;
    if (SystemUtils.IS_OS_WINDOWS) {
      path =
          new FilePath(
              project.getLastBuiltOn().getWorkspaceFor((FreeStyleProject) project),
              "view/" + ccenv.getUniqueName() + "/Model");
    } else {
      path =
          new FilePath(
              project.getLastBuiltOn().getWorkspaceFor((FreeStyleProject) project),
              "view/vobs/" + ccenv.getUniqueName() + "/Model");
    }
    listPath(path);

    List<Activity> activities =
        Version.getBaselineDiff(
            cc_source1.getBaseline(), cc_source2.getBaseline(), true, cc_source2.getPath());
    new SystemValidator(build2)
        .validateBuild(Result.SUCCESS)
        .addActivitiesToCheck(activities)
        .validate();
  }