use of com.thoughtworks.go.server.transaction.TransactionTemplate in project gocd by gocd.
the class PipelineTimelineTest method setUp.
@BeforeEach
public void setUp() throws Exception {
now = new DateTime();
pipelineRepository = mock(PipelineRepository.class);
materials = Arrays.asList("first", "second", "third", "fourth");
first = PipelineMaterialModificationMother.modification(1, materials, Arrays.asList(now, now.plusMinutes(1), now.plusMinutes(2), now.plusMinutes(3)), 1, "111", "pipeline");
second = PipelineMaterialModificationMother.modification(2, materials, Arrays.asList(now, now.plusMinutes(2), now.plusMinutes(1), now.plusMinutes(2)), 2, "222", "pipeline");
third = PipelineMaterialModificationMother.modification(3, materials, Arrays.asList(now, now.plusMinutes(2), now.plusMinutes(1), now.plusMinutes(3)), 3, "333", "pipeline");
fourth = PipelineMaterialModificationMother.modification(4, materials, Arrays.asList(now, now.plusMinutes(2), now.plusMinutes(3), now.plusMinutes(2)), 4, "444", "pipeline");
pipelineName = "pipeline";
transactionTemplate = mock(TransactionTemplate.class);
transactionSynchronizationManager = mock(TransactionSynchronizationManager.class);
}
use of com.thoughtworks.go.server.transaction.TransactionTemplate in project gocd by gocd.
the class PipelineSqlMapDaoCachingTest method setup.
@BeforeEach
void setup() throws Exception {
transactionSynchronizationManager = mock(TransactionSynchronizationManager.class);
goCache = new StubGoCache(new TestTransactionSynchronizationManager());
goCache.clear();
mockTemplate = mock(SqlMapClientTemplate.class);
repository = mock(MaterialRepository.class);
environmentVariableDao = mock(EnvironmentVariableDao.class);
SessionFactory mockSessionFactory = mock(SessionFactory.class);
repository = mock(MaterialRepository.class);
transactionTemplate = mock(TransactionTemplate.class);
GoConfigDao configFileDao = mock(GoConfigDao.class);
timeProvider = mock(TimeProvider.class);
pipelineDao = new PipelineSqlMapDao(null, repository, goCache, environmentVariableDao, transactionTemplate, null, transactionSynchronizationManager, null, configFileDao, mock(Database.class), timeProvider);
pipelineDao.setSqlMapClientTemplate(mockTemplate);
Session session = mock(Session.class);
when(mockSessionFactory.getCurrentSession()).thenReturn(session);
when(configFileDao.load()).thenReturn(GoConfigMother.defaultCruiseConfig());
}
use of com.thoughtworks.go.server.transaction.TransactionTemplate in project gocd by gocd.
the class PipelineStateDaoCachingTest method setup.
@BeforeEach
public void setup() throws Exception {
transactionSynchronizationManager = mock(TransactionSynchronizationManager.class);
goCache = new StubGoCache(new TestTransactionSynchronizationManager());
goCache.clear();
mockTemplate = mock(SqlMapClientTemplate.class);
mockSessionFactory = mock(SessionFactory.class);
transactionTemplate = mock(TransactionTemplate.class);
configFileDao = mock(GoConfigDao.class);
pipelineStateDao = new PipelineStateDao(goCache, transactionTemplate, null, transactionSynchronizationManager, null, mock(Database.class), mockSessionFactory);
pipelineStateDao.setSqlMapClientTemplate(mockTemplate);
session = mock(Session.class);
when(mockSessionFactory.getCurrentSession()).thenReturn(session);
when(configFileDao.load()).thenReturn(GoConfigMother.defaultCruiseConfig());
}
use of com.thoughtworks.go.server.transaction.TransactionTemplate in project gocd by gocd.
the class PipelineServiceTriangleDependencyTest method setUp.
@BeforeEach
public void setUp() throws Exception {
pipelineTimeline = mock(PipelineTimeline.class);
pipelineDao = mock(PipelineSqlMapDao.class);
materialRepository = mock(MaterialRepository.class);
TestTransactionSynchronizationManager mockTransactionSynchronizationManager = new TestTransactionSynchronizationManager();
TransactionTemplate mockTransactionTemplate = new TestTransactionTemplate(mockTransactionSynchronizationManager);
service = new PipelineService(pipelineDao, mock(StageService.class), mock(PipelineLockService.class), pipelineTimeline, materialRepository, mockTransactionTemplate, systemEnvironment, null, materialConfigConverter);
first = oneModifiedFile("1");
third = oneModifiedFile("3");
second = oneModifiedFile("2");
first.setId(1);
third.setId(3);
second.setId(2);
notifier.disableUpdates();
}
use of com.thoughtworks.go.server.transaction.TransactionTemplate in project gocd by gocd.
the class PipelineStateDaoTest method setup.
@BeforeEach
void setup() {
goCache = new StubGoCache(new TestTransactionSynchronizationManager());
goCache.clear();
mockSessionFactory = mock(SessionFactory.class);
transactionTemplate = mock(TransactionTemplate.class);
pipelineStateDao = new PipelineStateDao(goCache, transactionTemplate, null, null, null, mock(Database.class), mockSessionFactory);
session = mock(Session.class);
when(mockSessionFactory.getCurrentSession()).thenReturn(session);
}
Aggregations