本文整理汇总了Java中org.eclipse.egit.github.core.client.GitHubClient.setCredentials方法的典型用法代码示例。如果您正苦于以下问题:Java GitHubClient.setCredentials方法的具体用法?Java GitHubClient.setCredentials怎么用?Java GitHubClient.setCredentials使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.egit.github.core.client.GitHubClient
的用法示例。
在下文中一共展示了GitHubClient.setCredentials方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import org.eclipse.egit.github.core.client.GitHubClient; //导入方法依赖的package包/类
@Override
public GitHubGovernorClient build(
GitHubGovernorConfiguration governorConfiguration) throws Exception {
Validate.notNull(governorConfiguration, "GitHub governor configuration has to be set.");
this.gitHubGovernorConfiguration = governorConfiguration;
final GitHubClient gitHubClient = new GitHubClient();
if (this.gitHubGovernorConfiguration.getUsername() != null && this.gitHubGovernorConfiguration.getUsername().length() > 0 && this.gitHubGovernorConfiguration.getPassword() != null && this.gitHubGovernorConfiguration.getPassword().length() > 0) {
gitHubClient.setCredentials(this.gitHubGovernorConfiguration.getUsername(), this.gitHubGovernorConfiguration.getPassword());
}
if (this.gitHubGovernorConfiguration.getToken() != null && this.gitHubGovernorConfiguration.getToken().length() > 0) {
gitHubClient.setOAuth2Token(gitHubGovernorConfiguration.getToken());
}
final GitHubGovernorClient gitHubGovernorClient = new GitHubGovernorClient(gitHubClient, gitHubGovernorConfiguration);
gitHubGovernorClient.setGovernorStrategy(new GitHubGovernorStrategy(this.gitHubGovernorConfiguration));
return gitHubGovernorClient;
}
示例2: createGitHubClient
import org.eclipse.egit.github.core.client.GitHubClient; //导入方法依赖的package包/类
protected GitHubClient createGitHubClient() {
// GitHub client (non authentified)
GitHubClient client = new GitHubClient() {
@Override
protected HttpURLConnection configureRequest(HttpURLConnection request) {
HttpURLConnection connection = super.configureRequest(request);
connection.setRequestProperty(HEADER_ACCEPT, "application/vnd.github.v3.full+json");
return connection;
}
};
// Authentication
String oAuth2Token = configuration.getOauth2Token();
if (StringUtils.isNotBlank(oAuth2Token)) {
client.setOAuth2Token(oAuth2Token);
} else {
String user = configuration.getUser();
String password = configuration.getPassword();
if (StringUtils.isNotBlank(user)) {
client.setCredentials(user, password);
}
}
return client;
}
示例3: connect
import org.eclipse.egit.github.core.client.GitHubClient; //导入方法依赖的package包/类
public boolean connect(String username, String password){
this.username=username;
client = new GitHubClient();
client.setCredentials(username, password);
repoService = new MyRepositoriesService(client);
userService = new UserService(client);
issueService = new IssueService(client);
milestoneService = new MilestoneService(client);
labelService = new LabelService(client);
commitService = new CommitService(client);
markdownService = new MarkdownService(client);
colaboratorService = new CollaboratorService(client);
contentsService = new ContentsService(client);
try {
loadInformations();
return true;
} catch (IOException e) {
mainApp.writeNotification(e.getMessage());
return false;
}
}
示例4: PublishHelper
import org.eclipse.egit.github.core.client.GitHubClient; //导入方法依赖的package包/类
public PublishHelper(CommitterInfo parameterObject,String commitMessage, RepositoryId id) {
cl = new GitHubClient();
cl.setCredentials(parameterObject.login, parameterObject.password);
rs = new RepositoryService(cl);
service = new DataService(cl);
this.email=parameterObject.email;
this.name=parameterObject.name;
this.commitMessage=commitMessage;
this.id=id;
}
示例5: setup
import org.eclipse.egit.github.core.client.GitHubClient; //导入方法依赖的package包/类
@BeforeClass
public static void setup()
{
GitHubClient gitHubClient = new GitHubClient(GITHUB_URL);
gitHubClient.setUserAgent(USER_AGENT);
gitHubClient.setCredentials(DVCS_REPO_OWNER, DVCS_REPO_PASSWORD);
githubRepositoriesREST = new GithubRepositoriesRemoteRestpoint(gitHubClient);
}
示例6: createOAuthServiceRest
import org.eclipse.egit.github.core.client.GitHubClient; //导入方法依赖的package包/类
private OAuthService createOAuthServiceRest(final String repoOwner, final String repoPassword)
{
GitHubClient gitHubClient = new GitHubClient(GITHUB_URL);
gitHubClient.setUserAgent(USER_AGENT);
gitHubClient.setCredentials(repoOwner, repoPassword);
return new OAuthService(gitHubClient);
}
示例7: GitHubApi
import org.eclipse.egit.github.core.client.GitHubClient; //导入方法依赖的package包/类
public GitHubApi(GitHubProjectConfig config) {
GitHubCredentials gitHubCredentials = config.getGitHubCredentials();
GitHubUser gitHubUser = config.getGitHubUser();
gitHubClient = new GitHubClient();
gitHubClient.setCredentials(gitHubCredentials.getUsername(), gitHubCredentials.getPassword());
this.gitHubCommitUser = getGitHubCommitUser(gitHubUser.getName(), gitHubUser.getEmail());
repositoryService = new RepositoryService(gitHubClient);
dataService = new DataService(gitHubClient);
}
示例8: connect
import org.eclipse.egit.github.core.client.GitHubClient; //导入方法依赖的package包/类
@Override
public void connect(WebSCMConfig config, String username, String token) {
GitHubClient client = new GitHubClient();
client.setCredentials(username, token);
this.repositoryId = new RepositoryId(config.getOwner(), config.getName());
this.issueServ = new IssueService(client);
this.milestoneServ = new MilestoneService(client);
}
示例9: reportSuccesses
import org.eclipse.egit.github.core.client.GitHubClient; //导入方法依赖的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);
}
示例10: UpdateAll
import org.eclipse.egit.github.core.client.GitHubClient; //导入方法依赖的package包/类
public static void UpdateAll() throws IOException {
GitHubClient client = new GitHubClient();
client.setCredentials("ferhaterata", "");
RepositoryId repositoryId = new RepositoryId("modelwriter", "WP7");
IssueManagement.updateTasks(client, repositoryId);
// ModelWriterIssueManagement.loadDeliverableMap(client, repositoryId);
// ModelWriterIssueManagement.updateDeliverables(client, repositoryId);
// org.eclipse.egit.github.core.client.RequestException: Validation
// Failed (422): Label resource with 'name' field already exists
}
示例11: FetchUserRequirements
import org.eclipse.egit.github.core.client.GitHubClient; //导入方法依赖的package包/类
protected FetchUserRequirements() {
client = new GitHubClient();
client.setCredentials(Constants.USERNAME, Constants.PASSWORD);
repositoryId = new RepositoryId(Constants.ORGANIZATION, Constants.REPOSITORY);
}
示例12: FetchSoftwareRequirements
import org.eclipse.egit.github.core.client.GitHubClient; //导入方法依赖的package包/类
protected FetchSoftwareRequirements() {
client = new GitHubClient();
client.setCredentials(Constants.USERNAME, Constants.PASSWORD);
repositoryId = new RepositoryId(Constants.ORGANIZATION, Constants.REPOSITORY);
}
示例13: FetchSoftwareRequirementReviewMeeting
import org.eclipse.egit.github.core.client.GitHubClient; //导入方法依赖的package包/类
protected FetchSoftwareRequirementReviewMeeting() {
client = new GitHubClient();
client.setCredentials(Constants.USERNAME, Constants.PASSWORD);
repositoryId = new RepositoryId(Constants.ORGANIZATION, Constants.REPOSITORY);
}
示例14: FetchUserRequirementReviewMeeting
import org.eclipse.egit.github.core.client.GitHubClient; //导入方法依赖的package包/类
protected FetchUserRequirementReviewMeeting() {
client = new GitHubClient();
client.setCredentials(Constants.USERNAME, Constants.PASSWORD);
repositoryId = new RepositoryId(Constants.ORGANIZATION, Constants.REPOSITORY);
}
示例15: configure
import org.eclipse.egit.github.core.client.GitHubClient; //导入方法依赖的package包/类
@Override
public void configure(GitHubClient client) {
client.setCredentials(username, password);
}