use of com.thoughtworks.go.domain.VersionInfo 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.domain.VersionInfo in project gocd by gocd.
the class ServerVersionInfoManagerTest method shouldUseServerVersionInfoBuilderToGetServerVersionInfo.
@Test
public void shouldUseServerVersionInfoBuilderToGetServerVersionInfo() {
when(builder.getServerVersionInfo()).thenReturn(new VersionInfo());
manager.initialize();
verify(builder).getServerVersionInfo();
}
use of com.thoughtworks.go.domain.VersionInfo in project gocd by gocd.
the class ServerVersionInfoManagerTest method shouldNotGetVersionInfoIfLatestVersionIsBeingUpdated.
@Test
public void shouldNotGetVersionInfoIfLatestVersionIsBeingUpdated() {
Date yesterday = new Date(System.currentTimeMillis() - 24 * 60 * 60 * 1000);
VersionInfo versionInfo = new VersionInfo("go_server", new GoVersion("1.2.3-1"), new GoVersion("2.3.4-2"), yesterday);
when(builder.getServerVersionInfo()).thenReturn(versionInfo);
manager.initialize();
VersionInfo serverVersionInfo1 = manager.versionInfoForUpdate();
VersionInfo serverVersionInfo2 = manager.versionInfoForUpdate();
assertNotNull(serverVersionInfo1);
assertNull(serverVersionInfo2);
}
use of com.thoughtworks.go.domain.VersionInfo in project gocd by gocd.
the class ServerVersionInfoManagerTest method shouldGetVersionInfoIflatestVersionIsBeingUpdatedForMoreThanHalfAnHour.
@Test
public void shouldGetVersionInfoIflatestVersionIsBeingUpdatedForMoreThanHalfAnHour() {
SystemTimeClock systemTimeClock = mock(SystemTimeClock.class);
Date yesterday = new Date(System.currentTimeMillis() - 24 * 60 * 60 * 1000);
DateTime halfAnHourFromNow = new DateTime(System.currentTimeMillis() - 35 * 60 * 1000);
VersionInfo versionInfo = new VersionInfo("go_server", new GoVersion("1.2.3-1"), new GoVersion("2.3.4-2"), yesterday);
when(builder.getServerVersionInfo()).thenReturn(versionInfo);
when(systemTimeClock.currentDateTime()).thenReturn(halfAnHourFromNow);
manager = new ServerVersionInfoManager(builder, versionInfoDao, systemTimeClock, goCache, systemEnvironment);
manager.initialize();
VersionInfo serverVersionInfo1 = manager.versionInfoForUpdate();
VersionInfo serverVersionInfo2 = manager.versionInfoForUpdate();
assertNotNull(serverVersionInfo1);
assertNotNull(serverVersionInfo2);
}
use of com.thoughtworks.go.domain.VersionInfo 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());
}
Aggregations