当前位置: 首页>>代码示例>>Java>>正文


Java Issue类代码示例

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


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

示例1: argumentsToString

import org.jvnet.hudson.test.Issue; //导入依赖的package包/类
@Issue("JENKINS-45101")
@Test public void argumentsToString() throws Exception {
    story.addStep(new Statement() {
        @Override public void evaluate() throws Throwable {
            WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p");
            p.setDefinition(new CpsFlowDefinition(
                "node {\n" +
                 "    wrap([$class: 'AnsiColorBuildWrapper', colorMapName: 'xterm']) {}\n" +
                 "}", true));
            WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
            List<FlowNode> coreStepNodes = new DepthFirstScanner().filteredNodes(b.getExecution(), Predicates.and(new NodeStepTypePredicate("wrap"), new Predicate<FlowNode>() {
                @Override public boolean apply(FlowNode n) {
                    return n instanceof StepStartNode && !((StepStartNode) n).isBody();
                }
            }));
            assertThat(coreStepNodes, Matchers.hasSize(1));
            assertEquals("xterm", ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));
        }
    });
}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:21,代码来源:CoreWrapperStepTest.java

示例2: abortShouldNotRetry

import org.jvnet.hudson.test.Issue; //导入依赖的package包/类
@Issue("JENKINS-41276")
@Test
public void abortShouldNotRetry() throws Exception {
    r.jenkins.setSecurityRealm(r.createDummySecurityRealm());
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition(
            "int count = 0; retry(3) { echo 'trying '+(count++); semaphore 'start'; echo 'NotHere' } echo 'NotHere'", true));
    final WorkflowRun b = p.scheduleBuild2(0).waitForStart();
    SemaphoreStep.waitForStart("start/1", b);
    ACL.impersonate(User.get("dev").impersonate(), new Runnable() {
        @Override public void run() {
            b.getExecutor().doStop();
        }
    });
    r.assertBuildStatus(Result.ABORTED, r.waitForCompletion(b));
    r.assertLogContains("trying 0", b);
    r.assertLogContains("Aborted by dev", b);
    r.assertLogNotContains("trying 1", b);
    r.assertLogNotContains("trying 2", b);
    r.assertLogNotContains("NotHere", b);

}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:23,代码来源:RetryStepTest.java

示例3: smokes

import org.jvnet.hudson.test.Issue; //导入依赖的package包/类
@Issue("JENKINS-26942")
@Test public void smokes() throws Exception {
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition(
        "node {\n" +
        "  writeFile file: 'subdir/fname', text: 'whatever'\n" +
        "  writeFile file: 'subdir/other', text: 'more'\n" +
        "  dir('subdir') {stash 'whatever'}\n" +
        "}\n" +
        "node {\n" +
        "  dir('elsewhere') {\n" +
        "    unstash 'whatever'\n" +
        "    echo \"got fname: ${readFile 'fname'} other: ${readFile 'other'}\"\n" +
        "  }\n" +
        "  writeFile file: 'at-top', text: 'ignored'\n" +
        "  stash name: 'from-top', includes: 'elsewhere/', excludes: '**/other'\n" +
        "  semaphore 'ending'\n" +
        "}", true));
    WorkflowRun b = p.scheduleBuild2(0).waitForStart();
    SemaphoreStep.waitForStart("ending/1", b);
    assertEquals("{from-top={elsewhere/fname=whatever}, whatever={fname=whatever, other=more}}", StashManager.stashesOf(b).toString());
    SemaphoreStep.success("ending/1", null);
    r.assertBuildStatusSuccess(r.waitForCompletion(b));
    r.assertLogContains("got fname: whatever other: more", b);
    assertEquals("{}", StashManager.stashesOf(b).toString()); // TODO flake expected:<{[]}> but was:<{[from-top={elsewhere/fname=whatever}, whatever={fname=whatever, other=more}]}>
}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:27,代码来源:StashTest.java

示例4: testDefaultExcludes

import org.jvnet.hudson.test.Issue; //导入依赖的package包/类
@Issue("JENKINS-31086")
@Test public void testDefaultExcludes() throws Exception {
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition(
            "node {\n" +
                    "  writeFile file: 'subdir/.gitignore', text: 'whatever'\n" +
                    "  writeFile file: 'subdir/otherfile', text: 'whatever'\n" +
                    "  dir('subdir') {stash name:'has-gitignore', useDefaultExcludes: false}\n" +
                    "  dir('subdir') {stash name:'no-gitignore' }\n" +
                    "  dir('first-unstash') {\n" +
                    "    unstash('has-gitignore')\n" +
                    "    echo \"gitignore exists? ${fileExists '.gitignore'}\"\n" +
                    "  }\n" +
                    "  dir('second-unstash') {\n" +
                    "    unstash('no-gitignore')\n" +
                    "    echo \"gitignore does not exist? ${fileExists '.gitignore'}\"\n" +
                    "  }\n" +
                    "}", true));
    WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
    r.assertLogContains("gitignore exists? true", b);
    r.assertLogContains("gitignore does not exist? false", b);
}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:23,代码来源:StashTest.java

示例5: testAllowEmpty

import org.jvnet.hudson.test.Issue; //导入依赖的package包/类
@Issue("JENKINS-37327")
@Test public void testAllowEmpty() throws Exception {
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition(
            "node {\n" +
                    "  stash name: 'whatever', allowEmpty: true\n" +
                    "  semaphore 'ending'\n" +
                    "}\n"
                    , true));
    WorkflowRun b = p.scheduleBuild2(0).waitForStart();
    SemaphoreStep.waitForStart("ending/1", b);
    assertEquals("{whatever={}}", StashManager.stashesOf(b).toString());
    SemaphoreStep.success("ending/1", null);
    r.assertBuildStatusSuccess(r.waitForCompletion(b));
    r.assertLogContains("Stashed 0 file(s)", b);
    assertEquals("{}", StashManager.stashesOf(b).toString());
    List<FlowNode> coreStepNodes = new DepthFirstScanner().filteredNodes(b.getExecution(), new NodeStepTypePredicate("stash"));
    assertThat(coreStepNodes, Matchers.hasSize(1));
    assertEquals("whatever", ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));
}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:21,代码来源:StashTest.java

示例6: testHostNameValidation

import org.jvnet.hudson.test.Issue; //导入依赖的package包/类
/**
 * Direct unit test for host versification in SSL.
 * The test has been proposed as a patch in <a href="https://issues.apache.org/jira/browse/HTTPCLIENT-1265">HTTPCLIENT-1265</a>
 */
@Issue("SECURITY-555")
public void testHostNameValidation() {
    HttpClient client = new HttpClient();
    if (PROXY_HOST != null) {
        if (PROXY_USER != null) {
            HttpState state = client.getState();
            state.setProxyCredentials(AuthScope.ANY, new UsernamePasswordCredentials(
                    PROXY_USER, PROXY_PASS));
        }
        client.getHostConfiguration().setProxy(PROXY_HOST, Integer.parseInt(PROXY_PORT));
    }
    GetMethod method = new GetMethod(_urlWithIp);

    try {
        client.executeMethod(method);
        fail("Invalid hostname not detected");
    } catch (SSLException e) {
        assertTrue("Connection with a invalid server certificate rejected", true);
    } catch (Throwable t) {
        t.printStackTrace();
        fail("Unexpected exception" + t.getMessage());
    }
}
 
开发者ID:jenkinsci,项目名称:lib-commons-httpclient,代码行数:28,代码来源:TestHttps.java

示例7: testMostlyAbsolute

import org.jvnet.hudson.test.Issue; //导入依赖的package包/类
@Issue("JENKINS-19833")
@Test
public void testMostlyAbsolute() throws Exception {
    MockFolder folder = rule.jenkins.createProject(MockFolder.class, "folder");
    FreeStyleProject other = folder.createProject(FreeStyleProject.class, "foo");
    other.getBuildersList().add(new ArtifactBuilder());
    other.getPublishersList().add(new ArtifactArchiver("**", "", false, false));

    MockFolder folder2 = rule.jenkins.createProject(MockFolder.class, "other");
    FreeStyleProject p = folder2.createProject(FreeStyleProject.class, "bar");

    // "folder/foo" should be resolved as "/folder/foo" even from "/other/bar", for backward compatibility
    p.getBuildersList().add(CopyArtifactUtil.createRunSelector("folder/foo", null, new StatusRunSelector(StatusRunSelector.BuildStatus.STABLE), "", "", false, false, true));

    rule.assertBuildStatusSuccess(other.scheduleBuild2(0, new UserCause()).get());
    FreeStyleBuild b = p.scheduleBuild2(0, new UserCause()).get();
    rule.assertBuildStatusSuccess(b);
    assertFile(true, "foo.txt", b);
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:20,代码来源:CopyArtifactTest.java

示例8: testSymlinks

import org.jvnet.hudson.test.Issue; //导入依赖的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

示例9: testUnsetVar

import org.jvnet.hudson.test.Issue; //导入依赖的package包/类
@Issue("JENKINS-14266")
@Test
public void testUnsetVar() throws Exception {
    FreeStyleProject selecter = j.createFreeStyleProject();
    RunSelector selector = new BuildNumberRunSelector("$NUM");

    Run run = j.assertBuildStatusSuccess(selecter.scheduleBuild2(
            0,
            new Cause.UserIdCause(),
            new ParametersAction(
                    new StringParameterValue("NUM", "2")
            )
    ));
    Run selectedRun = selector.select(jobToSelect, new RunSelectorContext(j.jenkins, run, TaskListener.NULL));
    assertThat(selectedRun.getNumber(), is(2));

    run = j.assertBuildStatusSuccess(selecter.scheduleBuild2(
            0,
            new Cause.UserIdCause(),
            new ParametersAction(
                    new StringParameterValue("HUM", "two")
            )
    ));
    selectedRun = selector.select(jobToSelect, new RunSelectorContext(j.jenkins, run, TaskListener.NULL));
    assertThat(selectedRun, nullValue());
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:27,代码来源:BuildNumberRunSelectorTest.java

示例10: testWorkflow

import org.jvnet.hudson.test.Issue; //导入依赖的package包/类
/**
 * Also applicable for workflow jobs.
 */
@Issue("JENKINS-30357")
@Test
public void testWorkflow() throws Exception {
    FreeStyleProject jobToSelect = j.createFreeStyleProject();
    Run runToSelect = j.assertBuildStatusSuccess(jobToSelect.scheduleBuild2(0));

    WorkflowJob selecter = createWorkflowJob();

    ParameterDefinition paramDef = new StringParameterDefinition(
            "SELECTOR", "<StatusRunSelector><buildStatus>STABLE</buildStatus></StatusRunSelector>"
    );
    selecter.addProperty(new ParametersDefinitionProperty(paramDef));

    selecter.setDefinition(new CpsFlowDefinition(String.format("" +
            "def runWrapper = selectRun job: '%s', " +
            " selector: [$class: 'ParameterizedRunSelector', parameterName: '${SELECTOR}'] \n" +
            "assert(runWrapper.id == '%s')", jobToSelect.getFullName(), runToSelect.getId())));

    j.assertBuildStatusSuccess(selecter.scheduleBuild2(0));
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:24,代码来源:ParameterizedRunSelectorTest.java

示例11: modifiedWhileSerialized

import org.jvnet.hudson.test.Issue; //导入依赖的package包/类
@Test @Issue("JENKINS-41037")
public void modifiedWhileSerialized() throws Exception {
    final CloudStatistics cs = CloudStatistics.get();
    final CloudStatistics.ProvisioningListener l = CloudStatistics.ProvisioningListener.get();
    final ProvisioningActivity activity = l.onStarted(new ProvisioningActivity.Id("Cloud", "template", "PAOriginal"));
    final StatsModifyingAttachment blocker = new StatsModifyingAttachment(OK, "Blocker");
    Computer.threadPoolForRemoting.submit(new Callable<Object>() {
        @Override public Object call() throws Exception {
            cs.attach(activity, PROVISIONING, blocker);
            cs.persist();
            return null;
        }
    }).get();

    String serialized = cs.getConfigFile().asString();
    assertThat(serialized, not(containsString("ConcurrentModificationException")));
    assertThat(serialized, not(containsString("active class=\"linked-hash-set\"")));
    assertThat(serialized, containsString("Blocker"));
    assertThat(serialized, containsString("PAOriginal"));
    assertThat(serialized, containsString("PAModifying"));
    assertThat(serialized, containsString("active class=\"java.util.concurrent.CopyOnWriteArrayList\""));
}
 
开发者ID:jenkinsci,项目名称:cloud-stats-plugin,代码行数:23,代码来源:CloudStatisticsTest.java

示例12: cd

import org.jvnet.hudson.test.Issue; //导入依赖的package包/类
@Issue("JENKINS-33510")
@Test public void cd() throws Exception {
    story.addStep(new Statement() {
        @Override public void evaluate() throws Throwable {
            DockerTestUtil.assumeDocker(new VersionNumber("17.12"));
            WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj");
            p.setDefinition(new CpsFlowDefinition(
                "node {\n" +
                "  withDockerContainer('ubuntu') {\n" +
                "    sh 'mkdir subdir && echo somecontent > subdir/file'\n" +
                "    dir('subdir') {\n" +
                "      sh 'pwd; tr \"a-z\" \"A-Z\" < file'\n" +
                "    }\n" +
                "  }\n" +
                "}", true));
            WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
            story.j.assertLogContains("SOMECONTENT", b);
        }
    });
}
 
开发者ID:jenkinsci,项目名称:docker-workflow-plugin,代码行数:21,代码来源:WithContainerStepTest.java

示例13: wheezy

import org.jvnet.hudson.test.Issue; //导入依赖的package包/类
@Ignore("TODO reproducible")
@Issue("JENKINS-40101")
@Test public void wheezy() {
    story.addStep(new Statement() {
        @Override public void evaluate() throws Throwable {
            DockerTestUtil.assumeDocker();
            WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj");
            p.setDefinition(new CpsFlowDefinition(
                "node {\n" +
                "  withDockerContainer('debian:wheezy') {\n" +
                "    sh 'sleep 30s && echo ran OK'\n" +
                "  }\n" +
                "}", true));
            WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
            story.j.assertLogContains("ran OK", b);
        }
    });
}
 
开发者ID:jenkinsci,项目名称:docker-workflow-plugin,代码行数:19,代码来源:WithContainerStepTest.java

示例14: testImageUrl

import org.jvnet.hudson.test.Issue; //导入依赖的package包/类
@Issue({"JENKINS-48674"})
@WithoutJenkins
@Test
public void testImageUrl() throws MalformedURLException {
    assertEquals(new URL("https://get.docker.com/builds/Linux/x86_64/docker-1.10.0"), DockerToolInstaller.getDockerImageUrl("linux/x86_64", "1.10.0"));
    assertEquals(new URL("https://get.docker.com/builds/Windows/x86_64/docker-1.10.0"), DockerToolInstaller.getDockerImageUrl("win/x86_64","1.10.0"));
    assertEquals(new URL("https://get.docker.com/builds/Darwin/x86_64/docker-1.10.0"), DockerToolInstaller.getDockerImageUrl("mac/x86_64","1.10.0"));
    assertEquals(new URL("https://get.docker.com/builds/Linux/x86_64/docker-17.05.0-ce"), DockerToolInstaller.getDockerImageUrl("linux/x86_64", "17.05.0-ce"));
    assertEquals(new URL("https://get.docker.com/builds/Windows/x86_64/docker-17.05.0-ce"), DockerToolInstaller.getDockerImageUrl("win/x86_64","17.05.0-ce"));
    assertEquals(new URL("https://get.docker.com/builds/Darwin/x86_64/docker-17.05.0-ce"), DockerToolInstaller.getDockerImageUrl("mac/x86_64","17.05.0-ce"));
    assertEquals(new URL("https://get.docker.com/builds/Linux/x86_64/docker-latest"), DockerToolInstaller.getDockerImageUrl("linux/x86_64", "latest"));
    assertEquals(new URL("https://get.docker.com/builds/Windows/x86_64/docker-latest"), DockerToolInstaller.getDockerImageUrl("win/x86_64","latest"));
    assertEquals(new URL("https://get.docker.com/builds/Darwin/x86_64/docker-latest"), DockerToolInstaller.getDockerImageUrl("mac/x86_64","latest"));
    assertEquals(new URL("https://download.docker.com/linux/static/edge/x86_64/docker-17.09.0-ce"), DockerToolInstaller.getDockerImageUrl("linux/x86_64", "17.09.0-ce"));
    assertEquals(new URL("https://download.docker.com/win/static/edge/x86_64/docker-17.09.0-ce"), DockerToolInstaller.getDockerImageUrl("win/x86_64","17.09.0-ce"));
    assertEquals(new URL("https://download.docker.com/mac/static/edge/x86_64/docker-17.09.0-ce"), DockerToolInstaller.getDockerImageUrl("mac/x86_64","17.09.0-ce"));
}
 
开发者ID:jenkinsci,项目名称:docker-commons-plugin,代码行数:18,代码来源:DockerToolInstallerTest.java

示例15: sshagent

import org.jvnet.hudson.test.Issue; //导入依赖的package包/类
@Issue({ "JENKINS-47225", "JENKINS-42582" })
@Test
public void sshagent() throws Exception {
    PrivateKeySource source = new BasicSSHUserPrivateKey.DirectEntryPrivateKeySource(
            new String(IOUtils.toByteArray(getClass().getResourceAsStream("id_rsa"))));
    BasicSSHUserPrivateKey credentials = new BasicSSHUserPrivateKey(CredentialsScope.GLOBAL,
            "ContainerExecDecoratorPipelineTest-sshagent", "bob", source, "secret_passphrase", "test credentials");
    SystemCredentialsProvider.getInstance().getCredentials().add(credentials);

    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "sshagent");
    p.setDefinition(new CpsFlowDefinition(loadPipelineScript("sshagent.groovy"), true));
    WorkflowRun b = p.scheduleBuild2(0).waitForStart();
    assertNotNull(b);
    r.waitForCompletion(b);
    r.assertLogContains("Identity added:", b);
    //check that we don't accidentally start exporting sensitive info to the log
    r.assertLogNotContains("secret_passphrase", b);
}
 
开发者ID:carlossg,项目名称:jenkins-kubernetes-plugin,代码行数:19,代码来源:ContainerExecDecoratorPipelineTest.java


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