use of org.fakekoji.functional.Tuple in project jenkins-scm-koji-plugin by judovana.
the class PlatformBumperTest method bumpJDKProjectJobsWithMatchTestOnly.
@Test
public void bumpJDKProjectJobsWithMatchTestOnly() {
final Platform from = DataGenerator.getRHEL7x64();
final Platform to = DataGenerator.getF29x64();
final Set<Job> jobs = DataGenerator.getJDKProjectJobs();
final PlatformBumper bumper = new PlatformBumper(settings, from, to, PlatformBumpVariant.TEST_ONLY, Optional.empty());
final Set<Tuple<Job, Optional<Job>>> tuples = jobs.stream().map(bumper.getTransformFunction()).collect(Collectors.toSet());
Assert.assertEquals(2, tuples.stream().filter(tuple -> tuple.y.isPresent()).count());
Assert.assertTrue(tuples.stream().allMatch(tuple -> {
if (tuple.x instanceof TestJob) {
// is test job
final TestJob testJob = (TestJob) tuple.x;
if (!tuple.y.isPresent()) {
// if job is not bumped, then its platform should not be equal to 'from' platform
return !testJob.getPlatform().equals(from);
}
final TestJob bumped = (TestJob) tuple.y.get();
// bumped job's platform should equal to 'to' platform
return bumped.getPlatform().equals(to);
}
// if is not test job, should not be bumped
return !tuple.y.isPresent();
}));
}
use of org.fakekoji.functional.Tuple in project jenkins-scm-koji-plugin by judovana.
the class PlatformBumperTest method bumpJDKProjectJobsWithMatch.
@Test
public void bumpJDKProjectJobsWithMatch() {
final Platform from = DataGenerator.getRHEL7x64();
final Platform to = DataGenerator.getF29x64();
final Set<Job> jobs = DataGenerator.getJDKProjectJobs();
final PlatformBumper bumper = new PlatformBumper(settings, from, to, PlatformBumpVariant.BOTH, Optional.empty());
final Set<Tuple<Job, Optional<Job>>> tuples = jobs.stream().map(bumper.getTransformFunction()).collect(Collectors.toSet());
Assert.assertEquals(4, tuples.stream().filter(tuple -> tuple.y.isPresent()).count());
Assert.assertTrue(tuples.stream().allMatch(isOk(from, to)));
}
use of org.fakekoji.functional.Tuple in project jenkins-scm-koji-plugin by judovana.
the class PlatformBumperTest method bumpJDKTestProjectJobsWithSomeMatchingFitlered.
@Test
public void bumpJDKTestProjectJobsWithSomeMatchingFitlered() {
final Platform from = DataGenerator.getF29x64();
final Platform to = DataGenerator.getRHEL7x64();
final Set<Job> jobs = DataGenerator.getJDKTestProjectJobs();
final PlatformBumper bumper = new PlatformBumper(settings, from, to, PlatformBumpVariant.BOTH, Optional.of(Pattern.compile(".*wayland.*")));
final Set<Tuple<Job, Optional<Job>>> tuples = jobs.stream().map(bumper.getTransformFunction()).collect(Collectors.toSet());
Assert.assertEquals(1, tuples.stream().filter(tuple -> tuple.y.isPresent()).count());
Assert.assertFalse(tuples.stream().allMatch(isOk(from, to)));
}
use of org.fakekoji.functional.Tuple in project jenkins-scm-koji-plugin by judovana.
the class PlatformBumperTest method bumpJDKProjectJobsWithoutMatch.
@Test
public void bumpJDKProjectJobsWithoutMatch() {
final Set<Job> jobs = DataGenerator.getJDKProjectJobs();
final PlatformBumper bumper = new PlatformBumper(settings, DataGenerator.getF29x64(), DataGenerator.getRHEL7x64(), PlatformBumpVariant.BOTH, Optional.empty());
final Set<Tuple<Job, Optional<Job>>> tuples = jobs.stream().map(bumper.getTransformFunction()).collect(Collectors.toSet());
Assert.assertEquals(0, tuples.stream().filter(tuple -> tuple.y.isPresent()).count());
Assert.assertEquals(jobs, tuples.stream().map(tuple -> tuple.y.orElse(tuple.x)).collect(Collectors.toSet()));
}
use of org.fakekoji.functional.Tuple in project jenkins-scm-koji-plugin by judovana.
the class ProductBumperTest method bumpJDKTestProjectJobsWithoutMatch.
@Test
public void bumpJDKTestProjectJobsWithoutMatch() {
final String fromPackage = DataGenerator.getJDK11Product().getPackageName();
final String toPackage = DataGenerator.getJDK8Product().getPackageName();
final JDKVersion fromJDKVersion = DataGenerator.getJDKVersion11();
final JDKVersion toJDKVersion = DataGenerator.getJDKVersion8();
final Set<Job> jobs = DataGenerator.getJDKTestProjectJobs();
final ProductBumper bumper = new ProductBumper(settings, fromPackage, toPackage, fromJDKVersion, toJDKVersion);
final Set<Tuple<Job, Optional<Job>>> tuples = jobs.stream().map(bumper.getTransformFunction()).collect(Collectors.toSet());
Assert.assertEquals(0, tuples.stream().filter(tuple -> tuple.y.isPresent()).count());
Assert.assertEquals(jobs, tuples.stream().map(tuple -> tuple.y.orElse(tuple.x)).collect(Collectors.toSet()));
}
Aggregations