/** * Creates a Group * * @param request An object that represents the parameters for the request. * @param sudoUser The user for whom we're creating the group * @return The GitLab Group * @throws IOException on gitlab api call error */ public GitlabGroup createGroup(CreateGroupRequest request, GitlabUser sudoUser) throws IOException { Query query = request.toQuery(); query.appendIf(PARAM_SUDO, sudoUser != null ? sudoUser.getId() : null); String tailUrl = GitlabGroup.URL + query.toString(); return dispatch().to(tailUrl, GitlabGroup.class); }
@BeforeClass void before() throws Exception { SvnTestHelper.skipTestIfDockerUnavailable(); String gitlabVersion = System.getenv("GITLAB_VERSION"); if (gitlabVersion == null) { if (System.getenv("TRAVIS") != null) throw new SkipException("Only run gitlab tests on Travis when explicitly asked"); gitlabVersion = "latest"; } final int gitlabPort = 80; gitlab = new GenericContainer<>("gitlab/gitlab-ce:" + gitlabVersion) .withEnv("GITLAB_ROOT_PASSWORD", rootPassword) .withExposedPorts(gitlabPort) .waitingFor(Wait.forHttp("/users/sign_in") .withStartupTimeout(Duration.of(10, ChronoUnit.MINUTES))); gitlab.start(); gitlabUrl = "http://" + gitlab.getContainerIpAddress() + ":" + gitlab.getMappedPort(gitlabPort); rootToken = createToken(root, rootPassword, true); final GitlabAPI rootAPI = GitLabContext.connect(gitlabUrl, rootToken); final GitlabUser gitlabUser = rootAPI.createUser(new CreateUserRequest(user, user, "git-as-svn@localhost").setPassword(userPassword)); Assert.assertNotNull(gitlabUser); final GitlabGroup group = rootAPI.createGroup(new CreateGroupRequest("testGroup").setVisibility(GitlabVisibility.PUBLIC), null); Assert.assertNotNull(group); Assert.assertNotNull(rootAPI.addGroupMember(group.getId(), gitlabUser.getId(), GitlabAccessLevel.Developer)); gitlabProject = createGitlabProject(rootAPI, group, "test", GitlabVisibility.INTERNAL, Collections.singleton("git-as-svn")); gitlabPublicProject = createGitlabProject(rootAPI, group, "publik", GitlabVisibility.PUBLIC, Collections.emptySet()); }
/** * Creates a Group * * @param request An object that represents the parameters for the request. * @param sudoUser The user for whom we're creating the group * @return The GitLab Group * @throws IOException on gitlab api call error */ public GitlabGroup createGroup(CreateGroupRequest request, GitlabUser sudoUser) throws IOException { Query query = request.toQuery(); query.appendIf(PARAM_SUDO, sudoUser != null ? sudoUser.getId() : null); String tailUrl = GitlabGroup.URL + query.toString(); return dispatch().to(tailUrl, GitlabGroup.class); }
/** * Creates a Group * * @param request An object that represents the parameters for the request. * @param sudoUser The user for whom we're creating the group * @return The GitLab Group * @throws IOException on gitlab api call error */ public GitlabGroup createGroup(CreateGroupRequest request, GitlabUser sudoUser) throws IOException { Query query = request.toQuery(); query.appendIf(PARAM_SUDO, sudoUser != null ? sudoUser.getId() : null); String tailUrl = GitlabGroup.URL + query.toString(); return dispatch().to(tailUrl, GitlabGroup.class); }