• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java GitlabGroup类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.gitlab.api.models.GitlabGroup的典型用法代码示例。如果您正苦于以下问题:Java GitlabGroup类的具体用法?Java GitlabGroup怎么用?Java GitlabGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

GitlabGroup类属于org.gitlab.api.models包,在下文中一共展示了GitlabGroup类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: projectUrl

点赞 3

import org.gitlab.api.models.GitlabGroup; //导入依赖的package包/类
@SuppressWarnings("WeakerAccess") // API
protected String projectUrl(String group, GitLabProjectSelector selector, GitLabProjectVisibility visibility, String searchPattern) {
    StringBuilder urlBuilder = new StringBuilder(GitlabGroup.URL).append(PATH_SEP).append(group).append(GitLabProject.URL);

    if (!VISIBLE.equals(selector)) {
        urlBuilder.append("?").append(selector.id()).append("=true");
    }

    if (!ALL.equals(visibility)) {
        urlBuilder.append(VISIBLE.equals(selector) ? "?" : "&").append("visibility=").append(visibility.id());
    }

    if (!StringUtils.isEmpty(searchPattern)) {
        urlBuilder.append(VISIBLE.equals(selector) && ALL.equals(visibility) ? "?" : "&").append("search=").append(searchPattern);
    }

    return urlBuilder.toString();
}
 

开发者ID:Argelbargel,
项目名称:gitlab-branch-source-plugin,
代码行数:19,
代码来源:GitLabAPI.java

示例2: convertGroupToConnectorObject

点赞 3

import org.gitlab.api.models.GitlabGroup; //导入依赖的package包/类
private ConnectorObject convertGroupToConnectorObject(GitlabGroup gitlabGroup) {
	ConnectorObjectBuilder builder = new ConnectorObjectBuilder();
	builder.setObjectClass(ObjectClass.GROUP);
	builder.setUid(gitlabGroup.getId().toString());
	builder.setName(gitlabGroup.getName());
	addAttr(builder,ATTR_PATH, gitlabGroup.getPath());
	
	AttributeBuilder memberAttrBuilder = new AttributeBuilder();
	memberAttrBuilder.setName(ATTR_MEMBER);
	List<GitlabGroupMember> groupMembers;
	try {
		groupMembers = gitlabAPI.getGroupMembers(gitlabGroup);
	} catch (IOException e) {
		throw new ConnectorIOException(e.getMessage(), e);
	}
	if (groupMembers != null && !groupMembers.isEmpty()) {
		for (GitlabGroupMember gitlabMember: groupMembers) {
			Integer id = gitlabMember.getId();
			memberAttrBuilder.addValue(id);
		}
		builder.addAttribute(memberAttrBuilder.build());
	}
	
	return builder.build();
}
 

开发者ID:Evolveum,
项目名称:connector-gitlab,
代码行数:26,
代码来源:GitlabConnector.java

示例3: before

点赞 3

import org.gitlab.api.models.GitlabGroup; //导入依赖的package包/类
@BeforeClass
void before() throws Exception {
  String gitlabVersion = System.getenv("GITLAB_VERSION");
  if (gitlabVersion == null)
    gitlabVersion = "9.3.3-ce.0";

  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("[email protected]", userPassword, user, user, null, null, null, null, null, null, null, null, false, null, true);
  Assert.assertNotNull(gitlabUser);

  final GitlabGroup group = rootAPI.createGroup("testGroup");
  Assert.assertNotNull(group);

  Assert.assertNotNull(rootAPI.addGroupMember(group.getId(), gitlabUser.getId(), GitlabAccessLevel.Developer));

  gitlabProject = createGitlabProject(rootAPI, group, "test", false);
  gitlabPublicProject = createGitlabProject(rootAPI, group, "publik", true);
}
 

开发者ID:bozaro,
项目名称:git-as-svn,
代码行数:32,
代码来源:GitLabIntegrationTest.java

示例4: testGetGroupByPath

点赞 3

import org.gitlab.api.models.GitlabGroup; //导入依赖的package包/类
@Test
public void testGetGroupByPath() throws IOException {
    // Given
    String name = "groupName";
    String path = "groupPath";

    GitlabGroup originalGroup = api.createGroup(name, path);

    // When
    GitlabGroup group = api.getGroup(path);

    // Then:
    assertNotNull(group);
    assertEquals(originalGroup.getId(), group.getId());
    assertEquals(originalGroup.getName(), group.getName());
    assertEquals(originalGroup.getPath(), group.getPath());

    // Cleanup
    api.deleteGroup(group.getId());
}
 

开发者ID:timols,
项目名称:java-gitlab-api,
代码行数:21,
代码来源:GitlabAPIIT.java

示例5: getGroupId

点赞 2

import org.gitlab.api.models.GitlabGroup; //导入依赖的package包/类
private Integer getGroupId(String groupName) {
	try {
		List<GitlabGroup> groups = api.getGroups();

		for (GitlabGroup group : groups) {
			if (group.getName().equals(groupName)) {
				return group.getId();
			}
		}
	} catch (IOException e) {
		e.printStackTrace();
	}

	return null;
}
 

开发者ID:xtf-cz,
项目名称:xtf,
代码行数:16,
代码来源:GitLabUtil.java

示例6: getGroup

点赞 2

import org.gitlab.api.models.GitlabGroup; //导入依赖的package包/类
public GitLabGroup getGroup(int id) throws GitLabAPIException {
    try {
        return getDelegate().retrieve().to(GitlabGroup.URL + PATH_SEP + id, GitLabGroup.class);
    } catch (Exception e) {
        throw new GitLabAPIException(e);
    }
}
 

开发者ID:Argelbargel,
项目名称:gitlab-branch-source-plugin,
代码行数:8,
代码来源:GitLabAPI.java

示例7: createGroup

点赞 2

import org.gitlab.api.models.GitlabGroup; //导入依赖的package包/类
private Uid createGroup(Set<Attribute> attributes, OperationOptions options) {
	String name = getStringAttr(attributes, Name.NAME);
	String path = getStringAttr(attributes, ATTR_PATH);
	if (path == null) {
		throw new InvalidAttributeValueException("Missing mandatory attribute "+ATTR_PATH);
	}		
	try {
		GitlabGroup gitlabGroup = gitlabAPI.createGroup(name, path);
		Integer id = gitlabGroup.getId();
		return new Uid(id.toString());
	} catch (IOException e) {
		throw new ConnectorIOException(e.getMessage(), e);
	}
}
 

开发者ID:Evolveum,
项目名称:connector-gitlab,
代码行数:15,
代码来源:GitlabConnector.java

示例8: createGitlabProject

点赞 2

import org.gitlab.api.models.GitlabGroup; //导入依赖的package包/类
@NotNull
private GitlabProject createGitlabProject(@NotNull GitlabAPI rootAPI, @NotNull GitlabGroup group, @NotNull String name, boolean publik) throws IOException {
  return rootAPI.createProject(name, group.getId(), null, null, null, null, null, null, publik, null, null);
}
 

开发者ID:bozaro,
项目名称:git-as-svn,
代码行数:5,
代码来源:GitLabIntegrationTest.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)