• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TestBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jvnet.hudson.test.TestBuilder的典型用法代码示例。如果您正苦于以下问题:Java TestBuilder类的具体用法?Java TestBuilder怎么用?Java TestBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TestBuilder类属于org.jvnet.hudson.test包,在下文中一共展示了TestBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setup

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
@Before
public void setup() throws IOException {
    fails = new HashSet<>();
    project = j.createFreeStyleProject();
    project.getBuildersList().add(new TestBuilder() {

        @Override
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
            return !fails.contains(build.getNumber());
        }
    });

    redsReport = new RedtimeReportPortlet("RedsReport") {

        @Override
        protected List<Job> getDashboardJobs() {
            return Collections.singletonList((Job) project);
        }

    };
}
 
开发者ID:oliveiragabriel07,项目名称:redtime,代码行数:22,代码来源:RedtimeReportPortletTest.java


示例2: testSymlinks

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
@Issue("JENKINS-20546")
@Test
public void testSymlinks() throws Exception {
    FreeStyleProject p1 = rule.createFreeStyleProject("p1");
    p1.getBuildersList().add(new TestBuilder() {
        @Override public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
            build.getWorkspace().child("plain").write("text", null);
            build.getWorkspace().child("link1").symlinkTo("plain", listener);
            build.getWorkspace().child("link2").symlinkTo("nonexistent", listener);
            return true;
        }
    });
    p1.getPublishersList().add(new ArtifactArchiver("**", "", false, false));
    rule.buildAndAssertSuccess(p1);
    FreeStyleProject p2 = rule.createFreeStyleProject("p2");
    p2.getBuildersList().add(CopyArtifactUtil.createRunSelector("p1", null, new StatusRunSelector(StatusRunSelector.BuildStatus.STABLE), null, "", false, false, true));
    FreeStyleBuild b = rule.buildAndAssertSuccess(p2);
    FilePath ws = b.getWorkspace();
    assertEquals("text", ws.child("plain").readToString());
    assertEquals("plain", ws.child("link1").readLink());
    assertEquals("nonexistent", ws.child("link2").readLink());
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:23,代码来源:CopyArtifactTest.java


示例3: push_ciSkip

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
@Test
public void push_ciSkip() throws IOException, InterruptedException {
    final OneShotEvent buildTriggered = new OneShotEvent();
    FreeStyleProject project = jenkins.createFreeStyleProject();
    project.getBuildersList().add(new TestBuilder() {
        @Override
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
            buildTriggered.signal();
            return true;
        }
    });
    project.setQuietPeriod(0);
    pushHookTriggerHandler.handle(project, pushHook()
            .withCommits(Arrays.asList(commit().withMessage("some message").build(),
                                       commit().withMessage("[ci-skip]").build()))
            .build(), true, newBranchFilter(branchFilterConfig().build(BranchFilterType.All)),
                                  newMergeRequestLabelFilter(null));

    buildTriggered.block(10000);
    assertThat(buildTriggered.isSignaled(), is(false));
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:22,代码来源:PushHookTriggerHandlerImplTest.java


示例4: pipeline_ciSkip

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
@Test
/**
 * always triggers since pipeline events do not contain ci skip message
 */
public void pipeline_ciSkip() throws IOException, InterruptedException {
    final OneShotEvent buildTriggered = new OneShotEvent();
    FreeStyleProject project = jenkins.createFreeStyleProject();
    project.getBuildersList().add(new TestBuilder() {
        @Override
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
            buildTriggered.signal();
            return true;
        }
    });
    project.setQuietPeriod(0);
    pipelineHookTriggerHandler.handle(project, pipelineHook , true, newBranchFilter(branchFilterConfig().build(BranchFilterType.All)),
        newMergeRequestLabelFilter(null));

    buildTriggered.block(10000);
    assertThat(buildTriggered.isSignaled(), is(true));
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:22,代码来源:PipelineHookTriggerHandlerImplTest.java


示例5: pipeline_build

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
@Test
public void pipeline_build() throws IOException, InterruptedException, GitAPIException, ExecutionException {

    final OneShotEvent buildTriggered = new OneShotEvent();
    FreeStyleProject project = jenkins.createFreeStyleProject();
    project.getBuildersList().add(new TestBuilder() {
        @Override
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
            buildTriggered.signal();
            return true;
        }
    });
    project.setQuietPeriod(0);

    pipelineHookTriggerHandler.handle(project, pipelineHook, false, newBranchFilter(branchFilterConfig().build(BranchFilterType.All)),
                                  newMergeRequestLabelFilter(null));

    buildTriggered.block(10000);
    assertThat(buildTriggered.isSignaled(), is(true));
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:21,代码来源:PipelineHookTriggerHandlerImplTest.java


示例6: mergeRequest_ciSkip

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
@Test
public void mergeRequest_ciSkip() throws IOException, InterruptedException {
    final OneShotEvent buildTriggered = new OneShotEvent();
    FreeStyleProject project = jenkins.createFreeStyleProject();
    project.getBuildersList().add(new TestBuilder() {
        @Override
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
            buildTriggered.signal();
            return true;
        }
    });
    project.setQuietPeriod(0);
    MergeRequestHookTriggerHandler mergeRequestHookTriggerHandler = new MergeRequestHookTriggerHandlerImpl(Arrays.asList(State.opened, State.reopened), false);
    mergeRequestHookTriggerHandler.handle(project, mergeRequestHook()
            .withObjectAttributes(mergeRequestObjectAttributes().withDescription("[ci-skip]").build())
            .build(), true, BranchFilterFactory.newBranchFilter(branchFilterConfig().build(BranchFilterType.All)),
                                          newMergeRequestLabelFilter(null));

    buildTriggered.block(10000);
    assertThat(buildTriggered.isSignaled(), is(false));
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:22,代码来源:MergeRequestHookTriggerHandlerImplTest.java


示例7: subscribeProject

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
protected void subscribeProject(final ProjectFixture fixture) throws Exception {
    String name = UUID.randomUUID().toString();

    final FreeStyleProject job = jenkinsRule.getInstance().createProject(FreeStyleProject.class, name);
    job.setScm(new NullSCM());
    if (fixture.getScm() != null) {
        job.setScm(fixture.getScm());
    }

    final String uuid = this.sqsQueue.getUuid();

    SQSTrigger trigger = null;

    if (fixture.isHasTrigger()) {
        trigger = new SQSTrigger(uuid, fixture.isSubscribeInternalScm(), fixture.getScmConfigs());
    }

    final OneShotEvent event = new OneShotEvent();
    job.getBuildersList().add(new TestBuilder() {

        @Override
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
            event.signal();
            fixture.setLastBuild(job.getLastBuild());
            return true;
        }
    });
    job.setQuietPeriod(0);

    if (trigger != null) {
        trigger.start(job, false);
        job.addTrigger(trigger);
    }

    fixture.setEvent(event);
}
 
开发者ID:riboseinc,项目名称:aws-codecommit-trigger-plugin,代码行数:37,代码来源:AbstractFreestyleIT.java


示例8: createMarathonFileBuilder

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
private TestBuilder createMarathonFileBuilder(final String payload) {
    return new TestBuilder() {
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
                               BuildListener listener) throws InterruptedException, IOException {
            build.getWorkspace().child("marathon.json").write(payload, "UTF-8");
            return true;
        }
    };
}
 
开发者ID:jenkinsci,项目名称:marathon-plugin,代码行数:10,代码来源:MarathonRecorderTest.java


示例9: runProjectWithWrapper

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
private FreeStyleProject runProjectWithWrapper(boolean useFirefox, boolean useChrome, boolean retainBuildOnFailure, DockerClient client, boolean failBuild) throws Exception {
    if (client == null) {
        dockerClient = mock(DockerClient.class);
    }
    FreeStyleProject p = jenkins.createFreeStyleProject();
    List<BrowserInstance> instances = new ArrayList<BrowserInstance>();
    if (useFirefox) {
        instances.add(new BrowserInstance(firefoxImage));
    }
    if (useChrome) {
        instances.add(new BrowserInstance(chromeImage));
    }
    
    TestgridBuildWrapper wrapper = new TestgridBuildWrapper(instances, retainBuildOnFailure);
    TestgridBuildWrapper.DescriptorImpl descriptor = wrapper.getDescriptor();
    descriptor.setHubImage(hubImage);
    
    p.getBuildWrappersList().add(wrapper.setDockerClient(dockerClient));
    when(dockerClient.getIpAddress(any(String.class))).thenReturn(ipAddress);
    p.getBuildersList().add(new GridUrlEnvBuilder());
    if (failBuild) {
        p.getBuildersList().add(new TestBuilder() {
            @Override
            public boolean perform(AbstractBuild<?, ?> abstractBuild, Launcher launcher, BuildListener buildListener) throws InterruptedException, IOException {
                return false;
            }
        });
    }
    jenkins.getInstance().rebuildDependencyGraph();
    p.scheduleBuild(new Cause.UserIdCause());
    jenkins.waitUntilNoActivity();

    return p;
}
 
开发者ID:DevOnGlobal,项目名称:testgrid-plugin,代码行数:35,代码来源:TestgridBuildWrapperTest.java


示例10: addCopyBuildStep

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
public static void addCopyBuildStep(FreeStyleProject p, final String fileName, final Class resourceClass, final String resourceName) {
    p.getBuildersList().add(new TestBuilder() {
        @Override
        public boolean perform(AbstractBuild build, Launcher launcher, BuildListener buildListener) throws InterruptedException, IOException {
            build.getWorkspace().child(fileName).copyFrom(resourceClass.getResourceAsStream(resourceName));
            return true;
        }
    });
}
 
开发者ID:uber,项目名称:phabricator-jenkins-plugin,代码行数:10,代码来源:TestUtils.java


示例11: echoBuilder

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
private Builder echoBuilder(final String fileName, final String content) {
    return new TestBuilder() {
        @Override
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
            build.getWorkspace().child(fileName).write(content, "UTF-8");
            return true;
        }
    };
}
 
开发者ID:uber,项目名称:phabricator-jenkins-plugin,代码行数:10,代码来源:BuildResultProcessorTest.java


示例12: testGetZipWithZip

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
@Test
public void testGetZipWithZip() throws Exception {
    final OneShotEvent buildEnded = new OneShotEvent();

    FreeStyleProject p = j.createFreeStyleProject();
    p.getBuildersList().add(new TestBuilder() {
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
                               BuildListener listener) throws InterruptedException, IOException {
            build.getWorkspace().child("echo.zip").copyFrom(new FileInputStream(testUtil.getResource("echo.zip")));
            buildEnded.signal();
            return true;
        }
    });

    p.scheduleBuild2(0);
    buildEnded.block();

    JenkinsLogger logger = new JenkinsLogger(System.out);
    WorkSpaceZipper workSpaceZipper = new WorkSpaceZipper(p.getSomeWorkspace(), logger);
    File zip = workSpaceZipper.getZip("echo.zip");

    assertTrue(zip.exists());
    assertTrue(zip.getAbsolutePath().contains("awslambda-"));

    ZipFile zipFile = new ZipFile(zip);
    assertNotNull(zipFile);
    assertNotNull(zipFile.getEntry("index.js"));
}
 
开发者ID:XT-i,项目名称:aws-lambda-jenkins-plugin,代码行数:29,代码来源:WorkSpaceZipperTest.java


示例13: testGetZipFolder

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
@Test
public void testGetZipFolder() throws Exception {
    final OneShotEvent buildEnded = new OneShotEvent();

    FreeStyleProject p = j.createFreeStyleProject();
    p.getBuildersList().add(new TestBuilder() {
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
                               BuildListener listener) throws InterruptedException, IOException {
            build.getWorkspace().child("echo").child("index.js").copyFrom(new FileInputStream(testUtil.getResource("echo/index.js")));
            buildEnded.signal();
            return true;
        }
    });

    p.scheduleBuild2(0);
    buildEnded.block();

    JenkinsLogger logger = new JenkinsLogger(System.out);
    WorkSpaceZipper workSpaceZipper = new WorkSpaceZipper(p.getSomeWorkspace(), logger);
    File zip = workSpaceZipper.getZip("echo");

    assertTrue(zip.exists());
    assertTrue(zip.getAbsolutePath().contains("awslambda-"));

    ZipFile zipFile = new ZipFile(zip);
    assertNotNull(zipFile);
    assertNotNull(zipFile.getEntry("index.js"));
}
 
开发者ID:XT-i,项目名称:aws-lambda-jenkins-plugin,代码行数:29,代码来源:WorkSpaceZipperTest.java


示例14: testGetZipFolderEmpty

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
@Test
public void testGetZipFolderEmpty() throws Exception {
    final OneShotEvent buildEnded = new OneShotEvent();

    FreeStyleProject p = j.createFreeStyleProject();
    p.getBuildersList().add(new TestBuilder() {
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
                               BuildListener listener) throws InterruptedException, IOException {
            build.getWorkspace().child("echo").mkdirs();
            buildEnded.signal();
            return true;
        }
    });

    p.scheduleBuild2(0);
    buildEnded.block();

    JenkinsLogger logger = new JenkinsLogger(System.out);
    WorkSpaceZipper workSpaceZipper = new WorkSpaceZipper(p.getSomeWorkspace(), logger);
    File zip = workSpaceZipper.getZip("echo");

    assertTrue(zip.exists());
    assertTrue(zip.getAbsolutePath().contains("awslambda-"));

    ZipFile zipFile = new ZipFile(zip);
    assertNotNull(zipFile);
    assertFalse(zipFile.entries().hasMoreElements());
}
 
开发者ID:XT-i,项目名称:aws-lambda-jenkins-plugin,代码行数:29,代码来源:WorkSpaceZipperTest.java


示例15: testBasicMerge

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
@Test
public void testBasicMerge() throws Exception {
    FreeStyleProject p = j.createFreeStyleProject();
    List<UserRemoteConfig> remotes = new ArrayList<UserRemoteConfig>();
    remotes.add(new UserRemoteConfig(repo.getPath(), "origin", "master", null));
    List<BranchSpec> branches = new ArrayList<BranchSpec>();
    branches.add(new BranchSpec("master"));
    p.setScm(new GitSCM(remotes, branches, false, null, null, null, null));

    // Init repo with release and feature branch.
    GitClient client = g.gitClient(repo);
    client.init();
    g.touchAndCommit(repo, "init");
    client.checkout("HEAD", "r1336");
    g.touchAndCommit(repo, "r1336");
    client.checkout("HEAD", "c3");
    g.touchAndCommit(repo, "c3");

    // Custom builder that merges feature branch with release branch using AdvancedSCMManager.
    p.getBuildersList().add(new TestBuilder() {
        @Override
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
            try {
                AdvancedSCMManager amm = SCMManagerFactory.getManager(build, launcher, listener);
                amm.update("r1336");
                amm.mergeWorkspaceWith("c3", null);
                amm.commit("merge c3", "test <[email protected]>");
                return true;
            } catch (Exception e) {
                e.printStackTrace(listener.getLogger());
                return false;
            }
        }
    });

    // Assert file is here (should be after successful merge)
    g.buildAndCheck(p, "c3");
}
 
开发者ID:jenkinsci,项目名称:gatekeeper-plugin,代码行数:39,代码来源:BasicGitTest.java


示例16: testBasicMerge

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
@Test
public void testBasicMerge() throws Exception {
    FreeStyleProject p = j.createFreeStyleProject();
    p.setScm(new MercurialSCM(null, repo.getPath(), "tip", null, null, null, false));

    // Init repo with release and feature branch.
    m.hg(repo, "init");
    m.hg(repo, "branch", "r1336");
    m.touchAndCommit(repo, "r1336");
    m.hg(repo, "branch", "c3");
    m.touchAndCommit(repo, "c3");

    // Custom builder that merges feature branch with release branch using AdvancedSCMManager.
    p.getBuildersList().add(new TestBuilder() {
        @Override
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
            try {
                AdvancedSCMManager amm = SCMManagerFactory.getManager(build, launcher, listener);
                amm.update("r1336");
                amm.mergeWorkspaceWith("c3", null);
                amm.commit("merge c3", "test <[email protected]>");
                return true;
            } catch (Exception e) {
                e.printStackTrace(listener.getLogger());
                return false;
            }
        }
    });

    // Assert file is here (should be after successful merge)
    m.buildAndCheck(p, "c3");
}
 
开发者ID:jenkinsci,项目名称:gatekeeper-plugin,代码行数:33,代码来源:BasicMercurialTest.java


示例17: note_ciSkip

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
@Test
public void note_ciSkip() throws IOException, InterruptedException {
    final OneShotEvent buildTriggered = new OneShotEvent();
    FreeStyleProject project = jenkins.createFreeStyleProject();
    project.getBuildersList().add(new TestBuilder() {
        @Override
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
            buildTriggered.signal();
            return true;
        }
    });
    Date currentDate = new Date();
    project.setQuietPeriod(0);
    noteHookTriggerHandler.handle(project, noteHook()
            .withObjectAttributes(noteObjectAttributes()
                .withId(1)
                .withNote("ci-run")
                .withAuthorId(1)
                .withProjectId(1)
                .withCreatedAt(currentDate)
                .withUpdatedAt(currentDate)
                .withUrl("https://gitlab.org/test/merge_requests/1#note_1")
                .build())
            .withMergeRequest(mergeRequestObjectAttributes().withDescription("[ci-skip]").build())
            .build(), true, BranchFilterFactory.newBranchFilter(branchFilterConfig().build(BranchFilterType.All)),
                                  newMergeRequestLabelFilter(null));

    buildTriggered.block(10000);
    assertThat(buildTriggered.isSignaled(), is(false));
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:31,代码来源:NoteHookTriggerHandlerImplTest.java


示例18: doHandle

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
private OneShotEvent doHandle(MergeRequestHookTriggerHandler mergeRequestHookTriggerHandler,
		MergeRequestObjectAttributesBuilder objectAttributes) throws GitAPIException, IOException, NoHeadException,
		NoMessageException, UnmergedPathsException, ConcurrentRefUpdateException, WrongRepositoryStateException,
		AmbiguousObjectException, IncorrectObjectTypeException, MissingObjectException, InterruptedException {
	Git.init().setDirectory(tmp.getRoot()).call();
       tmp.newFile("test");
       Git git = Git.open(tmp.getRoot());
       git.add().addFilepattern("test");
       RevCommit commit = git.commit().setMessage("test").call();
       ObjectId head = git.getRepository().resolve(Constants.HEAD);
       String repositoryUrl = tmp.getRoot().toURI().toString();

       final OneShotEvent buildTriggered = new OneShotEvent();
       FreeStyleProject project = jenkins.createFreeStyleProject();
       project.setScm(new GitSCM(repositoryUrl));
       project.getBuildersList().add(new TestBuilder() {
           @Override
           public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
               buildTriggered.signal();
               return true;
           }
       });
       project.setQuietPeriod(0);
	mergeRequestHookTriggerHandler.handle(project, mergeRequestHook()
               .withObjectAttributes(objectAttributes
           		    .withTargetBranch("refs/heads/" + git.nameRev().add(head).call().get(head))
           		    .withLastCommit(commit().withAuthor(user().withName("test").build()).withId(commit.getName()).build())
                   .build())
               .withProject(project()
                   .withWebUrl("https://gitlab.org/test.git")
                   .build()
               )
               .build(), true, BranchFilterFactory.newBranchFilter(branchFilterConfig().build(BranchFilterType.All)),
           newMergeRequestLabelFilter(null));

       buildTriggered.block(10000);
       return buildTriggered;
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:39,代码来源:MergeRequestHookTriggerHandlerImplTest.java


示例19: testResolveStatusBuilding

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
@Test
public void testResolveStatusBuilding() throws Exception {
    final OneShotEvent buildStarted = new OneShotEvent();
    final OneShotEvent buildBuilding = new OneShotEvent();

    FreeStyleProject project = jenkins.createFreeStyleProject();
    project.getBuildersList().add(new TestBuilder() {
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
                               BuildListener listener) throws InterruptedException, IOException {
            buildStarted.signal();
            buildBuilding.block();
            return true;
        }
    });

    project.scheduleBuild2(0);
    buildStarted.block(); // wait for the build to really start
    Status status = SimpleStatus.resolveStatus(project, project.getFirstBuild(), null);
    assertTrue(status.isRunning());
    buildBuilding.signal();
    jenkins.waitUntilNoActivity();
    assertNotNull(status.getTimestamp());
    assertTrue(status instanceof Running);
    Running running = (Running) status;
    assertTrue(running.getPercentage() > 0);
    assertTrue(running.isRunning());
    assertTrue(status.getType().equals(StatusType.RUNNING));
    assertNotNull(status.toString());
}
 
开发者ID:Diabol,项目名称:delivery-pipeline-plugin,代码行数:30,代码来源:SimpleStatusTest.java


示例20: testGetLatestRunning

import org.jvnet.hudson.test.TestBuilder; //导入依赖的package包/类
@Test
public void testGetLatestRunning() throws Exception {
    final String mockDescription = "some description";

    final OneShotEvent buildStarted = new OneShotEvent();
    final OneShotEvent buildBuilding = new OneShotEvent();

    FreeStyleProject project = jenkins.createFreeStyleProject("test");
    project.getBuildersList().add(new TestBuilder() {
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
                               BuildListener listener) throws InterruptedException, IOException {
            buildStarted.signal();
            buildBuilding.block();
            return true;
        }
    });
    Task prototype = Task.getPrototypeTask(project, true);

    project.scheduleBuild2(0);
    buildStarted.block(); // wait for the build to really start

    project.getLastBuild().setDescription(mockDescription);
    Task latest = prototype.getLatestTask(jenkins.getInstance(), project.getLastBuild());
    Task aggregated = prototype.getAggregatedTask(project.getLastBuild(), jenkins.getInstance());
    assertEquals("job/test/1/console", latest.getLink());
    assertTrue(latest.getStatus().isRunning());
    assertEquals(mockDescription, aggregated.getDescription());

    assertEquals("job/test/1/console", aggregated.getLink());
    assertTrue(aggregated.getStatus().isRunning());
    buildBuilding.signal();
    jenkins.waitUntilNoActivity();
}
 
开发者ID:Diabol,项目名称:delivery-pipeline-plugin,代码行数:34,代码来源:TaskTest.java



注:本文中的org.jvnet.hudson.test.TestBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JCConditional类代码示例发布时间:2022-05-22
下一篇:
Java ForceDirectedLayout类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap