use of com.thoughtworks.go.domain.VersionInfo in project gocd by gocd.
the class ServerVersionInfoBuilderTest method shouldGetVersionInfoForGOServerIfExists.
@Test
public void shouldGetVersionInfoForGOServerIfExists() {
VersionInfo goVersionInfo = new VersionInfo("go_server", new GoVersion("1.2.3-1"));
when(versionInfoDao.findByComponentName("go_server")).thenReturn(goVersionInfo);
when(serverVersion.version()).thenReturn("1.2.3-1");
VersionInfo versionInfo = builder.getServerVersionInfo();
assertThat(versionInfo.getComponentName(), is(goVersionInfo.getComponentName()));
assertThat(versionInfo.getInstalledVersion(), is(goVersionInfo.getInstalledVersion()));
}
use of com.thoughtworks.go.domain.VersionInfo in project gocd by gocd.
the class ServerVersionInfoBuilderTest method shouldNotCreateAVersionInfoOnDevelopmentServer.
@Test
public void shouldNotCreateAVersionInfoOnDevelopmentServer() {
when(versionInfoDao.findByComponentName("go_server")).thenReturn(null);
when(serverVersion.version()).thenReturn("N/A");
VersionInfo versionInfo = builder.getServerVersionInfo();
verify(versionInfoDao, never()).saveOrUpdate(isA(VersionInfo.class));
assertNull(versionInfo);
}
use of com.thoughtworks.go.domain.VersionInfo in project gocd by gocd.
the class ServerVersionInfoManagerTest method shouldBeAbleToUpdateTheLatestGOVersion.
@Test
public void shouldBeAbleToUpdateTheLatestGOVersion() {
SystemTimeClock systemTimeClock = mock(SystemTimeClock.class);
VersionInfo versionInfo = new VersionInfo("go_server", new GoVersion("1.2.3-1"), new GoVersion("2.3.4-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();
VersionInfo info = manager.updateLatestVersion("15.0.1-123");
assertThat(info.getLatestVersion().toString(), is("15.0.1-123"));
assertThat(info.getLatestVersionUpdatedAt(), is(now));
verify(versionInfoDao).saveOrUpdate(versionInfo);
}
use of com.thoughtworks.go.domain.VersionInfo in project gocd by gocd.
the class ServerVersionInfoManagerTest method shouldNotReturnVersionInfoIfLatestVersionUpdatedToday.
@Test
public void shouldNotReturnVersionInfoIfLatestVersionUpdatedToday() {
Date today = new Date();
VersionInfo versionInfo = new VersionInfo("go_server", new GoVersion("1.2.3-1"), new GoVersion("2.3.4-2"), today);
when(builder.getServerVersionInfo()).thenReturn(versionInfo);
manager.initialize();
VersionInfo serverVersionInfo = manager.versionInfoForUpdate();
assertNull(serverVersionInfo);
}
use of com.thoughtworks.go.domain.VersionInfo 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());
}
Aggregations