Search in sources :

Example 1 with ManifestInfo

use of org.talend.dataprep.info.ManifestInfo 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());
}
Also used : Version(org.talend.dataprep.info.Version) ManifestInfo(org.talend.dataprep.info.ManifestInfo) ManifestInfoProvider(org.talend.dataprep.info.ManifestInfoProvider) Test(org.junit.Test)

Example 2 with ManifestInfo

use of org.talend.dataprep.info.ManifestInfo 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());
}
Also used : Version(org.talend.dataprep.info.Version) ManifestInfo(org.talend.dataprep.info.ManifestInfo) ManifestInfoProvider(org.talend.dataprep.info.ManifestInfoProvider) Test(org.junit.Test)

Example 3 with ManifestInfo

use of org.talend.dataprep.info.ManifestInfo 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());
}
Also used : Version(org.talend.dataprep.info.Version) ManifestInfo(org.talend.dataprep.info.ManifestInfo) ManifestInfoProvider(org.talend.dataprep.info.ManifestInfoProvider) Test(org.junit.Test)

Example 4 with ManifestInfo

use of org.talend.dataprep.info.ManifestInfo 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());
}
Also used : Version(org.talend.dataprep.info.Version) ManifestInfo(org.talend.dataprep.info.ManifestInfo) ManifestInfoProvider(org.talend.dataprep.info.ManifestInfoProvider) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 ManifestInfo (org.talend.dataprep.info.ManifestInfo)4 ManifestInfoProvider (org.talend.dataprep.info.ManifestInfoProvider)4 Version (org.talend.dataprep.info.Version)4