use of com.thoughtworks.go.domain.GoVersion in project gocd by gocd.
the class ServerVersionInfoBuilder method update.
private VersionInfo update(VersionInfo versionInfo) {
GoVersion currentGoVersion = installedVersion();
if (currentGoVersion == null)
return versionInfo;
if (!isServerVersionInfoUpToDate(versionInfo, currentGoVersion)) {
versionInfo.setInstalledVersion(currentGoVersion);
versionInfoDao.saveOrUpdate(versionInfo);
}
return versionInfo;
}
use of com.thoughtworks.go.domain.GoVersion in project gocd by gocd.
the class ServerVersionInfoBuilder method installedVersion.
private GoVersion installedVersion() {
GoVersion version = null;
String installedVersion = serverVersion.version();
try {
version = new GoVersion(installedVersion);
} catch (VersionFormatException e) {
LOGGER.error("[Go Update Check] Server Version: {} format is Invalid.", installedVersion);
}
return version;
}
use of com.thoughtworks.go.domain.GoVersion in project gocd by gocd.
the class ServerVersionInfoManager method updateLatestVersion.
public VersionInfo updateLatestVersion(String latestVersion) {
synchronized (VERSION_INFO_MUTEX) {
serverVersionInfo.setLatestVersion(new GoVersion(latestVersion));
serverVersionInfo.setLatestVersionUpdatedAt(clock.currentTime());
versionInfoDao.saveOrUpdate(serverVersionInfo);
versionInfoUpdatingFrom = null;
addGoUpdateToCacheIfAvailable();
LOGGER.info("[Go Update Check] Update check done at: {}, latest available version: {}", new Date(), latestVersion);
return serverVersionInfo;
}
}
use of com.thoughtworks.go.domain.GoVersion in project gocd by gocd.
the class VersionInfoSqlMapDaoIntegrationTest method shouldUpdateVersionInfo.
@Test
public void shouldUpdateVersionInfo() {
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.setLatestVersion(new GoVersion("15.2.1-111"));
versionInfoSqlMapDao.saveOrUpdate(versionInfo);
VersionInfo info = versionInfoSqlMapDao.findByComponentName(versionInfo.getComponentName());
assertThat(info.getLatestVersion().toString(), is("15.2.1-111"));
}
use of com.thoughtworks.go.domain.GoVersion in project gocd by gocd.
the class ServerVersionInfoBuilderTest method shouldNotUpdateTheVersionInfoIfUnableToParseTheInstalledVersion.
@Test
public void shouldNotUpdateTheVersionInfoIfUnableToParseTheInstalledVersion() {
VersionInfo goVersionInfo = new VersionInfo("go_server", new GoVersion("1.2.3-1"));
when(versionInfoDao.findByComponentName("go_server")).thenReturn(goVersionInfo);
when(serverVersion.version()).thenReturn("N/A");
VersionInfo versionInfo = builder.getServerVersionInfo();
verify(versionInfoDao, never()).saveOrUpdate(isA(VersionInfo.class));
assertThat(versionInfo.getComponentName(), is(goVersionInfo.getComponentName()));
assertThat(versionInfo.getInstalledVersion(), is(goVersionInfo.getInstalledVersion()));
}
Aggregations