Search in sources :

Example 6 with ScmInfo

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

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)

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