Search in sources :

Example 11 with ModifiedFile

use of com.thoughtworks.go.domain.materials.ModifiedFile in project gocd by gocd.

the class TransactionCacheInterceptorTest method shouldOptOutOfCacheServing_forNewItemsInCollection.

@Test
public void shouldOptOutOfCacheServing_forNewItemsInCollection() {
    final MaterialInstance materialInstance = savedHg();
    final Modification mod = new Modification("loser", "loser commiting a winner stroke", "foo@bar.com", new Date(), "123");
    mod.setMaterialInstance(materialInstance);
    hibernateDaoSupport.getHibernateTemplate().save(mod);
    ModifiedFile foo_c = mod.createModifiedFile("foo.c", "src", ModifiedAction.added);
    ModifiedFile bar_c = mod.createModifiedFile("bar.c", "src", ModifiedAction.deleted);
    ModifiedFile baz_c = mod.createModifiedFile("baz.c", "src", ModifiedAction.modified);
    assertionUtil.assertCacheBehaviourInTxn(new TransactionCacheAssertionUtil.DoInTxn() {

        @Override
        public void invoke() {
            hibernateDaoSupport.getHibernateTemplate().update(mod);
        }
    });
    assertThat(mod.getId(), greaterThan(0l));
    assertThat(foo_c.getId(), greaterThan(0l));
    assertThat(baz_c.getId(), greaterThan(0l));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) ModifiedFile(com.thoughtworks.go.domain.materials.ModifiedFile) MaterialInstance(com.thoughtworks.go.domain.MaterialInstance) Date(java.util.Date) Test(org.junit.jupiter.api.Test)

Example 12 with ModifiedFile

use of com.thoughtworks.go.domain.materials.ModifiedFile in project gocd by gocd.

the class TfsSDKCommand method getModifiedFiles.

ArrayList<ModifiedFile> getModifiedFiles(Changeset changeset) {
    ArrayList<ModifiedFile> files = new ArrayList<>();
    for (Change change : changeset.getChanges()) {
        ModifiedFile modifiedFile = new ModifiedFile(change.getItem().getServerItem(), "", ModifiedAction.unknown);
        files.add(modifiedFile);
    }
    return files;
}
Also used : ArrayList(java.util.ArrayList) ModifiedFile(com.thoughtworks.go.domain.materials.ModifiedFile)

Aggregations

ModifiedFile (com.thoughtworks.go.domain.materials.ModifiedFile)12 Modification (com.thoughtworks.go.domain.materials.Modification)10 Test (org.junit.jupiter.api.Test)8 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 SAXBuilder (org.jdom2.input.SAXBuilder)3 MaterialInstance (com.thoughtworks.go.domain.MaterialInstance)2 Test (org.junit.Test)2 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)1 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)1 XmlWriterContext (com.thoughtworks.go.domain.XmlWriterContext)1 Modifications (com.thoughtworks.go.domain.materials.Modifications)1 DependencyMaterialRevision (com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)1 GitTestRepo (com.thoughtworks.go.domain.materials.git.GitTestRepo)1 TimeProvider (com.thoughtworks.go.util.TimeProvider)1 ConsoleResult (com.thoughtworks.go.util.command.ConsoleResult)1 Element (org.dom4j.Element)1