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");
}
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");
}
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");
}
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");
}
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");
}
Aggregations