本文整理汇总了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() {
{
}
};
}
示例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 );
}
示例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);
}
示例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 );
}
示例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();
}
}
示例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());
}
示例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();
}
}
}
示例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");
}
示例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);
}
}
示例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 );
}
示例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;
}
示例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);
}
}
示例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());
}
示例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);
}
示例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;
}