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


Java RepositoryService.getRepository方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: getRepository

import org.eclipse.egit.github.core.service.RepositoryService; //导入方法依赖的package包/类
private Optional<Repository> getRepository(RepositoryIdentifier repositoryIdentifier) {
	RepositoryService repositoryService = new RepositoryService();
	try {
		Repository repository = repositoryService.getRepository(repositoryIdentifier.owner,
				repositoryIdentifier.name);
		if (repository == null) {
			return Optional.empty();
		}
		return Optional.of(repository);
	} catch (IOException e) {
		return Optional.empty();
	}
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:14,代码来源:GithubUrlBookmarkPropertiesProvider.java

示例6: waitTillRepositoryIsReady

import org.eclipse.egit.github.core.service.RepositoryService; //导入方法依赖的package包/类
private Repository waitTillRepositoryIsReady(final RepositoryService repositoryService, final Repository repository)
        throws IOException
{
    for (int i = 0; i < 10; i++)
    {
        sleep(100);
        final Repository newRepository = repositoryService.getRepository(repository.getOwner().getLogin(), repository.getName());
        if (newRepository != null)
        {
            return newRepository;
        }
    }
    throw new IOException("Unable to retrieve the new repository after 10s - " + repository.getUrl());
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:15,代码来源:GitHubTestSupport.java

示例7: cloneRepo

import org.eclipse.egit.github.core.service.RepositoryService; //导入方法依赖的package包/类
/**
 * Clone an existing github repo.
 *
 * @param owner
 * @param repoName
 * @throws se.kth.karamel.common.exception.KaramelException
 */
public synchronized static void cloneRepo(String owner, String repoName) throws KaramelException {
  Git result = null;
  try {
    RepositoryService rs = new RepositoryService(client);
    Repository r = rs.getRepository(owner, repoName);

    String cloneURL = r.getSshUrl();
    // prepare a new folder for the cloned repository
    File localPath = new File(Settings.COOKBOOKS_PATH + File.separator + repoName);
    if (localPath.isDirectory() == false) {
      localPath.mkdirs();
    } else {
      throw new KaramelException("Local directory already exists. Delete it first: " + localPath);
    }

    logger.debug("Cloning from " + cloneURL + " to " + localPath);
    result = Git.cloneRepository()
        .setURI(cloneURL)
        .setDirectory(localPath)
        .call();
    // Note: the call() returns an opened repository already which needs to be closed to avoid file handle leaks!
    logger.debug("Cloned repository: " + result.getRepository().getDirectory());
  } catch (IOException | GitAPIException ex) {
    throw new KaramelException("Problem cloning repo: " + ex.getMessage());
  } finally {
    if (result != null) {
      result.close();
    }
  }

}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:39,代码来源:GithubApi.java

示例8: testGitHubRepositoryCreation

import org.eclipse.egit.github.core.service.RepositoryService; //导入方法依赖的package包/类
@Test
public void testGitHubRepositoryCreation() throws Exception {
    String oAuthToken = System.getProperty("gitHubOauth");
    assumeTrue(oAuthToken != null && !oAuthToken.isEmpty());
    String name = "TestAppAcceleratorProject";
    String port = System.getProperty("liberty.test.port");
    URI baseUri = new URI("http://localhost:" + port + "/start");
    ServiceConnector serviceConnector = new MockServiceConnector(baseUri);
    Services services = new Services();
    Service service = new Service();
    service.setId("wibble");
    List<Service> serviceList = Collections.singletonList(service);
    services.setServices(serviceList);
    ProjectConstructionInputData inputData = new ProjectConstructionInputData(services, serviceConnector, name, ProjectConstructor.DeployType.LOCAL, ProjectConstructor.BuildType.MAVEN, null, null, null, null, null, false);

    ProjectConstructor constructor = new ProjectConstructor(inputData);
    GitHubConnector connector = new GitHubConnector(oAuthToken);
    GitHubWriter writer = new GitHubWriter(constructor.buildFileMap(), inputData.appName, connector);
    writer.createProjectOnGitHub();

    RepositoryService repositoryService = new RepositoryService();
    repositoryService.getClient().setOAuth2Token(oAuthToken);
    UserService userService = new UserService();
    userService.getClient().setOAuth2Token(oAuthToken);
    ContentsService contentsService = new ContentsService();
    contentsService.getClient().setOAuth2Token(oAuthToken);
    Repository repository = repositoryService.getRepository(userService.getUser().getLogin(), name);
    checkFileExists(contentsService, repository, "pom.xml");
    checkFileExists(contentsService, repository, "README.md");
}
 
开发者ID:WASdev,项目名称:tool.accelerate.core,代码行数:31,代码来源:GitHubRepositoryCreationTest.java

示例9: IssueEventCollector

import org.eclipse.egit.github.core.service.RepositoryService; //导入方法依赖的package包/类
public IssueEventCollector(String repoOwner, String repoName, String token) throws IssueEventException {
    gitHubClient = new GitHubClient();
    if (token != null) {
        gitHubClient.setOAuth2Token(token);
    }

    try {
        service = new RepositoryService(gitHubClient);
        repo = service.getRepository(repoOwner, repoName);
        eventService = new EventService(gitHubClient);
    } catch (IOException e) {
        throw new IssueEventException("Can not initialize repo! Check you config!", e);
    }
}
 
开发者ID:stola3,项目名称:github-issue-events-report,代码行数:15,代码来源:IssueEventCollector.java

示例10: connectGithub

import org.eclipse.egit.github.core.service.RepositoryService; //导入方法依赖的package包/类
private void connectGithub() throws IOException {
	GitHubClient client = new GitHubClient().setOAuth2Token( oauth2 );

	RepositoryService repositoryService = new RepositoryService( client );
	repository = repositoryService.getRepository( repositoryOwner, repositoryName );

	pullRequestService = new PullRequestService( client );
}
 
开发者ID:velo,项目名称:sonar-pull-request-integration,代码行数:9,代码来源:SonarPullRequestMojo.java

示例11: getBranches

import org.eclipse.egit.github.core.service.RepositoryService; //导入方法依赖的package包/类
private List<RepositoryBranch> getBranches(RepositoryService service) {
    List<RepositoryBranch> branches;
    try {
        String owner = getOwner();
        String name = getName();
        Repository repository = service.getRepository(owner, name);
        branches = service.getBranches(repository);
    } catch (IOException e) {
        throw new RuntimeException("Error getting the list of branches", e);
    }

    return branches;
}
 
开发者ID:rgamed,项目名称:jsoup-demo,代码行数:14,代码来源:ARepoLister.java

示例12: testCredentials

import org.eclipse.egit.github.core.service.RepositoryService; //导入方法依赖的package包/类
@Test
public void testCredentials() throws IOException {
    ARepoLister repoLister = new ARepoLister();
    String owner = repoLister.getOwner();
    String name = repoLister.getName();
    RepositoryService service = repoLister.initRepositoryService();
    try {
        service.getRepository(owner, name);
    } catch (RequestException e) {
        String msg = getRequestExceptionMsg(e);
        fail(msg);
    }
}
 
开发者ID:rgamed,项目名称:jsoup-demo,代码行数:14,代码来源:ARepoListerTest.java

示例13: doGet

import org.eclipse.egit.github.core.service.RepositoryService; //导入方法依赖的package包/类
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	String repoName = req.getParameter("repo");
	String auth = req.getParameter("access_token");
	String path = req.getParameter("path");
	String owner = req.getParameter("owner");
	
	GitHubClient client = new GitHubClient();
	client.setOAuth2Token(auth);
	
	RepositoryService repoService = new RepositoryService(client);
	Repository repo = repoService.getRepository(owner, repoName);
	ContentsService contentsService = new ContentsService(client);
	List<RepositoryContents> contents = contentsService.getContents(repo, path);
	
	JSONArray json = new JSONArray();
	
	try {
		for(RepositoryContents file : contents) {
			JSONObject fileJson = new JSONObject();
			fileJson.put("type", file.getType());
			fileJson.put("name", file.getName());
			
			json.put(fileJson);
		}
	} catch(JSONException e) {}
	
	resp.setContentType("application/json");
	resp.getWriter().write(json.toString());
}
 
开发者ID:DeveloperLiberationFront,项目名称:Pdf-Reviewer,代码行数:31,代码来源:FilesServlet.java

示例14: reportSuccesses

import org.eclipse.egit.github.core.service.RepositoryService; //导入方法依赖的package包/类
private void reportSuccesses(int successCounter) throws IOException {
 System.out.println(successCounter +" things went well");
 GitHubClient client = new GitHubClient();
 String botUserName = System.getProperty("testUserName");
 String botPassword = System.getProperty("testUserPass");
 client.setCredentials(botUserName, botPassword);
 
 String sha = System.getenv("TRAVIS_COMMIT");
 System.out.println("making a comment on commit "+sha);
 
 RepositoryService repoService = new RepositoryService(client);
 Repository repo = repoService.getRepository("DeveloperLiberationFront", "Pdf-Reviewer");
 CommitService service = new CommitService(client);
 CommitComment comment = new CommitComment();
 
    String message = "step | pass?\n" +
            "--- | --- \n" +
            "canary site online |  :fire: \n" +
            "authenticated with GitHub | :fire: \n" +
            "no carry over reviews |  ::fire: \n" +
            "created request |  :fire: \n" +
            "Uploaded pdf |  :fire: \n" +
            "Found issues in GitHub |  :fire: \n";
    
    for(int i = 0; i< successCounter; i++) {
        message = message.replaceFirst(":fire:", ":white_check_mark:");
    }

 comment.setBody(message);
    service.addComment(repo, sha, comment);
}
 
开发者ID:DeveloperLiberationFront,项目名称:Pdf-Reviewer,代码行数:32,代码来源:BrowserTest.java

示例15: getRepositoryByName

import org.eclipse.egit.github.core.service.RepositoryService; //导入方法依赖的package包/类
public Repository getRepositoryByName(String repoName,User u,String accessToken) throws Exception
{
	RepositoryService rService=new RepositoryService();
	rService.getClient().setOAuth2Token(accessToken);
	Repository repo=new Repository();
	repo.setName(repoName);
	repo.setOwner(u);
	repo=rService.getRepository(repo);
	return repo;
}
 
开发者ID:GitHubPager,项目名称:GitHubPager,代码行数:11,代码来源:PageManager.java


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