use of com.thoughtworks.go.domain.VersionInfo 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.VersionInfo 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()));
}
use of com.thoughtworks.go.domain.VersionInfo in project gocd by gocd.
the class ServerVersionInfoBuilderTest method shouldCreateVersionInfoForGOServerIfDoesNotExist.
@Test
public void shouldCreateVersionInfoForGOServerIfDoesNotExist() {
when(versionInfoDao.findByComponentName("go_server")).thenReturn(null);
when(serverVersion.version()).thenReturn("1.2.3-1");
VersionInfo versionInfo = builder.getServerVersionInfo();
verify(versionInfoDao).saveOrUpdate(isA(VersionInfo.class));
assertThat(versionInfo.getComponentName(), is("go_server"));
assertThat(versionInfo.getInstalledVersion().toString(), is("1.2.3-1"));
}
use of com.thoughtworks.go.domain.VersionInfo in project gocd by gocd.
the class ServerVersionInfoBuilderTest method shouldUpdateTheVersionInfoIfInstalledVersionHasChanged.
@Test
public void shouldUpdateTheVersionInfoIfInstalledVersionHasChanged() {
VersionInfo goVersionInfo = new VersionInfo("go_server", new GoVersion("1.2.3-1"));
when(versionInfoDao.findByComponentName("go_server")).thenReturn(goVersionInfo);
when(serverVersion.version()).thenReturn("5.6.7-8");
VersionInfo versionInfo = builder.getServerVersionInfo();
verify(versionInfoDao).saveOrUpdate(isA(VersionInfo.class));
assertThat(versionInfo.getComponentName(), is(goVersionInfo.getComponentName()));
assertThat(versionInfo.getInstalledVersion().toString(), is("5.6.7-8"));
}
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());
}
Aggregations