Search in sources :

Example 26 with GitLabApi

use of org.gitlab4j.api.GitLabApi in project nivio by dedica-team.

the class GitLabConfigTest method getGitLabAPI.

@Test
void getGitLabAPI() {
    GitLabProperties gitLabProperties = new GitLabProperties("", "token-string-here123", "abracadabra", "123456789");
    GitLabConfig gitLabConfig = new GitLabConfig(gitLabProperties);
    GitLabApi gitLabApi = gitLabConfig.getGitLabAPI();
    assertNotNull(gitLabApi);
    assertFalse(gitLabApi == null);
    assertTrue(gitLabProperties.getHostUrl().isEmpty());
}
Also used : GitLabApi(org.gitlab4j.api.GitLabApi) Test(org.junit.jupiter.api.Test)

Example 27 with GitLabApi

use of org.gitlab4j.api.GitLabApi in project nivio by dedica-team.

the class GitLabConfigTest method testGetGitLabAPI.

@Test
void testGetGitLabAPI() {
    GitLabProperties gitLabProperties = new GitLabProperties("http://gitlab.example.com", "token-string-here123", "abracadabra", "123456789");
    GitLabConfig gitLabConfig = new GitLabConfig(gitLabProperties);
    String hostUrl = gitLabProperties.getHostUrl();
    Optional<String> personalAccessToken = Optional.ofNullable(gitLabProperties.getPersonalAccessToken());
    Optional<String> username = Optional.ofNullable(gitLabProperties.getUsername());
    Optional<String> password = Optional.ofNullable(gitLabProperties.getPassword());
    GitLabApi gitLabApi = gitLabConfig.getGitLabAPI(hostUrl, personalAccessToken, username, password);
    assertNotNull(gitLabApi);
    assertFalse(gitLabApi == null);
    assertThat(hostUrl.isEmpty());
    assertThat(personalAccessToken.isPresent());
    assertThat(username.isPresent());
    assertThat(password.isPresent());
}
Also used : GitLabApi(org.gitlab4j.api.GitLabApi) Test(org.junit.jupiter.api.Test)

Aggregations

GitLabApi (org.gitlab4j.api.GitLabApi)27 GitLabApiException (org.gitlab4j.api.GitLabApiException)16 LegendSDLCServerException (org.finos.legend.sdlc.server.error.LegendSDLCServerException)14 GitLabProjectId (org.finos.legend.sdlc.server.gitlab.GitLabProjectId)8 ProvisioningException (com.tremolosecurity.provisioning.core.ProvisioningException)5 Workflow (com.tremolosecurity.provisioning.core.Workflow)5 GitlabUserProvider (com.tremolosecurity.unison.gitlab.provisioning.targets.GitlabUserProvider)5 Branch (org.gitlab4j.api.models.Branch)5 MergeRequest (org.gitlab4j.api.models.MergeRequest)5 Project (org.gitlab4j.api.models.Project)5 CommitsApi (org.gitlab4j.api.CommitsApi)4 CommitRef (org.gitlab4j.api.models.CommitRef)4 IOException (java.io.IOException)3 Collectors (java.util.stream.Collectors)3 ProjectFileAccessProvider (org.finos.legend.sdlc.server.project.ProjectFileAccessProvider)3 RepositoryApi (org.gitlab4j.api.RepositoryApi)3 ConfigStructure (com.microfocus.octane.gitlab.model.ConfigStructure)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 OutputStreamWriter (java.io.OutputStreamWriter)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2