Search in sources :

Example 21 with VersionInfo

use of com.thoughtworks.go.domain.VersionInfo in project gocd by gocd.

the class ServerVersionInfoManagerTest method shouldBeTrueIfVersionCheckEnabledOnProductionServer.

@Test
public void shouldBeTrueIfVersionCheckEnabledOnProductionServer() {
    SystemEnvironment systemEnvironment = mock(SystemEnvironment.class);
    when(builder.getServerVersionInfo()).thenReturn(new VersionInfo());
    when(systemEnvironment.isGOUpdateCheckEnabled()).thenReturn(true);
    when(systemEnvironment.isProductionMode()).thenReturn(true);
    manager = new ServerVersionInfoManager(builder, versionInfoDao, new SystemTimeClock(), goCache, systemEnvironment);
    manager.initialize();
    assertTrue(manager.isUpdateCheckEnabled());
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) VersionInfo(com.thoughtworks.go.domain.VersionInfo) SystemTimeClock(com.thoughtworks.go.util.SystemTimeClock) Test(org.junit.Test)

Example 22 with VersionInfo

use of com.thoughtworks.go.domain.VersionInfo in project gocd by gocd.

the class ServerVersionInfoManagerTest method shouldUpdateCacheWithNewVersionIfLatestVersionIsGreaterThanInstalledVersion.

@Test
public void shouldUpdateCacheWithNewVersionIfLatestVersionIsGreaterThanInstalledVersion() {
    SystemTimeClock systemTimeClock = mock(SystemTimeClock.class);
    VersionInfo versionInfo = new VersionInfo("go_server", new GoVersion("1.2.3-1"), new GoVersion("1.2.3-1"), null);
    Date now = new Date();
    when(builder.getServerVersionInfo()).thenReturn(versionInfo);
    when(systemTimeClock.currentTime()).thenReturn(now);
    manager = new ServerVersionInfoManager(builder, versionInfoDao, systemTimeClock, goCache, systemEnvironment);
    manager.initialize();
    manager.updateLatestVersion("15.0.1-123");
    verify(goCache).put("GOUpdate", "15.0.1-123");
}
Also used : VersionInfo(com.thoughtworks.go.domain.VersionInfo) SystemTimeClock(com.thoughtworks.go.util.SystemTimeClock) GoVersion(com.thoughtworks.go.domain.GoVersion) Date(java.util.Date) Test(org.junit.Test)

Aggregations

VersionInfo (com.thoughtworks.go.domain.VersionInfo)22 Test (org.junit.Test)21 GoVersion (com.thoughtworks.go.domain.GoVersion)14 Date (java.util.Date)8 SystemTimeClock (com.thoughtworks.go.util.SystemTimeClock)6 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)3 DateTime (org.joda.time.DateTime)1