Search in sources :

Example 1 with ScmInfo

use of org.eclipse.che.api.core.model.factory.ScmInfo in project che-server by eclipse-che.

the class GithubFactoryParametersResolverTest method shouldSetScmInfoIntoDevfileV2.

@Test
public void shouldSetScmInfoIntoDevfileV2() throws Exception {
    String githubUrl = "https://github.com/eclipse/che/tree/foobar";
    FactoryDevfileV2Dto computedFactory = generateDevfileV2Factory();
    when(urlFactoryBuilder.createFactoryFromDevfile(any(RemoteFactoryUrl.class), any(), anyMap())).thenReturn(Optional.of(computedFactory));
    Map<String, String> params = ImmutableMap.of(URL_PARAMETER_NAME, githubUrl);
    // when
    FactoryDevfileV2Dto factory = (FactoryDevfileV2Dto) githubFactoryParametersResolver.createFactory(params);
    // then
    ScmInfo scmInfo = factory.getScmInfo();
    assertNotNull(scmInfo);
    assertEquals(scmInfo.getScmProviderName(), "github");
    assertEquals(scmInfo.getRepositoryUrl(), "https://github.com/eclipse/che.git");
    assertEquals(scmInfo.getBranch(), "foobar");
}
Also used : FactoryDevfileV2Dto(org.eclipse.che.api.factory.shared.dto.FactoryDevfileV2Dto) ScmInfo(org.eclipse.che.api.core.model.factory.ScmInfo) RemoteFactoryUrl(org.eclipse.che.api.factory.server.urlfactory.RemoteFactoryUrl) Test(org.testng.annotations.Test)

Example 2 with ScmInfo

use of org.eclipse.che.api.core.model.factory.ScmInfo in project devspaces-images by redhat-developer.

the class GitlabFactoryParametersResolverTest method shouldSetScmInfoIntoDevfileV2.

@Test
public void shouldSetScmInfoIntoDevfileV2() throws Exception {
    String gitlabUrl = "http://gitlab.2mcl.com/eclipse/che/-/tree/foobar";
    FactoryDevfileV2Dto computedFactory = generateDevfileV2Factory();
    when(urlFactoryBuilder.createFactoryFromDevfile(any(RemoteFactoryUrl.class), any(), anyMap())).thenReturn(Optional.of(computedFactory));
    Map<String, String> params = ImmutableMap.of(URL_PARAMETER_NAME, gitlabUrl);
    // when
    FactoryDevfileV2Dto factory = (FactoryDevfileV2Dto) gitlabFactoryParametersResolver.createFactory(params);
    // then
    ScmInfo scmInfo = factory.getScmInfo();
    assertNotNull(scmInfo);
    assertEquals(scmInfo.getScmProviderName(), "gitlab");
    assertEquals(scmInfo.getRepositoryUrl(), "http://gitlab.2mcl.com/eclipse/che.git");
    assertEquals(scmInfo.getBranch(), "foobar");
}
Also used : FactoryDevfileV2Dto(org.eclipse.che.api.factory.shared.dto.FactoryDevfileV2Dto) ScmInfo(org.eclipse.che.api.core.model.factory.ScmInfo) RemoteFactoryUrl(org.eclipse.che.api.factory.server.urlfactory.RemoteFactoryUrl) Test(org.testng.annotations.Test)

Example 3 with ScmInfo

use of org.eclipse.che.api.core.model.factory.ScmInfo in project che-server by eclipse-che.

the class GitlabFactoryParametersResolverTest method shouldSetScmInfoIntoDevfileV2.

@Test
public void shouldSetScmInfoIntoDevfileV2() throws Exception {
    String gitlabUrl = "http://gitlab.2mcl.com/eclipse/che/-/tree/foobar";
    FactoryDevfileV2Dto computedFactory = generateDevfileV2Factory();
    when(urlFactoryBuilder.createFactoryFromDevfile(any(RemoteFactoryUrl.class), any(), anyMap())).thenReturn(Optional.of(computedFactory));
    Map<String, String> params = ImmutableMap.of(URL_PARAMETER_NAME, gitlabUrl);
    // when
    FactoryDevfileV2Dto factory = (FactoryDevfileV2Dto) gitlabFactoryParametersResolver.createFactory(params);
    // then
    ScmInfo scmInfo = factory.getScmInfo();
    assertNotNull(scmInfo);
    assertEquals(scmInfo.getScmProviderName(), "gitlab");
    assertEquals(scmInfo.getRepositoryUrl(), "http://gitlab.2mcl.com/eclipse/che.git");
    assertEquals(scmInfo.getBranch(), "foobar");
}
Also used : FactoryDevfileV2Dto(org.eclipse.che.api.factory.shared.dto.FactoryDevfileV2Dto) ScmInfo(org.eclipse.che.api.core.model.factory.ScmInfo) RemoteFactoryUrl(org.eclipse.che.api.factory.server.urlfactory.RemoteFactoryUrl) Test(org.testng.annotations.Test)

Example 4 with ScmInfo

use of org.eclipse.che.api.core.model.factory.ScmInfo in project che-server by eclipse-che.

the class BitbucketServerAuthorizingFactoryParametersResolverTest method shouldSetScmInfoIntoDevfileV2.

@Test
public void shouldSetScmInfoIntoDevfileV2() throws Exception {
    String bitbucketUrl = "http://bitbucket.2mcl.com/scm/test/repo.git?at=foobar";
    FactoryDevfileV2Dto computedFactory = generateDevfileV2Factory();
    when(urlFactoryBuilder.createFactoryFromDevfile(any(RemoteFactoryUrl.class), any(), anyMap())).thenReturn(Optional.of(computedFactory));
    Map<String, String> params = ImmutableMap.of(URL_PARAMETER_NAME, bitbucketUrl);
    // when
    FactoryDevfileV2Dto factory = (FactoryDevfileV2Dto) bitbucketServerFactoryParametersResolver.createFactory(params);
    // then
    ScmInfo scmInfo = factory.getScmInfo();
    assertNotNull(scmInfo);
    assertEquals(scmInfo.getScmProviderName(), "bitbucket");
    assertEquals(scmInfo.getRepositoryUrl(), "http://bitbucket.2mcl.com/scm/test/repo.git");
    assertEquals(scmInfo.getBranch(), "foobar");
}
Also used : FactoryDevfileV2Dto(org.eclipse.che.api.factory.shared.dto.FactoryDevfileV2Dto) ScmInfo(org.eclipse.che.api.core.model.factory.ScmInfo) RemoteFactoryUrl(org.eclipse.che.api.factory.server.urlfactory.RemoteFactoryUrl) Test(org.testng.annotations.Test)

Example 5 with ScmInfo

use of org.eclipse.che.api.core.model.factory.ScmInfo in project devspaces-images by redhat-developer.

the class BitbucketServerAuthorizingFactoryParametersResolverTest method shouldSetScmInfoIntoDevfileV2.

@Test
public void shouldSetScmInfoIntoDevfileV2() throws Exception {
    String bitbucketUrl = "http://bitbucket.2mcl.com/scm/test/repo.git?at=foobar";
    FactoryDevfileV2Dto computedFactory = generateDevfileV2Factory();
    when(urlFactoryBuilder.createFactoryFromDevfile(any(RemoteFactoryUrl.class), any(), anyMap())).thenReturn(Optional.of(computedFactory));
    Map<String, String> params = ImmutableMap.of(URL_PARAMETER_NAME, bitbucketUrl);
    // when
    FactoryDevfileV2Dto factory = (FactoryDevfileV2Dto) bitbucketServerFactoryParametersResolver.createFactory(params);
    // then
    ScmInfo scmInfo = factory.getScmInfo();
    assertNotNull(scmInfo);
    assertEquals(scmInfo.getScmProviderName(), "bitbucket");
    assertEquals(scmInfo.getRepositoryUrl(), "http://bitbucket.2mcl.com/scm/test/repo.git");
    assertEquals(scmInfo.getBranch(), "foobar");
}
Also used : FactoryDevfileV2Dto(org.eclipse.che.api.factory.shared.dto.FactoryDevfileV2Dto) ScmInfo(org.eclipse.che.api.core.model.factory.ScmInfo) RemoteFactoryUrl(org.eclipse.che.api.factory.server.urlfactory.RemoteFactoryUrl) Test(org.testng.annotations.Test)

Aggregations

ScmInfo (org.eclipse.che.api.core.model.factory.ScmInfo)6 RemoteFactoryUrl (org.eclipse.che.api.factory.server.urlfactory.RemoteFactoryUrl)6 FactoryDevfileV2Dto (org.eclipse.che.api.factory.shared.dto.FactoryDevfileV2Dto)6 Test (org.testng.annotations.Test)6