本文整理汇总了Java中hudson.scm.RepositoryBrowser类的典型用法代码示例。如果您正苦于以下问题:Java RepositoryBrowser类的具体用法?Java RepositoryBrowser怎么用?Java RepositoryBrowser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RepositoryBrowser类属于hudson.scm包,在下文中一共展示了RepositoryBrowser类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ChangeLogHandler
import hudson.scm.RepositoryBrowser; //导入依赖的package包/类
public ChangeLogHandler(Run<?, ?> run, RepositoryBrowser<?> browser, String credential) throws P4JavaException {
this.run = run;
this.browser = browser;
this.p4 = new ConnectionHelper(run, credential, null);
if (browser == null) {
try {
String url = p4.getSwarm();
if (url != null) {
this.browser = new SwarmBrowser(url);
}
} catch(RequestException re) {
if(re.getMessage() != null && !re.getMessage().contains("Unknown command")) {
throw re;
}
// else : Ignore, the command is not supported by older P4 versions
}
}
}
示例2: getChanges
import hudson.scm.RepositoryBrowser; //导入依赖的package包/类
public static List<Change> getChanges(AbstractBuild<?, ?> build) {
RepositoryBrowser repositoryBrowser = build.getProject().getScm().getBrowser();
List<Change> result = new ArrayList<>();
for (ChangeLogSet.Entry entry : build.getChangeSet()) {
UserInfo user = UserInfo.getUser(entry.getAuthor());
String changeLink = null;
if (repositoryBrowser != null) {
try {
@SuppressWarnings("unchecked")
URL link = repositoryBrowser.getChangeSetLink(entry);
if (link != null) {
changeLink = link.toExternalForm();
}
} catch (IOException e) {
LOG.log(Level.WARNING, "Could not get changeset link for: "
+ build.getProject().getFullDisplayName() + " " + build.getDisplayName(), e);
}
}
result.add(new Change(user, entry.getMsgAnnotated(), entry.getCommitId(), changeLink));
}
return result;
}
示例3: parse
import hudson.scm.RepositoryBrowser; //导入依赖的package包/类
/**
* Parse changelog.xml.
*
* @param build Current build.
* @param browser Current browser.
* @param changelogFile changelog.xml
*
* @return SCLMChangeLogSet from changelog.xml.
*
* @throws IOException
* @throws SAXException
*/
@Override
public SCLMChangeLogSet parse(Run build, RepositoryBrowser<?> browser,
File changelogFile)
throws IOException,
SAXException
{
Digester digester = new Digester2();
// Parse fields.
digester.addObjectCreate("*/changelog", LogSet.class);
digester.addSetProperties("*/changelog");
digester.addObjectCreate("*/changelog/entry", LogSet.Entry.class);
digester.addSetProperties("*/changelog/entry");
digester.addBeanPropertySetter("*/changelog/entry/date", "changeDate");
digester.addBeanPropertySetter("*/changelog/entry/project");
digester.addBeanPropertySetter("*/changelog/entry/alternate");
digester.addBeanPropertySetter("*/changelog/entry/group");
digester.addBeanPropertySetter("*/changelog/entry/type");
digester.addBeanPropertySetter("*/changelog/entry/name");
digester.addBeanPropertySetter("*/changelog/entry/version");
digester.addBeanPropertySetter("*/changelog/entry/userID");
digester.addBeanPropertySetter("*/changelog/entry/changeGroup");
digester.addBeanPropertySetter("*/changelog/entry/editType");
digester.addSetNext("*/changelog/entry", "addEntry");
// Do the actual parsing
InputStreamReader reader = new InputStreamReader(new FileInputStream(changelogFile), "UTF-8");
LogSet temp = (LogSet)digester.parse(reader);
reader.close();
// Convert to SCLMChangeLogSet
SCLMChangeLogSet res = new SCLMChangeLogSet(build,browser);
res.fromLogSet(temp);
return res;
}
示例4: parse
import hudson.scm.RepositoryBrowser; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public ChangeLogSet<? extends Entry> parse(Run run, RepositoryBrowser<?> browser, File file)
throws IOException, SAXException {
try {
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
ChangeLogHandler handler = new ChangeLogHandler(run, browser, credential);
parser.parse(file, handler);
P4ChangeSet changeSet = handler.getChangeLogSet();
return changeSet;
} catch (Exception e) {
throw new SAXException("Could not parse perforce changelog: ", e);
}
}
示例5: getBrowserDescriptors
import hudson.scm.RepositoryBrowser; //导入依赖的package包/类
@Restricted(DoNotUse.class)
public List<Descriptor<RepositoryBrowser<?>>> getBrowserDescriptors() {
return getSCMDescriptor().getBrowserDescriptors();
}
示例6: getBrowserDescriptors
import hudson.scm.RepositoryBrowser; //导入依赖的package包/类
public List<Descriptor<RepositoryBrowser<?>>> getBrowserDescriptors() {
return RepositoryBrowsers.filter(P4Browser.class);
}
示例7: P4ChangeSet
import hudson.scm.RepositoryBrowser; //导入依赖的package包/类
protected P4ChangeSet(Run<?, ?> run, RepositoryBrowser<?> browser, List<P4ChangeEntry> logs) {
super(run, browser);
this.history = Collections.unmodifiableList(logs);
}
示例8: testFreeStyleProject_buildLabel
import hudson.scm.RepositoryBrowser; //导入依赖的package包/类
@Test
public void testFreeStyleProject_buildLabel() throws Exception {
String url = "http://localhost";
P4WebBrowser browser = new P4WebBrowser(url);
FreeStyleProject project = jenkins.createFreeStyleProject("buildLabel");
StaticWorkspaceImpl workspace = new StaticWorkspaceImpl("none", false, defaultClient());
Populate populate = new AutoCleanImpl();
PerforceScm scm = new PerforceScm(CREDENTIAL, workspace, null, populate, browser);
project.setScm(scm);
project.save();
List<ParameterValue> list = new ArrayList<ParameterValue>();
list.add(new StringParameterValue(ReviewProp.STATUS.toString(), "committed"));
list.add(new StringParameterValue(ReviewProp.LABEL.toString(), "auto15"));
list.add(new StringParameterValue(ReviewProp.PASS.toString(), HTTP_URL + "/pass"));
Action actions = new SafeParametersAction(new ArrayList<ParameterValue>(), list);
FreeStyleBuild build;
Cause.UserIdCause cause = new Cause.UserIdCause();
build = project.scheduleBuild2(0, cause, actions).get();
assertEquals(Result.SUCCESS, build.getResult());
List<String> log = build.getLog(LOG_LIMIT);
assertTrue(log.contains("P4 Task: syncing files at change: 15"));
// Check web pages for changes
HtmlPage page = jenkins.createWebClient().getPage(build);
String text = page.asText();
assertTrue(text.contains("15 by jenkins (jenkins.data.ws)"));
page = jenkins.createWebClient().getPage(build, "changes");
text = page.asText();
assertTrue(text.contains("//depot/Main/file-14.txt #7"));
page = jenkins.createWebClient().getPage(build, "tagBuild");
HtmlForm label = page.getFormByName("label");
HtmlInput input = label.getInputByName("labelSubmit");
input.click();
page = jenkins.createWebClient().getPage(build, "tagBuild");
text = page.asText();
assertTrue(text.contains("Build-1\tJenkinsBuild: #1\tjenkins\[email protected]"));
// Check browser
Descriptor<RepositoryBrowser<?>> desc = browser.getDescriptor();
assertNotNull(desc);
P4WebBrowser.DescriptorImpl impl = (P4WebBrowser.DescriptorImpl) desc;
FormValidation form = impl.doCheck(url.toString());
assertEquals(FormValidation.Kind.OK, form.kind);
}
示例9: testFreeStyleProject_buildShelf
import hudson.scm.RepositoryBrowser; //导入依赖的package包/类
@Test
public void testFreeStyleProject_buildShelf() throws Exception {
String url = "http://localhost";
SwarmBrowser browser = new SwarmBrowser(url);
String client = "test.ws";
String format = "jenkins-${node}-${project}.ws";
FreeStyleProject project = jenkins.createFreeStyleProject("BuildShelf");
TemplateWorkspaceImpl workspace = new TemplateWorkspaceImpl("none", false, client, format);
Populate populate = new AutoCleanImpl();
PerforceScm scm = new PerforceScm(CREDENTIAL, workspace, populate);
project.setScm(scm);
project.save();
List<ParameterValue> list = new ArrayList<ParameterValue>();
list.add(new StringParameterValue(ReviewProp.STATUS.toString(), "shelved"));
list.add(new StringParameterValue(ReviewProp.REVIEW.toString(), "19"));
list.add(new StringParameterValue(ReviewProp.PASS.toString(), HTTP_URL + "/pass"));
Action actions = new SafeParametersAction(new ArrayList<ParameterValue>(), list);
FreeStyleBuild build;
Cause.UserIdCause cause = new Cause.UserIdCause();
build = project.scheduleBuild2(0, cause, actions).get();
assertEquals(Result.SUCCESS, build.getResult());
List<String> log = build.getLog(LOG_LIMIT);
assertTrue(log.contains("P4 Task: unshelve review: 19"));
// Check web pages for changes
HtmlPage page = jenkins.createWebClient().getPage(build);
String text = page.asText();
assertTrue(text.contains("19 by admin (admin.ws)"));
page = jenkins.createWebClient().getPage(build, "changes");
text = page.asText();
assertTrue(text.contains("Shelved Files:"));
// Check browser
Descriptor<RepositoryBrowser<?>> desc = browser.getDescriptor();
assertNotNull(desc);
SwarmBrowser.DescriptorImpl impl = (SwarmBrowser.DescriptorImpl) desc;
FormValidation form = impl.doCheck(url.toString());
assertEquals(FormValidation.Kind.OK, form.kind);
}
示例10: getBrowser
import hudson.scm.RepositoryBrowser; //导入依赖的package包/类
@Override
public RepositoryBrowser<?> getBrowser() {
return new MeanFakeRepositoryBrowser();
}
示例11: getBrowser
import hudson.scm.RepositoryBrowser; //导入依赖的package包/类
@Override
public RepositoryBrowser<?> getBrowser() {
return new FakeRepositoryBrowser();
}
示例12: SCLMChangeLogSet
import hudson.scm.RepositoryBrowser; //导入依赖的package包/类
/**
* Dummy constructor.
*
* @param run Current Run.
* @param browser Current Repository Browser.
*/
protected SCLMChangeLogSet(Run<?,?> run, RepositoryBrowser<?> browser)
{
super(run,browser);
this.items = new LinkedList<Entry>();
}
示例13: getRepositoryBrowser
import hudson.scm.RepositoryBrowser; //导入依赖的package包/类
/**
*
* @return a repository browser
*/
public RepositoryBrowser getRepositoryBrowser() {
return repositoryBrowser;
}