本文整理汇总了Java中hudson.model.FreeStyleBuild.getAction方法的典型用法代码示例。如果您正苦于以下问题:Java FreeStyleBuild.getAction方法的具体用法?Java FreeStyleBuild.getAction怎么用?Java FreeStyleBuild.getAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hudson.model.FreeStyleBuild
的用法示例。
在下文中一共展示了FreeStyleBuild.getAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test_readResolve
import hudson.model.FreeStyleBuild; //导入方法依赖的package包/类
@Test
public void test_readResolve() throws Exception {
FreeStyleProject p = rule.createFreeStyleProject("test");
FreeStyleBuild b = rule.assertBuildStatusSuccess(p.scheduleBuild2(0));
ContainerRecord r1 = new ContainerRecord("192.168.1.10", "cid", IMAGE_ID, "magic", System.currentTimeMillis(), Collections.<String, String>emptyMap());
DockerFingerprints.addRunFacet(r1, b);
Fingerprint fingerprint = DockerFingerprints.of(IMAGE_ID);
DockerRunFingerprintFacet facet = new DockerRunFingerprintFacet(fingerprint, System.currentTimeMillis(), IMAGE_ID);
ContainerRecord r2 = new ContainerRecord("192.168.1.10", "cid", null, "magic", System.currentTimeMillis(), Collections.<String, String>emptyMap());
facet.add(r2);
Assert.assertNull(r2.getImageId());
facet.readResolve();
Assert.assertEquals(IMAGE_ID, r2.getImageId());
// Check that actions have been automatically added
DockerFingerprintAction fpAction = b.getAction(DockerFingerprintAction.class);
Assert.assertNotNull("DockerFingerprintAction should be added automatically", fpAction);
Assert.assertTrue("Docker image should be referred in the action",
fpAction.getImageIDs().contains(IMAGE_ID));
}
示例2: testThatReportsArePresent
import hudson.model.FreeStyleBuild; //导入方法依赖的package包/类
@Test
public void testThatReportsArePresent() throws Exception {
/* =================== Prepare ================= */
new MockAutomateClient();
addBuildStep();
project.getBuildersList().add(new TouchBuilder());
project.getBuildersList().add(new CopyResourceFileToWorkspaceTarget("browserstack-reports", "REPORT-com.browserstack.automate.application.tests.TestCaseWithFourUniqueSessions.xml"));
project.getBuildersList().add(new CopyResourceFileToWorkspaceTarget("surefire-reports", "TEST-com.browserstack.automate.application.tests.TestCaseWithFourUniqueSessions.xml"));
JUnitResultArchiver jUnitResultArchiver = new JUnitResultArchiver("**/surefire-reports/*.xml");
jUnitResultArchiver.setTestDataPublishers(Collections.singletonList(new AutomateTestDataPublisher()));
project.getPublishersList().add(jUnitResultArchiver);
/* =================== Execute ================= */
FreeStyleBuild build = project.scheduleBuild2(0).get();
TestResultAction action = build.getAction(TestResultAction.class);
/* =================== Verify ================= */
List<TestResultAction.Data> testData = Deencapsulation.getField(action, "testData");
// Assumption here is that there is only one suite result based on the XML files
// copied into the workspace above.
SuiteResult suiteResult = action.getResult().getSuites().iterator().next();
jenkinsRule.assertBuildStatus(Result.SUCCESS, build);
Assert.assertNotNull("Additional data on the test MUST be set.", testData);
Assert.assertTrue("Additional Test data MUST have values.", testData.size() >= 1);
TestResultAction.Data data = testData.get(0);
Assert.assertTrue("Additional Test data MUST be an instance of AutomateActionData.", data instanceof AutomateActionData);
for (CaseResult caseResult : suiteResult.getCases()) {
AutomateTestAction automateTestAction = (AutomateTestAction) data.getTestAction(caseResult).get(0);
Session automateSession = automateTestAction.getSession();
Assert.assertNotNull("Automate Session should not be null.", automateSession);
Assert.assertTrue("Session Id should not be null or empty.", StringUtils.isNotEmpty(automateSession.getId()));
}
}
开发者ID:jenkinsci,项目名称:browserstack-integration-plugin,代码行数:38,代码来源:AutomateTestDataPublisherTest.java