当前位置: 首页>>代码示例>>Java>>正文


Java RepositoryService类代码示例

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


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

示例1: findAssociatedClaNames

import org.eclipse.egit.github.core.service.RepositoryService; //导入依赖的package包/类
@Override
@SneakyThrows
public Set<String> findAssociatedClaNames(String repoId, String accessToken) {

	GitHubClient client = createClient(accessToken);
	RepositoryService service = new RepositoryService(client);

	RepositoryId repositoryId = RepositoryId.createFromId(repoId);

	List<RepositoryHook> hooks = service.getHooks(repositoryId);
	Set<String> claNames = hooks.stream() //
			.filter(h -> StringUtils.hasText(h.getConfig().get("url"))) //
			.filter(RepositoryHook::isActive) //
			.map(h -> h.getConfig().get("url")) //
			.filter(PULL_REQUEST_CALLBACK_PATTERN.asPredicate()) //
			.map(url -> getClaName(url, PULL_REQUEST_CALLBACK_PATTERN)) //
			.collect(Collectors.toSet());

	return claNames;
}
 
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:21,代码来源:MylynGitHubApi.java

示例2: createTestRepository

import org.eclipse.egit.github.core.service.RepositoryService; //导入依赖的package包/类
private static void createTestRepository(User user) throws Exception {
	GitHubClient client = createClient(user.getGitHubAccessToken());
	RepositoryService repository = new RepositoryService(client);

	Repository toCreate = new Repository();
	toCreate.setName("cla-test");

	RestTemplate rest = new RestTemplate();
	try {
		rest.delete("https://api.github.com/repos/{owner}/{repo}?access_token={token}", user.getGitHubUsername(), toCreate.getName(), user.getGitHubAccessToken());
	}catch(Throwable t) {
		t.printStackTrace();
	}

	repository.createRepository(toCreate);

	Thread.sleep(TimeUnit.SECONDS.toMillis(1L));

	// we need content to allow forking
	Map<String,String> content = new HashMap<>();
	content.put("message", "Initial");
	content.put("content", "bXkgbmV3IGZpbGUgY29udGVudHM=");
	rest.put("https://api.github.com/repos/{owner}/{repo}/contents/README.adoc?access_token={token}", content, user.getGitHubUsername(), toCreate.getName(), user.getGitHubAccessToken());
}
 
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:25,代码来源:SmokeTests.java

示例3: fork

import org.eclipse.egit.github.core.service.RepositoryService; //导入依赖的package包/类
/**
 * Forks provided repository into the {@link #ORGANIZATION}. The forked repository will be automatically destroyed
 * after test finished.
 *
 * @param lifetime validity of repository (when it should be clean up)
 * @param expirationDuration duration (expiration time), when can be removed the repository, even by some other test
 * (if cleaning of repository failed, this can be used by cleaning retry)
 */
public void fork(String owner, String repositoryOwner, String repositoryName, Lifetime lifetime, int expirationDuration)
{
    GitHubClient gitHubClient = getGitHubClient(owner);
    RepositoryService repositoryService = new RepositoryService(gitHubClient);

    try
    {
        Repository repository = repositoryService.forkRepository(RepositoryId.create(repositoryOwner, repositoryName),
                gitHubClient.getUser().equals(owner) ? null : owner);

        // wait until forked repository is prepared
        final Repository newRepository = waitTillRepositoryIsReady(repositoryService, repository);

        RepositoryContext repositoryContext = new RepositoryContext(owner, newRepository);
        repositoryByLifetime.get(lifetime).add(repositoryContext);
        repositoryBySlug.put(getSlug(owner, repositoryName), repositoryContext);
    }
    catch (IOException e)
    {
        throw new RuntimeException(e);
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:31,代码来源:GitHubTestSupport.java

示例4: createRepository

import org.eclipse.egit.github.core.service.RepositoryService; //导入依赖的package包/类
/**
 * Creates repository for provided name and appropriate owner.
 *
 * @param owner of repository
 * @param name of repository
 * @return created repository
 */
private Repository createRepository(String owner, String name)
{
    GitHubClient gitHubClient = getGitHubClient(owner);
    RepositoryService repositoryService = new RepositoryService(gitHubClient);

    try
    {
        final Repository createdRepository = createRepositoryForUserOrOrg(owner, name, gitHubClient, repositoryService);

        return waitTillRepositoryIsReady(repositoryService, createdRepository);
    }
    catch (IOException e)
    {
        throw new RuntimeException(e);
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:24,代码来源:GitHubTestSupport.java

示例5: testCreateOrUpdateItem

import org.eclipse.egit.github.core.service.RepositoryService; //导入依赖的package包/类
public void testCreateOrUpdateItem(@Mocked ClientResponse clientResponse, @Mocked StorageEngine store,
    @Mocked Repository repoMock, @Mocked RepositoryService service, @Mocked IssueService issueServiceMock,
    @Mocked ODocument workItem) throws Exception {

  new Expectations() {
    {
      settings.hasJiraProperties();
      result = true;

      clientResponse.getStatus();
      result = Status.OK.getStatusCode();

      service.getRepository(anyString, anyString);
      result = repoMock;
    }
  };

  JiraExporter jiraExporter = JiraExporter.INSTANCE;
  jiraExporter.initialize(settings, store);
  jiraExporter.createOrUpdateItem(workItem);

  new Verifications() {
    {
    }
  };
}
 
开发者ID:rtcTo,项目名称:rtc2jira,代码行数:27,代码来源:JiraExporterTest.java

示例6: getRepos

import org.eclipse.egit.github.core.service.RepositoryService; //导入依赖的package包/类
/**
 * Gets all repositories for a given organization/user.
 *
 * @param orgName
 * @return List of repositories
 * @throws KaramelException
 */
public synchronized static List<RepoItem> getRepos(String orgName) throws KaramelException {
  if (cachedRepos.get(orgName) != null) {
    return cachedRepos.get(orgName);
  }

  try {
    RepositoryService rs = new RepositoryService(client);
    List<Repository> repos;
    // If we are looking for the repositories for the current user
    if (GithubApi.getUser().equalsIgnoreCase(orgName)) {
      repos = rs.getRepositories(orgName);
    } else {       // If we are looking for the repositories for a given organization
      repos = rs.getOrgRepositories(orgName);
    }

    List<RepoItem> repoItems = new ArrayList<>();
    for (Repository r : repos) {
      repoItems.add(new RepoItem(r.getName(), r.getDescription(), r.getSshUrl()));
    }
    cachedRepos.put(orgName, repoItems);
    return repoItems;
  } catch (IOException ex) {
    throw new KaramelException("Problem listing GitHub repositories: " + ex.getMessage());
  }
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:33,代码来源:GithubApi.java

示例7: createRepoForOrg

import org.eclipse.egit.github.core.service.RepositoryService; //导入依赖的package包/类
/**
 * Create a repository for a given organization with a description
 *
 * @param org
 * @param repoName
 * @param description
 * @return RepoItem bean/json object
 * @throws KaramelException
 */
public synchronized static RepoItem createRepoForOrg(String org, String repoName, String description) throws
    KaramelException {
  try {
    OrganizationService os = new OrganizationService(client);
    RepositoryService rs = new RepositoryService(client);
    Repository r = new Repository();
    r.setName(repoName);
    r.setOwner(os.getOrganization(org));
    r.setDescription(description);
    rs.createRepository(org, r);
    cloneRepo(org, repoName);
    cachedRepos.remove(org);
    return new RepoItem(repoName, description, r.getSshUrl());
  } catch (IOException ex) {
    throw new KaramelException("Problem creating the repository " + repoName + " for organization " + org
        + " : " + ex.getMessage());
  }
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:28,代码来源:GithubApi.java

示例8: createRepoForUser

import org.eclipse.egit.github.core.service.RepositoryService; //导入依赖的package包/类
/**
 * Create a repository in a given github user's local account.
 *
 * @param repoName
 * @param description
 * @throws KaramelException
 */
public synchronized static void createRepoForUser(String repoName, String description) throws KaramelException {
  try {
    UserService us = new UserService(client);
    RepositoryService rs = new RepositoryService(client);
    Repository r = new Repository();
    r.setName(repoName);
    r.setOwner(us.getUser());
    r.setDescription(description);
    rs.createRepository(r);
    cloneRepo(getUser(), repoName);
    cachedRepos.remove(GithubApi.getUser());
  } catch (IOException ex) {
    throw new KaramelException("Problem creating " + repoName + " for user " + ex.getMessage());
  }
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:23,代码来源:GithubApi.java

示例9: createGitRepository

import org.eclipse.egit.github.core.service.RepositoryService; //导入依赖的package包/类
/**
 * Creates a repository on GitHub and in a local temporary directory. This is a one time operation as
 * once it is created on GitHub and locally it cannot be recreated.
 */
public File createGitRepository(String repositoryName) throws IOException {
    RepositoryService service = new RepositoryService();
    service.getClient().setOAuth2Token(oAuthToken);
    Repository repository = new Repository();
    repository.setName(repositoryName);
    repository = service.createRepository(repository);
    repositoryLocation = repository.getHtmlUrl();

    CloneCommand cloneCommand = Git.cloneRepository()
            .setURI(repository.getCloneUrl())
            .setDirectory(localGitDirectory);
    addAuth(cloneCommand);
    try {
        localRepository = cloneCommand.call();
    } catch (GitAPIException e) {
        throw new IOException("Error cloning to local file system", e);
    }
    return localGitDirectory;
}
 
开发者ID:WASdev,项目名称:tool.accelerate.core,代码行数:24,代码来源:GitHubConnector.java

示例10: onPreExecute

import org.eclipse.egit.github.core.service.RepositoryService; //导入依赖的package包/类
@Override
protected void onPreExecute() {
    context = fragment.getContentView().getContext();
    flag = fragment.getFlag();

    adapter = fragment.getRepoItemAdapter();
    list = fragment.getRepoItemList();

    GitHubClient client = fragment.getClient();
    service = new RepositoryService(client);

    if (flag == Flag.REPO_FIRST) {
        fragment.setContentEmpty(false);
        fragment.setContentShown(false);
    }
}
 
开发者ID:mthli,项目名称:Bitocle,代码行数:17,代码来源:RepoTask.java

示例11: onPreExecute

import org.eclipse.egit.github.core.service.RepositoryService; //导入依赖的package包/类
@Override
protected void onPreExecute() {
    mainFragment.setRefreshStatus(true);
    context = mainFragment.getContentView().getContext();
    refreshType = mainFragment.getRefreshType();

    GitHubClient gitHubClient = mainFragment.getGitHubClient();
    repositoryService = new RepositoryService(gitHubClient);

    repoItemAdapter = mainFragment.getRepoItemAdapter();
    repoItemList = mainFragment.getRepoItemList();

    if (refreshType == RefreshType.REPO_FIRST) {
        mainFragment.setContentShown(false);
    }
}
 
开发者ID:mthli,项目名称:Bitocle,代码行数:17,代码来源:RepoTask.java

示例12: getRepositories

import org.eclipse.egit.github.core.service.RepositoryService; //导入依赖的package包/类
@Override
public List<String> getRepositories() {
    // Logging
    logger.debug("[github] Getting repository list");
    // Getting a client
    GitHubClient client = createGitHubClient();
    // Service
    RepositoryService repositoryService = new RepositoryService(client);
    // Gets the repository names
    try {
        return repositoryService.getRepositories().stream()
                .map(Repository::getName)
                .collect(Collectors.toList());
    } catch (IOException e) {
        throw new OntrackGitHubClientException(e);
    }
}
 
开发者ID:nemerosa,项目名称:ontrack,代码行数:18,代码来源:DefaultOntrackGitHubClient.java

示例13: GFMMassConverter

import org.eclipse.egit.github.core.service.RepositoryService; //导入依赖的package包/类
public GFMMassConverter() throws IOException {

		gFMMassConverterConfiguration = new GFMMassConverterConfiguration();

		//GitHub client with optional authentication token
		gitHubClient = new GitHubClient();
		final String authenticationToken = gFMMassConverterConfiguration.getGFMAuthenticationToken();
		if( null != authenticationToken && ! authenticationToken.isEmpty() ) {
			gitHubClient.setOAuth2Token( authenticationToken );
		}

		final String gitHubUser = gFMMassConverterConfiguration.getGFMGitHubUser();
		final String gitHubProjet = gFMMassConverterConfiguration.getGFMGitHubRepository();

		//Get the optional repository configured
		if( null != gitHubUser && ! gitHubUser.isEmpty() && null != gitHubProjet && ! gitHubProjet.isEmpty() ) {

			final RepositoryService repositoryService = new RepositoryService( gitHubClient );
			gitHubProjectRepository = repositoryService.getRepository( gitHubUser, gitHubProjet );
		}
		else {
			gitHubProjectRepository = null;
		}

		markdownService = new MarkdownService( gitHubClient );
	}
 
开发者ID:Sylvain-Bugat,项目名称:github-flavored-markdown-converter,代码行数:27,代码来源:GFMMassConverter.java

示例14: getCommitsFromGitHub

import org.eclipse.egit.github.core.service.RepositoryService; //导入依赖的package包/类
/**
 * Fetches list of commits form GitHub repository.
 *
 * @param auth
 * @param owner
 * @param name
 * @param branch
 * @return list of commits
 * @throws IOException
 */
private List<RepositoryCommit> getCommitsFromGitHub(final String auth, final String owner, final String name,
													final String branch) throws IOException {
	GitHubClient client = new GitHubClient();

	if (auth != null && !auth.isEmpty()) {
		client.setOAuth2Token(auth);
	} else {
		log.warn("OAuth2Token not set");
	}

	CommitService cs = new CommitService(client);

	RepositoryService rs = new RepositoryService(client);
	final Repository repository = rs.getRepository(owner, name);

	return cs.getCommits(repository, branch, null);

}
 
开发者ID:ever-been,项目名称:benchmark-hazelcast3,代码行数:29,代码来源:HazelcastBenchmark.java

示例15: IssueToEGitHub

import org.eclipse.egit.github.core.service.RepositoryService; //导入依赖的package包/类
/**
 * Class to convert the issue and transfers it
 * 
 * @param data
 * @throws IOException
 */
public IssueToEGitHub( final ConnectionData data )
        throws IOException {

    this.repositoryParam = data.getRepository();
    this.userParam = data.getUser();
    this.mantisbturlParam = data.getMantisurl();

    GitHubClient client = new GitHubClient();
    client.setOAuth2Token( data.getToken() );

    RepositoryService repositoryService = new RepositoryService( client );
    MilestoneService milestoneService = new MilestoneService( client );
    IssueService issueService = new IssueService( client );

    Repository repository = repositoryService.getRepository( this.userParam, this.repositoryParam );

    TransferService transferService = new TransferService( milestoneMap, issueService, milestoneService, userParam,
            repositoryParam, repository );

    this.transferService = transferService;

    readMilestones( milestoneService );
}
 
开发者ID:tpummer,项目名称:issue2github,代码行数:30,代码来源:IssueToEGitHub.java


注:本文中的org.eclipse.egit.github.core.service.RepositoryService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。