@LocalData
  public void testDontCopyExcessFilesWhenOtherFilesEmpty() throws Exception {
    Hudson hudson = Hudson.getInstance();
    List<Project> projects = hudson.getProjects();
    Project testProject = null;
    for (Project project : projects) {
      if (project.getName().equals("dont-copy")) testProject = project;
    }
    if (testProject == null) fail("Couldn't find example project");
    Future<Run> run = testProject.scheduleBuild2(0);

    while (!run.isDone()) {
      Thread.sleep(5);
    }

    Run lastBuild = testProject.getLastBuild();
    assertTrue("Build wasn't a success", lastBuild.getResult() == Result.SUCCESS);

    File storedOutput =
        new File(lastBuild.getRootDir(), RobotPublisher.FILE_ARCHIVE_DIR + "/output.xml");
    File storedSplitOutput =
        new File(lastBuild.getRootDir(), RobotPublisher.FILE_ARCHIVE_DIR + "/output-001.xml");
    File storedDummy =
        new File(lastBuild.getRootDir(), RobotPublisher.FILE_ARCHIVE_DIR + "/dummy.file");

    assertTrue("output.xml was not stored", storedOutput.exists());
    assertTrue("output-001.xml was not stored", storedSplitOutput.exists());
    assertFalse("dummy.file was copied", storedDummy.exists());
  }
 private Project mockProject(String url) {
   Project project = PowerMockito.mock(Project.class);
   GitSCM gitSCM = PowerMockito.mock(GitSCM.class);
   UserRemoteConfig userRemoteConfig = PowerMockito.mock(UserRemoteConfig.class);
   List<UserRemoteConfig> userRemoteConfigs = Arrays.asList(userRemoteConfig);
   PowerMockito.when(project.getScm()).thenReturn(gitSCM);
   PowerMockito.when(gitSCM.getUserRemoteConfigs()).thenReturn(userRemoteConfigs);
   PowerMockito.when(userRemoteConfig.getUrl()).thenReturn(url);
   return project;
 }
  @LocalData
  public void testPublish() throws Exception {
    Hudson hudson = Hudson.getInstance();
    List<Project> projects = hudson.getProjects();
    Project testProject = null;
    for (Project project : projects) {
      if (project.getName().equals("robot")) testProject = project;
    }
    if (testProject == null) fail("Couldn't find example project");
    Future<Run> run = testProject.scheduleBuild2(0);

    while (!run.isDone()) {
      Thread.sleep(5);
    }

    Run lastBuild = testProject.getLastBuild();
    assertTrue("Build wasn't a success", lastBuild.getResult() == Result.SUCCESS);

    File storedOutput =
        new File(lastBuild.getRootDir(), RobotPublisher.FILE_ARCHIVE_DIR + "/output.xml");
    File storedSplitOutput =
        new File(lastBuild.getRootDir(), RobotPublisher.FILE_ARCHIVE_DIR + "/output-001.xml");
    File storedReport =
        new File(lastBuild.getRootDir(), RobotPublisher.FILE_ARCHIVE_DIR + "/report.html");
    File storedSplitReport =
        new File(lastBuild.getRootDir(), RobotPublisher.FILE_ARCHIVE_DIR + "/report.html");
    File storedLog =
        new File(lastBuild.getRootDir(), RobotPublisher.FILE_ARCHIVE_DIR + "/log.html");
    File storedSplitLog =
        new File(lastBuild.getRootDir(), RobotPublisher.FILE_ARCHIVE_DIR + "/log-001.html");
    File storedJs = new File(lastBuild.getRootDir(), RobotPublisher.FILE_ARCHIVE_DIR + "/log.js");
    File storedSplitJs1 =
        new File(lastBuild.getRootDir(), RobotPublisher.FILE_ARCHIVE_DIR + "/log-001.js");
    File storedImage1 =
        new File(lastBuild.getRootDir(), RobotPublisher.FILE_ARCHIVE_DIR + "/screenshot.png");
    File storedImage2 =
        new File(
            lastBuild.getRootDir(), RobotPublisher.FILE_ARCHIVE_DIR + "/subfolder/screenshot2.png");
    File storedDummy =
        new File(lastBuild.getRootDir(), RobotPublisher.FILE_ARCHIVE_DIR + "dummy.file");

    assertTrue("output.xml was not stored", storedOutput.exists());
    assertTrue("output-001.xml was not stored", storedSplitOutput.exists());
    assertTrue("report.html was not stored", storedReport.exists());
    assertTrue("report-001.html was not stored", storedSplitReport.exists());
    assertTrue("log.html was not stored", storedLog.exists());
    assertTrue("log-001.html was not stored", storedSplitLog.exists());
    assertTrue("log.js was not stored", storedJs.exists());
    assertTrue("log-001.js was not stored", storedSplitJs1.exists());
    assertTrue("screenshot.png was not stored", storedImage1.exists());
    assertTrue("screenshot2.png was not stored", storedImage2.exists());
    assertFalse("dummy.file was copied", storedDummy.exists());
  }
 /**
  * Tests with no extensions.
  *
  * @throws IOException IOException
  * @throws InterruptedException InterruptedException
  * @throws ExecutionException ExecutionException
  */
 public void testNoRebuildValidatorExtension()
     throws IOException, InterruptedException, ExecutionException {
   Project projectA = createFreeStyleProject("testFreeStyleA");
   Build buildA =
       (Build)
           projectA
               .scheduleBuild2(
                   0,
                   new Cause.UserIdCause(),
                   new ParametersAction(new StringParameterValue("party", "megaparty")))
               .get();
   assertNotNull(buildA.getAction(RebuildAction.class));
 }
  /**
   * Helper method to determine the template from a given item.
   *
   * @param item Item which includes a template.
   * @return If the item includes a template then the template will be returned. Otherwise <code>
   *     null</code>.
   */
  private DockerJobTemplateProperty getJobTemplate(Item item) {
    if (item.task instanceof Project) {
      Project<?, ?> project = (Project<?, ?>) item.task;
      if (project != null) {
        DockerJobProperty property = project.getProperty(DockerJobProperty.class);
        if (property != null) {
          return property.getDockerJobTemplate();
        }
      }
    }

    return null;
  }
  @Test
  public void testNotGrantedBuildWhenNotUsingGitSCM() throws IOException {
    mockGHMyselfAs("Me");
    Project mockProject = PowerMockito.mock(Project.class);
    PowerMockito.when(mockProject.getScm()).thenReturn(new NullSCM());

    GithubRequireOrganizationMembershipACL acl = aclForProject(mockProject);

    GithubAuthenticationToken authenticationToken =
        new GithubAuthenticationToken("accessToken", "https://api.github.com");

    assertFalse(acl.hasPermission(authenticationToken, Item.READ));
  }
  @Before
  public void setUp() throws Exception {
    java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit")
        .setLevel(java.util.logging.Level.SEVERE);

    j.jenkins.setAuthorizationStrategy(new FullControlOnceLoggedInAuthorizationStrategy());
    j.jenkins.setSecurityRealm(j.createDummySecurityRealm());

    createKnowledgeBase();
    project = j.createFreeStyleProject("x");
    project.getBuildersList().add(new FailureBuilder());
    project.getPublishersList().add(new ClaimPublisher());
    build = project.scheduleBuild2(0).get();
  }
 /**
  * Tests with an extension returning isApplicable false.
  *
  * @throws IOException IOException
  * @throws InterruptedException InterruptedException
  * @throws ExecutionException ExecutionException
  */
 public void testRebuildValidatorExtensionIsApplicableFalse()
     throws IOException, InterruptedException, ExecutionException {
   hudson.getExtensionList(RebuildValidator.class).add(0, new ValidatorNeverApplicable());
   Project projectA = createFreeStyleProject("testFreeStyleC");
   Build buildA =
       (Build)
           projectA
               .scheduleBuild2(
                   0,
                   new Cause.UserIdCause(),
                   new ParametersAction(new StringParameterValue("party", "megaparty")))
               .get();
   assertNotNull(buildA.getAction(RebuildAction.class));
 }
  @Test
  public void testNotGrantedReadWhenRepositoryUrlIsEmpty() throws IOException {
    mockGHMyselfAs("Me");
    Project mockProject = PowerMockito.mock(Project.class);
    PowerMockito.when(mockProject.getScm()).thenReturn(new NullSCM());
    GitSCM gitSCM = PowerMockito.mock(GitSCM.class);
    List<UserRemoteConfig> userRemoteConfigs = Collections.<UserRemoteConfig>emptyList();
    PowerMockito.when(mockProject.getScm()).thenReturn(gitSCM);
    PowerMockito.when(gitSCM.getUserRemoteConfigs()).thenReturn(userRemoteConfigs);

    GithubRequireOrganizationMembershipACL acl = aclForProject(mockProject);

    GithubAuthenticationToken authenticationToken =
        new GithubAuthenticationToken("accessToken", "https://api.github.com");

    assertFalse(acl.hasPermission(authenticationToken, Item.READ));
  }
  @LocalData
  public void testFailedSince() {
    Hudson hudson = Hudson.getInstance();
    List<Project> projects = hudson.getProjects();
    Run lastRun = null;
    for (Project project : projects) {
      if (project.getName().equalsIgnoreCase("failingtests")) {
        lastRun = project.getLastCompletedBuild();
      }
    }
    if (lastRun == null) fail("No build including Robot results was found");

    RobotBuildAction action = lastRun.getAction(RobotBuildAction.class);
    RobotResult result = action.getResult();
    RobotCaseResult firstFailed = result.getAllFailedCases().get(0);
    assertEquals(2, firstFailed.getFailedSince());
  }
Пример #11
0
  /**
   * Get the configured instance for the plugin.
   *
   * @param project
   * @return
   */
  public static NeoLoadPluginOptions getPluginOptions(final AbstractProject<?, ?> project) {
    final Project<?, ?> proj;
    NeoBuildAction nba = null;
    if (!(project instanceof Project)) {
      return null;
    }
    proj = (Project<?, ?>) project;
    final List<Builder> builders = proj.getBuilders();
    for (final Builder b : builders) {
      if (b instanceof NeoBuildAction) {
        nba = (NeoBuildAction) b;
        break;
      }
    }

    return (NeoLoadPluginOptions) nba;
  }
  @LocalData
  public void testMissingReportFileWithOld() throws Exception {
    Hudson hudson = Hudson.getInstance();
    List<Project> projects = hudson.getProjects();
    Project testProject = null;
    for (Project project : projects) {
      if (project.getName().equals("oldrobotbuild")) testProject = project;
    }
    if (testProject == null) fail("Couldn't find example project");

    WebClient wc = getWebClient();

    File buildRoot = testProject.getLastBuild().getRootDir();
    File robotHtmlReport = new File(buildRoot, RobotPublisher.FILE_ARCHIVE_DIR + "/report.html");
    if (!robotHtmlReport.delete()) fail("Unable to delete report directory");

    HtmlPage page = wc.goTo("job/oldrobotbuild/robot/");
    WebAssert.assertTextPresent(page, "No Robot html report found!");

    page = wc.goTo("job/oldrobotbuild/1/robot/");
    WebAssert.assertTextPresent(page, "No Robot html report found!");
  }
Пример #13
0
 @Override
 public void onRenamed(Item item, String oldName, String newName) {
   // update DownstreamTrigger of other projects that point to this object.
   // can't we generalize this?
   for (Project<?, ?> p : Hudson.getInstance().getProjects()) {
     DownstreamTrigger t = p.getPublishersList().get(DownstreamTrigger.class);
     if (t != null) {
       if (t.onJobRenamed(oldName, newName)) {
         try {
           p.save();
         } catch (IOException e) {
           LOGGER.log(
               Level.WARNING,
               "Failed to persist project setting during rename from "
                   + oldName
                   + " to "
                   + newName,
               e);
         }
       }
     }
   }
 }
  @Test
  public void test() throws IOException {
    Project project = r.createFreeStyleProject("project");

    project.addProperty(
        new ParametersDefinitionProperty(
            new StringParameterDefinition("key1", "value1"),
            new StringParameterDefinition("key2", "value2")));

    ParametersAction action =
        new ParametersAction(
            new StringParameterValue("key2", "not-value2"),
            new StringParameterValue("key3", "value3"));

    DefaultParameterValuesActionsTransform transform = new DefaultParameterValuesActionsTransform();

    ParametersAction result = transform.transformParametersAction(action, project);

    assertEquals(3, result.getParameters().size());

    assertStringParameterValueEquals("value1", result.getParameter("key1"));
    assertStringParameterValueEquals("not-value2", result.getParameter("key2"));
    assertStringParameterValueEquals("value3", result.getParameter("key3"));
  }
  public void test() throws Exception {
    Project<?, ?> projectA = createFreeStyleProject("projectA");
    List<AbstractBuildParameters> buildParameters = new ArrayList<AbstractBuildParameters>();
    buildParameters.add(new CurrentBuildParameters());
    BlockingBehaviour neverFail = new BlockingBehaviour("never", "never", "never");
    BlockableBuildTriggerConfig config =
        new BlockableBuildTriggerConfig("projectB", neverFail, buildParameters);
    projectA.getBuildersList().add(new TriggerBuilder(config));

    CaptureEnvironmentBuilder builder = new CaptureEnvironmentBuilder();
    projectA.getBuildersList().add(builder);

    Project projectB = createFreeStyleProject("projectB");
    projectB.setQuietPeriod(0);
    hudson.rebuildDependencyGraph();

    // Just to make sure they differ from projectA's build numbers.
    projectB.updateNextBuildNumber(3);

    int expectedBuildNumber = projectB.getNextBuildNumber();
    projectA.scheduleBuild2(0, new UserCause()).get();

    EnvVars envVars = builder.getEnvVars();
    assertThat(envVars, notNullValue());
    assertThat(envVars, hasEntry("LAST_TRIGGERED_JOB_NAME", "projectB"));
    assertThat(
        envVars,
        hasEntry("TRIGGERED_BUILD_NUMBER_projectB", Integer.toString(expectedBuildNumber)));

    // The below test for expectedBuildNumber is meaningless if the
    // value doesn't update, though it should always update.
    assertThat(projectB.getNextBuildNumber(), is(not(expectedBuildNumber)));

    expectedBuildNumber = projectB.getNextBuildNumber();
    projectA.scheduleBuild2(0, new UserCause()).get();
    envVars = builder.getEnvVars();

    assertThat(envVars, notNullValue());
    assertThat(envVars, hasEntry("LAST_TRIGGERED_JOB_NAME", "projectB"));
    assertThat(
        envVars,
        hasEntry("TRIGGERED_BUILD_NUMBER_projectB", Integer.toString(expectedBuildNumber)));
  }
  // Called for each page load of administration
  public void load() {

    /* In case plugin is uncheck */
    // List all jobs
    List<String> allJobsName = new ArrayList<String>();

    // List all the jobs that use the plugin (with at least one resource)
    List<String> allExclusionJobs = new ArrayList<String>();

    // Check all projects
    for (Project<?, ?> p : Hudson.getInstance().getProjects()) {

      // Add all jobs names to the list
      allJobsName.add(p.getName());
      // We want to retrieve all components BuildWrappers
      Map<Descriptor<BuildWrapper>, BuildWrapper> buildWrappers = p.getBuildWrappers();
      // For each of them
      for (Iterator i = buildWrappers.keySet().iterator(); i.hasNext(); ) {
        Descriptor<BuildWrapper> key = (Descriptor<BuildWrapper>) i.next();

        // We check if the descriptor is "org.jvnet.hudson.plugins.exclusion.IdAllocator $
        // DescriptorImpl"
        if (buildWrappers
            .get(key)
            .getDescriptor()
            .toString()
            .split("@")[0]
            .equals("org.jvnet.hudson.plugins.exclusion.IdAllocator$DescriptorImpl")) {
          // No duplicates
          if (!allExclusionJobs.contains(p.getName())) {
            allExclusionJobs.add(p.getName());
          }
        }
      }
    }

    // We delete each job that is in the global list and not in the list of exclusions
    for (String jobName : allJobsName) {
      if (!allExclusionJobs.contains(jobName)) {
        IdAllocator.deleteList(jobName);
      }
    }

    // Set all builds to false (build = currently used)
    for (RessourcesMonitor rm : listRessources) {
      rm.setBuild(false);
    }

    // For each resource Job, set build to true if a resource is used
    for (Iterator i = IdAllocationManager.ids.keySet().iterator(); i.hasNext(); ) {
      String resource = (String) i.next();
      IdAllocator.updateBuild(
          IdAllocationManager.ids.get(resource).getProject().getName(), resource, true);
    }

    list = new ArrayList<RessourcesMonitor>();
    // Local copy of the list
    for (RessourcesMonitor rm : listRessources) {
      list.add(new RessourcesMonitor(rm.getJobName(), rm.getRessource(), rm.getBuild()));
    }
  }
  @LocalData
  public void testSummariesWithData() throws Exception {
    Hudson hudson = Hudson.getInstance();
    List<Project> projects = hudson.getProjects();
    Project testProject = null;
    for (Project project : projects) {
      if (project.getName().equals("robot")) testProject = project;
    }
    if (testProject == null) fail("Couldn't find example project");
    Future<Run> run = testProject.scheduleBuild2(0);

    while (!run.isDone()) {
      Thread.sleep(5);
    }

    Run lastBuild = testProject.getLastBuild();
    assertTrue("Build wasn't a success", lastBuild.getResult() == Result.SUCCESS);

    WebClient wc = getWebClient();

    HtmlPage page = wc.goTo("job/robot/");
    WebAssert.assertElementPresentByXPath(
        page, "//div[@id='navigation']//a[@href='/job/robot/robot']");
    WebAssert.assertElementPresentByXPath(
        page, "//td[@id='main-panel']//h4[contains(.,'Latest Robot Results:')]");
    WebAssert.assertElementPresentByXPath(page, "//td[@id='main-panel']//img[@src='robot/graph']");
    WebAssert.assertElementPresentByXPath(
        page,
        "//td[@id='main-panel']//a[@href='/job/robot/1/robot' and contains(text(),'Browse results')]");
    WebAssert.assertElementPresentByXPath(
        page,
        "//td[@id='main-panel']//a[@href='/job/robot/1/robot/report/report.html' and contains(text(), 'Open report.html')]");
    WebAssert.assertElementPresentByXPath(
        page,
        "//td[@id='main-panel']//a[@href='/job/robot/1/robot/report/log.html' and contains(text(), 'Open log.html')]");

    HtmlTable table = page.getHtmlElementById("robot-summary-table");
    Assert.assertTrue(
        table
            .asXml()
            .replaceAll("\\s", "")
            .contains(
                "<tableclass=\"table\"id=\"robot-summary-table\"><tbodyalign=\"left\"><tr><th/><th>Total</th><th>Failed</th><th>Passed</th><th>Pass%</th></tr><tr><th>Criticaltests</th><tdclass=\"table-upper-row\"style=\"border-left:0px;\">8</td><tdclass=\"table-upper-row\"><spanclass=\"fail\">4</span></td><tdclass=\"table-upper-row\">4</td><tdclass=\"table-upper-row\">50.0</td></tr><tr><th>Alltests</th><tdstyle=\"border-left:0px;\">8</td><td><spanclass=\"fail\">4</span></td><td>4</td><td>50.0</td></tr></tbody></table>"));

    page = wc.goTo("job/robot/1/");
    WebAssert.assertElementPresentByXPath(
        page, "//div[@id='navigation']//a[@href='/job/robot/1/robot']");
    WebAssert.assertElementPresentByXPath(
        page, "//td[@id='main-panel']//h4[contains(.,'Robot Test Summary:')]");
    WebAssert.assertElementPresentByXPath(
        page,
        "//td[@id='main-panel']//a[@href='/job/robot/1/robot' and contains(text(),'Browse results')]");
    WebAssert.assertElementPresentByXPath(
        page,
        "//td[@id='main-panel']//a[@href='/job/robot/1/robot/report/report.html' and contains(text(), 'Open report.html')]");
    WebAssert.assertElementPresentByXPath(
        page,
        "//td[@id='main-panel']//a[@href='/job/robot/1/robot/report/log.html' and contains(text(), 'Open log.html')]");
    table = page.getHtmlElementById("robot-summary-table");
    Assert.assertTrue(
        table
            .asXml()
            .replaceAll("\\s", "")
            .contains(
                "<tableclass=\"table\"id=\"robot-summary-table\"><tbodyalign=\"left\"><tr><th/><th>Total</th><th>Failed</th><th>Passed</th><th>Pass%</th></tr><tr><th>Criticaltests</th><tdclass=\"table-upper-row\"style=\"border-left:0px;\">8</td><tdclass=\"table-upper-row\"><spanclass=\"fail\">4</span></td><tdclass=\"table-upper-row\">4</td><tdclass=\"table-upper-row\">50.0</td></tr><tr><th>Alltests</th><tdstyle=\"border-left:0px;\">8</td><td><spanclass=\"fail\">4</span></td><td>4</td><td>50.0</td></tr></tbody></table>"));
  }
  @LocalData
  public void testReportPage() throws Exception {
    Hudson hudson = Hudson.getInstance();
    List<Project> projects = hudson.getProjects();
    Project testProject = null;
    for (Project project : projects) {
      if (project.getName().equals("robot")) testProject = project;
    }
    if (testProject == null) fail("Couldn't find example project");
    Future<Run> run = testProject.scheduleBuild2(0);

    while (!run.isDone()) {
      Thread.sleep(5);
    }
    Run lastBuild = testProject.getLastBuild();
    assertTrue("Build wasn't a success", lastBuild.getResult() == Result.SUCCESS);

    WebClient wc = getWebClient();
    HtmlPage page = wc.goTo("job/robot/robot/");
    WebAssert.assertTextPresent(page, "Robot Framework test results");
    WebAssert.assertTextPresent(page, "4 failed tests, 4 critical");
    WebAssert.assertTextPresent(page, "Tests took 0:00:00.009 (+0:00:00.009)");
    WebAssert.assertElementPresentByXPath(
        page,
        "//td[@id='main-panel']//a[@href='Testcases%20&%20Othercases/Testcases/Not%20equal' and contains(.,'Testcases & Othercases.Testcases.Not equal')]");
    WebAssert.assertElementPresentByXPath(
        page,
        "//td[@id='main-panel']//a[@href='Testcases%20&%20Othercases/Othercases' and contains(.,'Testcases & Othercases.Othercases')]");

    page = wc.goTo("job/robot/1/robot/report/");
    WebAssert.assertElementPresentByXPath(
        page, "//td[@id='main-panel']//a[@href='output.xml' and contains(.,'output.xml')]");

    page = wc.goTo("job/robot/1/robot/Testcases%20&%20Othercases");
    WebAssert.assertTextPresent(page, "4 failed tests, 4 critical");
    WebAssert.assertTextPresent(page, "Tests took 0:00:00.009 (+0:00:00.009)");
    WebAssert.assertTextNotPresent(page, "All Testcases");
    WebAssert.assertElementPresentByXPath(
        page,
        "//td[@id='main-panel']//a[@href='Testcases/Not%20equal' and contains(.,'Testcases.Not equal')]");
    WebAssert.assertElementPresentByXPath(
        page, "//td[@id='main-panel']//a[@href='Othercases' and contains(.,'Othercases')]");

    page = wc.goTo("job/robot/1/robot/Testcases%20&%20Othercases/Othercases");
    WebAssert.assertTextPresent(page, "2 failed tests, 2 critical");
    WebAssert.assertTextPresent(page, "Tests took 0:00:00.005 (+0:00:00.005)");
    WebAssert.assertTextPresent(page, "All Testcases");
    WebAssert.assertElementPresentByXPath(
        page, "//td[@id='main-panel']//a[@href='Not%20equal' and contains(.,'Not equal')]");
    WebAssert.assertElementPresentByXPath(
        page,
        "//td[@id='main-panel']//a[@href='Contains%20string' and contains(.,'Contains string')]");

    page = wc.goTo("job/robot/1/robot/Testcases%20&%20Othercases/Othercases/Not%20equal");
    WebAssert.assertTextPresent(page, "Critical test case: \"Not equal\"");
    WebAssert.assertTextPresent(page, "Failed!");
    WebAssert.assertTextPresent(page, "Error message:");
    WebAssert.assertTextPresent(page, "Hello, world! != Good bye, world!");
    WebAssert.assertTextPresent(page, "Test took 0:00:00.001 (+0:00:00.001)");
    WebAssert.assertElementPresentByXPath(
        page, "//td[@id='main-panel']//img[@src='durationGraph']");

    page = wc.goTo("job/robot/1/robot/Testcases%20&%20Othercases/Othercases/Contains%20string");
    WebAssert.assertTextPresent(page, "Passed!");
    WebAssert.assertTextNotPresent(page, "Error message:");
  }
  // @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();
  }