use of org.talend.dataprep.info.Version in project data-prep by Talend.
the class VersionServiceAPI method allVersions.
/**
* Returns all the versions of the different services (api, dataset, preparation and transformation) and the global
* application version.
*
* @return an array of service versions
*/
@RequestMapping(value = "/api/version", method = GET)
@ApiOperation(value = "Get the version of all services (including underlying low level services)", produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
@PublicAPI
public BuildDetails allVersions() {
List<Version> versions = new ArrayList<>();
for (VersionsSupplier versionsSupplier : versionsSuppliers) {
versions.addAll(versionsSupplier.getVersions());
}
CollectionUtils.filter(versions, PredicateUtils.notNullPredicate());
return new BuildDetails(applicationVersion, versions.toArray(new Version[versions.size()]));
}
use of org.talend.dataprep.info.Version in project data-prep by Talend.
the class VersionServiceTest method shouldAggregateSameBuildId.
@Test
public void shouldAggregateSameBuildId() throws Exception {
// given
final ManifestInfoProvider provider1 = mock(ManifestInfoProvider.class);
final ManifestInfoProvider provider2 = mock(ManifestInfoProvider.class);
when(provider1.getManifestInfo()).thenReturn(new ManifestInfo("v1", "1234"));
when(provider2.getManifestInfo()).thenReturn(new ManifestInfo("v1", "1234"));
ReflectionTestUtils.setField(versionService, "manifestInfoProviders", asList(provider1, provider2));
// when
final Version version = versionService.version();
// then
assertEquals("v1", version.getVersionId());
assertEquals("1234-1234", version.getBuildId());
}
use of org.talend.dataprep.info.Version in project data-prep by Talend.
the class VersionServiceTest method shouldAggregateBuildId.
@Test
public void shouldAggregateBuildId() throws Exception {
// given
final ManifestInfoProvider provider1 = mock(ManifestInfoProvider.class);
final ManifestInfoProvider provider2 = mock(ManifestInfoProvider.class);
when(provider1.getManifestInfo()).thenReturn(new ManifestInfo("v1", "1234"));
when(provider2.getManifestInfo()).thenReturn(new ManifestInfo("v1", "5678"));
ReflectionTestUtils.setField(versionService, "manifestInfoProviders", asList(provider1, provider2));
// when
final Version version = versionService.version();
// then
assertEquals("v1", version.getVersionId());
assertEquals("1234-5678", version.getBuildId());
}
use of org.talend.dataprep.info.Version in project data-prep by Talend.
the class VersionServiceTest method shouldShouldSkipMissingVersionId.
@Test
public void shouldShouldSkipMissingVersionId() throws Exception {
// given
final ManifestInfoProvider provider1 = mock(ManifestInfoProvider.class);
final ManifestInfoProvider provider2 = mock(ManifestInfoProvider.class);
when(provider1.getManifestInfo()).thenReturn(new ManifestInfo("v1", "1234"));
when(provider2.getManifestInfo()).thenReturn(new ManifestInfo("N/A", "1234"));
ReflectionTestUtils.setField(versionService, "manifestInfoProviders", asList(provider1, provider2));
// when
final Version version = versionService.version();
// then
assertEquals("v1", version.getVersionId());
assertEquals("1234-1234", version.getBuildId());
}
use of org.talend.dataprep.info.Version in project data-prep by Talend.
the class VersionServiceTest method shouldAggregateVersionId.
@Test
public void shouldAggregateVersionId() throws Exception {
// given
final ManifestInfoProvider provider1 = mock(ManifestInfoProvider.class);
final ManifestInfoProvider provider2 = mock(ManifestInfoProvider.class);
when(provider1.getManifestInfo()).thenReturn(new ManifestInfo("v1", "1234"));
when(provider2.getManifestInfo()).thenReturn(new ManifestInfo("v2", "1234"));
ReflectionTestUtils.setField(versionService, "manifestInfoProviders", asList(provider1, provider2));
// when
final Version version = versionService.version();
// then
assertEquals("v1-v2", version.getVersionId());
assertEquals("1234-1234", version.getBuildId());
}
Aggregations