Search in sources :

Example 16 with GoVersion

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

the class ServerVersionInfoManagerTest method shouldNotUpdateCacheIfLatestVersionIsLesserThanInstalledVersion.

@Test
public void shouldNotUpdateCacheIfLatestVersionIsLesserThanInstalledVersion() {
    GoVersion currentVersion = new GoVersion("4.7.3-1");
    GoVersion latestVersion = new GoVersion("2.3.4-2");
    VersionInfo versionInfo = new VersionInfo("go_server", currentVersion, latestVersion, null);
    when(builder.getServerVersionInfo()).thenReturn(versionInfo);
    manager.initialize();
    verify(builder).getServerVersionInfo();
    verify(goCache, never()).put(anyString(), anyString());
}
Also used : VersionInfo(com.thoughtworks.go.domain.VersionInfo) GoVersion(com.thoughtworks.go.domain.GoVersion) Test(org.junit.Test)

Example 17 with GoVersion

use of com.thoughtworks.go.domain.GoVersion 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

GoVersion (com.thoughtworks.go.domain.GoVersion)17 VersionInfo (com.thoughtworks.go.domain.VersionInfo)14 Test (org.junit.Test)13 Date (java.util.Date)9 SystemTimeClock (com.thoughtworks.go.util.SystemTimeClock)3 VersionFormatException (com.thoughtworks.go.domain.exception.VersionFormatException)1 DateTime (org.joda.time.DateTime)1