Ejemplo n.º 1
0
 @Override
 public Revision oldestRevision(Modifications modifications) {
   if (modifications.isEmpty()) {
     return new NullRevision();
   }
   Modification modification = modifications.get(modifications.size() - 1);
   return new PluggableSCMMaterialRevision(
       modification.getRevision(), modification.getModifiedTime());
 }
Ejemplo n.º 2
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());
 }
Ejemplo n.º 3
0
  @Test
  public void shouldDelegateToMaterialRepository_getModificationsFor() {
    GitMaterialConfig materialConfig = new GitMaterialConfig("http://test.com");
    GitMaterialInstance gitMaterialInstance =
        new GitMaterialInstance("http://test.com", null, null, "flyweight");
    Pagination pagination = Pagination.pageStartingAt(0, 10, 10);
    Modifications modifications = new Modifications();
    modifications.add(new Modification("user", "comment", "email", new Date(), "revision"));

    when(materialRepository.findMaterialInstance(materialConfig)).thenReturn(gitMaterialInstance);

    when(materialRepository.getModificationsFor(gitMaterialInstance, pagination))
        .thenReturn(modifications);

    Modifications gotModifications =
        materialService.getModificationsFor(materialConfig, pagination);

    assertThat(gotModifications, is(modifications));
  }