private static void assertVersion(Version version, int expectedMajor, int expectedMinor, int expectedPatch, long expectedBuildNumber, String expectedQualifier) { assertThat(version.major()).isEqualTo(expectedMajor); assertThat(version.minor()).isEqualTo(expectedMinor); assertThat(version.patch()).isEqualTo(expectedPatch); assertThat(version.buildNumber()).isEqualTo(expectedBuildNumber); assertThat(version.qualifier()).isEqualTo(expectedQualifier); } }
public Optional<UpdateCenter> getUpdateCenter(boolean refreshUpdateCenter) { Optional<UpdateCenter> updateCenter = centerClient.getUpdateCenter(refreshUpdateCenter); if (updateCenter.isPresent()) { org.sonar.api.utils.Version fullVersion = sonarRuntime.getApiVersion(); org.sonar.api.utils.Version semanticVersion = org.sonar.api.utils.Version.create(fullVersion.major(), fullVersion.minor(), fullVersion.patch()); return Optional.of(updateCenter.get().setInstalledSonarVersion(Version.create(semanticVersion.toString())).registerInstalledPlugins( installedPluginReferentialFactory.getInstalledPluginReferential()) .setDate(centerClient.getLastRefreshDate())); } return Optional.absent(); } }
public Optional<UpdateCenter> getUpdateCenter(boolean refreshUpdateCenter) { Optional<UpdateCenter> updateCenter = centerClient.getUpdateCenter(refreshUpdateCenter); if (updateCenter.isPresent()) { org.sonar.api.utils.Version fullVersion = sonarRuntime.getApiVersion(); org.sonar.api.utils.Version semanticVersion = org.sonar.api.utils.Version.create(fullVersion.major(), fullVersion.minor(), fullVersion.patch()); return Optional.of(updateCenter.get().setInstalledSonarVersion(Version.create(semanticVersion.toString())).registerInstalledPlugins( installedPluginReferentialFactory.getInstalledPluginReferential()) .setDate(centerClient.getLastRefreshDate())); } return Optional.absent(); } }