use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.
the class H2DatabaseTest method shouldBackupDatabase.
@Test
public void shouldBackupDatabase() throws Exception {
File destDir = new File(".");
SystemEnvironment systemEnvironment = mock(SystemEnvironment.class);
Database database = new H2Database(systemEnvironment);
Database spy = spy(database);
BasicDataSource dataSource = mock(BasicDataSource.class);
Connection connection = mock(Connection.class);
Statement statement = mock(Statement.class);
doReturn(dataSource).when(spy).createDataSource();
when(dataSource.getConnection()).thenReturn(connection);
when(connection.createStatement()).thenReturn(statement);
when(statement.execute(anyString())).thenReturn(true);
spy.backup(destDir);
verify(statement).execute(anyString());
}
use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.
the class ScheduleServiceRescheduleHungJobsTest method activities.
private AgentInstances activities() {
AgentStatusChangeListener agentStatusChangeListener = mock(AgentStatusChangeListener.class);
final AgentInstances activities = new AgentInstances(agentStatusChangeListener);
SystemEnvironment systemEnvironment = new SystemEnvironment();
activities.add(AgentInstance.createFromConfig(new AgentConfig("uuid1"), systemEnvironment, agentStatusChangeListener));
activities.add(AgentInstance.createFromConfig(new AgentConfig("uuid2"), systemEnvironment, agentStatusChangeListener));
return activities;
}
use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.
the class ServerVersionInfoManagerTest method shouldBeFalseIfVersionCheckIsDisabled.
@Test
public void shouldBeFalseIfVersionCheckIsDisabled() {
SystemEnvironment systemEnvironment = mock(SystemEnvironment.class);
when(builder.getServerVersionInfo()).thenReturn(new VersionInfo());
when(systemEnvironment.isProductionMode()).thenReturn(true);
when(systemEnvironment.isGOUpdateCheckEnabled()).thenReturn(false);
manager = new ServerVersionInfoManager(builder, versionInfoDao, new SystemTimeClock(), goCache, systemEnvironment);
manager.initialize();
assertFalse(manager.isUpdateCheckEnabled());
}
use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.
the class ServerVersionInfoManagerTest method updateCheckShouldBeDisabledForADevelopmentServer.
@Test
public void updateCheckShouldBeDisabledForADevelopmentServer() {
SystemEnvironment systemEnvironment = mock(SystemEnvironment.class);
when(builder.getServerVersionInfo()).thenReturn(new VersionInfo());
when(systemEnvironment.isProductionMode()).thenReturn(false);
when(systemEnvironment.isGOUpdateCheckEnabled()).thenReturn(true);
manager = new ServerVersionInfoManager(builder, versionInfoDao, new SystemTimeClock(), goCache, systemEnvironment);
manager.initialize();
assertFalse(manager.isUpdateCheckEnabled());
}
use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.
the class StageNotificationServiceTest method setUp.
@Before
public void setUp() {
pipelineService = mock(PipelineService.class);
userService = mock(UserService.class);
systemEnvironment = mock(SystemEnvironment.class);
stageService = mock(StageService.class);
inMemoryEmailNotificationTopic = new InMemoryEmailNotificationTopic();
serverConfigService = mock(ServerConfigService.class);
shineDao = mock(ShineDao.class);
stageNotificationService = new StageNotificationService(pipelineService, userService, inMemoryEmailNotificationTopic, systemEnvironment, stageService, serverConfigService, shineDao);
stageIdentifier = new StageIdentifier("go", 1, "go-1", "dev", "2");
instanceFactory = new InstanceFactory();
}
Aggregations