本文整理汇总了Java中org.eclipse.egit.github.core.service.ContentsService类的典型用法代码示例。如果您正苦于以下问题:Java ContentsService类的具体用法?Java ContentsService怎么用?Java ContentsService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContentsService类属于org.eclipse.egit.github.core.service包,在下文中一共展示了ContentsService类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testLoad
import org.eclipse.egit.github.core.service.ContentsService; //导入依赖的package包/类
@Test
public void testLoad() throws Exception {
final GitConfig config = new GitConfig("somehost", "someowner",
"somerepo", "master", "somefile", "aoth_token");
final ContentsService contentService = mock(ContentsService.class);
final GitCacheLoader loader = new GitCacheLoader(config,
contentService);
when(contentService.getContents(anyObject(),
eq("staging.json"),
eq("master")))
.thenReturn(ImmutableList
.of(createRepositoryContents(testConfiguration1)));
final Map<String, Configuration> configurations = loader.load("staging.json");
assertThat(configurations.size(), equalTo(1));
assertThat(configurations.get("express.feature.toggle"), notNullValue());
}
开发者ID:zalando-stups,项目名称:baigan-config,代码行数:22,代码来源:GitCacheLoaderTest.java
示例2: onPreExecute
import org.eclipse.egit.github.core.service.ContentsService; //导入依赖的package包/类
@Override
protected void onPreExecute() {
mainFragment.setRefreshStatus(true);
context = mainFragment.getContentView().getContext();
refreshType = mainFragment.getRefreshType();
GitHubClient gitHubClient = mainFragment.getGitHubClient();
contentsService = new ContentsService(gitHubClient);
String repoOwner = mainFragment.getRepoOwner();
String repoName = mainFragment.getRepoName();
repositoryId = RepositoryId.create(repoOwner, repoName);
repoPath = mainFragment.getRepoPath();
contentItemAdapter = mainFragment.getContentItemAdapter();
contentItemList = mainFragment.getContentItemList();
contentItemListBuffer = mainFragment.getContentItemListBuffer();
mainFragment.setContentShown(false);
}
开发者ID:mthli,项目名称:Bitocle,代码行数:22,代码来源:ContentTask.java
示例3: connect
import org.eclipse.egit.github.core.service.ContentsService; //导入依赖的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;
}
}
开发者ID:ThibaudL,项目名称:GitHubProjectManagement,代码行数:27,代码来源:GitHubModel.java
示例4: getFileFromRepository
import org.eclipse.egit.github.core.service.ContentsService; //导入依赖的package包/类
public RepositoryContents getFileFromRepository(Repository repo, String path, String ref,String accessToken) throws Exception
{
ContentsService rService=new ContentsService();
rService.getClient().setOAuth2Token(accessToken);
logger.info("Try to get file using common content service "+repo.getName()+path+ref);
try
{
List<RepositoryContents> cList= rService.getContents(repo,path,ref);
return cList.get(0);
}
catch(IOException e)
{
if(e.getMessage().contains("404"))
{
return null;
}
throw e;
}
}
开发者ID:GitHubPager,项目名称:GitHubPager,代码行数:21,代码来源:PageManager.java
示例5: GitHubBuilder
import org.eclipse.egit.github.core.service.ContentsService; //导入依赖的package包/类
public GitHubBuilder(String token) {
this.githubClient = new GitHubClient();
githubClient.setOAuth2Token(token);
uService = new UserService(githubClient);
oService = new OrganizationService(githubClient);
service = new RepositoryService(githubClient);
cService = new ContentsService(githubClient);
dService = new DataService(githubClient);
commitService = new CommitService(githubClient);
}
开发者ID:dockstore,项目名称:write_api_service,代码行数:12,代码来源:GitHubBuilder.java
示例6: testReload
import org.eclipse.egit.github.core.service.ContentsService; //导入依赖的package包/类
@Test
public void testReload() throws Exception {
final GitConfig config = new GitConfig("somehost", "someowner",
"somerepo", "master", "somefile", "aoth_token");
final ContentsService contentService = mock(ContentsService.class);
final GitCacheLoader loader = new GitCacheLoader(config,
contentService);
when(contentService.getContents(anyObject(),
eq("staging.json"),
eq("master")))
.thenReturn(ImmutableList
.of(createRepositoryContents(testConfiguration1)));
Map<String, Configuration> configurations = loader.load("staging.json");
assertThat(configurations.size(), equalTo(1));
assertThat(configurations.get("express.feature.toggle"), notNullValue());
when(contentService.getContents(anyObject(),
eq("staging.json"),
eq("master")))
.thenReturn(ImmutableList
.of(createRepositoryContents(testConfiguration2)));
final ListenableFuture<Map<String, Configuration>> configurations2Future = loader
.reload("staging.json", configurations);
final Map<String, Configuration> configurations2 = configurations2Future
.get();
assertThat(configurations2, Matchers.not(configurations));
assertThat(configurations2.size(), equalTo(2));
assertThat(configurations.get("express.feature.toggle"), notNullValue());
assertThat(configurations2.get("express.feature.serviceUrl"), notNullValue());
}
开发者ID:zalando-stups,项目名称:baigan-config,代码行数:39,代码来源:GitCacheLoaderTest.java
示例7: testForegoReloadForUnchanged
import org.eclipse.egit.github.core.service.ContentsService; //导入依赖的package包/类
@Test
public void testForegoReloadForUnchanged() throws Exception {
final GitConfig config = new GitConfig("somehost", "someowner",
"somerepo", "master", "somefile", "aoth_token");
final ContentsService contentService = mock(ContentsService.class);
final GitCacheLoader loader = new GitCacheLoader(config, contentService);
when(contentService.getContents(anyObject(),
eq("staging.json"),
eq("master")))
.thenReturn(ImmutableList
.of(createRepositoryContents(testConfiguration2)));
final Map<String, Configuration> configurations1 = loader.load("staging.json");
when(contentService.getContents(anyObject(),
eq("staging.json"),
eq("master")))
.thenReturn(ImmutableList
.of(createRepositoryContents(testConfiguration2)));
final ListenableFuture<Map<String, Configuration>> configurations2Future = loader
.reload("staging.json", configurations1);
final Map<String, Configuration> configurations2 = configurations2Future.get();
assertThat(configurations2, equalTo(configurations1));
}
开发者ID:zalando-stups,项目名称:baigan-config,代码行数:31,代码来源:GitCacheLoaderTest.java
示例8: testReloadWithIOExceptionInConcentService
import org.eclipse.egit.github.core.service.ContentsService; //导入依赖的package包/类
@Test
public void testReloadWithIOExceptionInConcentService() throws Exception {
final GitConfig config = new GitConfig("somehost", "someowner",
"somerepo", "master", "somefile", "aoth_token");
final ContentsService contentService = mock(ContentsService.class);
final GitCacheLoader loader = new GitCacheLoader(config, contentService);
when(
contentService.getContents(anyObject(),
eq("staging.json"),
eq("master")))
.thenReturn(ImmutableList
.of(createRepositoryContents(testConfiguration1)));
Map<String, Configuration> configurations = loader.load("staging.json");
assertThat(configurations.size(), equalTo(1));
assertThat(configurations.get("express.feature.toggle"),
notNullValue());
//throw exception on retrieval
doThrow(new IOException())
.when(contentService).getContents(anyObject(),
eq("staging.json"),
eq("master"));
final ListenableFuture<Map<String, Configuration>> configurations2Future = loader
.reload("staging.json", configurations);
final Map<String, Configuration> configurations2 = configurations2Future.get();
assertThat(configurations2, equalTo(configurations));
}
开发者ID:zalando-stups,项目名称:baigan-config,代码行数:35,代码来源:GitCacheLoaderTest.java
示例9: testGitHubRepositoryCreation
import org.eclipse.egit.github.core.service.ContentsService; //导入依赖的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
示例10: HttpImageGetter
import org.eclipse.egit.github.core.service.ContentsService; //导入依赖的package包/类
/**
* Create image getter for context
*
* @param context
* @param service
*/
@Inject
public HttpImageGetter(Context context, ContentsService service) {
this.context = context;
this.service = service;
dir = context.getCacheDir();
width = ServiceUtils.getDisplayWidth(context);
loading = new LoadingImageGetter(context, 24);
}
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:15,代码来源:HttpImageGetter.java
示例11: doGet
import org.eclipse.egit.github.core.service.ContentsService; //导入依赖的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
示例12: buildContentsService
import org.eclipse.egit.github.core.service.ContentsService; //导入依赖的package包/类
private static ContentsService buildContentsService(@Nonnull final GitConfig gitConfig) {
Objects.requireNonNull(gitConfig, "gitConfig is required");
final GitHubClient client = new GitHubClient(gitConfig.getGitHost());
client.setOAuth2Token(gitConfig.getOauthToken());
return new ContentsService(client);
}
开发者ID:zalando-stups,项目名称:baigan-config,代码行数:7,代码来源:GitCacheLoader.java
示例13: GitCacheLoader
import org.eclipse.egit.github.core.service.ContentsService; //导入依赖的package包/类
@VisibleForTesting
GitCacheLoader(GitConfig gitConfig, ContentsService contentsService) {
this.config = gitConfig;
this.contentsService = contentsService;
}
开发者ID:zalando-stups,项目名称:baigan-config,代码行数:6,代码来源:GitCacheLoader.java
示例14: checkFileExists
import org.eclipse.egit.github.core.service.ContentsService; //导入依赖的package包/类
private void checkFileExists(ContentsService contentsService, Repository repository, String path) throws IOException {
List<RepositoryContents> file = contentsService.getContents(repository, path);
assertThat(file, hasSize(1));
assertThat(file.get(0).getSize(), greaterThan(0L));
}
开发者ID:WASdev,项目名称:tool.accelerate.core,代码行数:6,代码来源:GitHubRepositoryCreationTest.java
注:本文中的org.eclipse.egit.github.core.service.ContentsService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论