Ejemplo n.º 1
0
 public List<MaterialRevision> addDependencyRevisionModification(
     List<MaterialRevision> materialRevisions,
     DependencyMaterial dependencyMaterial,
     Pipeline... upstreams) {
   String stageName = CaseInsensitiveString.str(dependencyMaterial.getStageName());
   String label = upstreams[0].getLabel();
   List<Modification> modifications = new ArrayList<Modification>();
   for (Pipeline upstream : upstreams) {
     modifications.add(
         new Modification(
             new Date(),
             DependencyMaterialRevision.create(
                     CaseInsensitiveString.str(dependencyMaterial.getPipelineName()),
                     upstream.getCounter(),
                     label,
                     stageName,
                     upstream.findStage(stageName).getCounter())
                 .getRevision(),
             label,
             upstream.getId()));
   }
   MaterialRevision depRev =
       addRevisionsWithModifications(
           dependencyMaterial, modifications.toArray(new Modification[0]));
   materialRevisions.add(depRev);
   return Arrays.asList(depRev);
 }
 @Test
 public void shouldPublishItselfAsARealRevision() throws Exception {
   assertThat(new StringRevision("foo").isRealRevision(), is(true));
   assertThat(
       DependencyMaterialRevision.create("blahPipeline", 5, "blahLabel", "blahStage", 2)
           .isRealRevision(),
       is(true));
   assertThat(new NullRevision().isRealRevision(), is(false));
   assertThat(PipelineInstanceModel.UNKNOWN_REVISION.isRealRevision(), is(false));
 }
Ejemplo n.º 3
0
 public Revision oldestRevision(Modifications modifications) {
   if (modifications.size() > 1) {
     LOGGER.warn(
         String.format(
             "Dependency material %s has multiple modifications", this.getDisplayName()));
   }
   Modification oldestModification = modifications.get(modifications.size() - 1);
   String revision = oldestModification.getRevision();
   return DependencyMaterialRevision.create(revision, oldestModification.getPipelineLabel());
 }