use of com.thoughtworks.go.domain.exception.VersionFormatException 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.exception.VersionFormatException in project gocd by gocd.
the class GoVersion method parse.
private void parse(String version) {
Matcher matcher = matcherFor(version);
if (matcher == null)
throw new VersionFormatException(format("Invalid version format [%s]", version));
this.major = parseInt(matcher.group(1));
this.minor = parseInt(matcher.group(2));
this.patches = parseInt(matcher.group(3));
this.modifications = parseInt(matcher.group(4));
}
use of com.thoughtworks.go.domain.exception.VersionFormatException in project gocd by gocd.
the class VersionInfoServiceTest method shouldAddErrorToResultIfVersionFormatIsInValid.
@Test
public void shouldAddErrorToResultIfVersionFormatIsInValid() {
ServerVersionInfoManager versionInfoManager = mock(ServerVersionInfoManager.class);
HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
when(versionInfoManager.updateLatestVersion("16.1.0-123")).thenThrow(new VersionFormatException("fail"));
new VersionInfoService(versionInfoManager).updateServerLatestVersion("16.1.0-123", result);
assertFalse(result.isSuccessful());
}
Aggregations