use of com.thoughtworks.go.domain.VersionInfo in project gocd by gocd.
the class ServerVersionInfoManagerTest method shouldAddNewVersionInfoToCacheIfLatestVersionIsGreaterThanInstalledVersion.
@Test
public void shouldAddNewVersionInfoToCacheIfLatestVersionIsGreaterThanInstalledVersion() {
GoVersion currentVersion = new GoVersion("1.2.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).put("GOUpdate", latestVersion.toString());
}
use of com.thoughtworks.go.domain.VersionInfo in project gocd by gocd.
the class ServerVersionInfoBuilder method createVersionInfo.
private VersionInfo createVersionInfo() {
VersionInfo versionInfo = null;
GoVersion installedVersion = installedVersion();
if (installedVersion == null)
return versionInfo;
versionInfo = new VersionInfo(GO_SERVER, installedVersion);
versionInfoDao.saveOrUpdate(versionInfo);
return versionInfo;
}
use of com.thoughtworks.go.domain.VersionInfo in project gocd by gocd.
the class VersionInfoSqlMapDaoIntegrationTest method shouldSaveVersionInfo.
@Test
public void shouldSaveVersionInfo() {
GoVersion installedVersion = new GoVersion("14.1.0-123");
GoVersion latestVersion = new GoVersion("15.1.0-876");
Date now = new Date();
VersionInfo versionInfo = new VersionInfo("GOServer", installedVersion, latestVersion, now);
versionInfoSqlMapDao.saveOrUpdate(versionInfo);
VersionInfo info = versionInfoSqlMapDao.findByComponentName(versionInfo.getComponentName());
assertThat(info.getInstalledVersion().toString(), is(installedVersion.toString()));
assertThat(info.getLatestVersion().toString(), is(latestVersion.toString()));
assertThat(info.getLatestVersionUpdatedAt().compareTo(now), is(0));
}
use of com.thoughtworks.go.domain.VersionInfo in project gocd by gocd.
the class VersionInfoServiceTest method shouldFetchVersionInfoWhichNeedsUpdate.
@Test
public void shouldFetchVersionInfoWhichNeedsUpdate() {
ServerVersionInfoManager versionInfoManager = mock(ServerVersionInfoManager.class);
VersionInfo versionInfo = mock(VersionInfo.class);
when(versionInfoManager.versionInfoForUpdate()).thenReturn(versionInfo);
when(versionInfoManager.isUpdateCheckEnabled()).thenReturn(true);
VersionInfoService versionInfoService = new VersionInfoService(versionInfoManager);
VersionInfo info = versionInfoService.getStaleVersionInfo();
assertThat(info, is(versionInfo));
}
use of com.thoughtworks.go.domain.VersionInfo in project gocd by gocd.
the class VersionInfoServiceTest method shouldReturnNullIfVersionUpdateIsDisabled.
@Test
public void shouldReturnNullIfVersionUpdateIsDisabled() {
ServerVersionInfoManager versionInfoManager = mock(ServerVersionInfoManager.class);
when(versionInfoManager.isUpdateCheckEnabled()).thenReturn(true);
VersionInfoService versionInfoService = new VersionInfoService(versionInfoManager);
VersionInfo info = versionInfoService.getStaleVersionInfo();
assertNull(info);
}
Aggregations