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