Java 类hudson.model.Failure 实例源码

项目:aws-codepipeline-plugin-for-jenkins    文件:ValidationTest.java   
@Test
public void validatePluginNoCredentialsFailure() {
    final String error = "AWS CodePipeline Jenkins plugin setup error. One or more required configuration parameters have not been specified." + System.lineSeparator() +
            "The AWS credentials provided are not valid.";

    thrown.expect(Failure.class);
    thrown.expectMessage(error);

    Validation.validatePlugin(
            null,
            null,
            "us-east-1",
            CategoryType.Build.getName(),
            "Jenkins-Build",
            "1",
            "ProjectName",
            null);
}
项目:aws-codepipeline-plugin-for-jenkins    文件:ValidationTest.java   
@Test
public void validatePluginNoRegionFailure() {
    final String error = "AWS CodePipeline Jenkins plugin setup error. One or more required configuration parameters have not been specified." + System.lineSeparator();
    final String regionError =  "The specified AWS region is not valid.";

    thrown.expect(Failure.class);
    thrown.expectMessage(error);
    thrown.expectMessage(regionError);

    Validation.validatePlugin(
            "",
            "",
            "",
            CategoryType.Build.getName(),
            "Jenkins-Build",
            "1",
            "ProjectName",
            null);
}
项目:aws-codepipeline-plugin-for-jenkins    文件:ValidationTest.java   
@Test
public void validatePluginInvalidActionTypeProviderFailure() {
    final String error = "AWS CodePipeline Jenkins plugin setup error. One or more required configuration parameters have not been specified." + System.lineSeparator();

    thrown.expect(Failure.class);
    thrown.expectMessage(error);
    thrown.expectMessage("Category:");
    thrown.expectMessage("Version: 1");
    thrown.expectMessage("Provider:");

    Validation.validatePlugin(
            "",
            "",
            "us-east-1",
            CategoryType.Build.getName(),
            "",
            "1",
            "ProjectName",
            null);
}
项目:aws-codepipeline-plugin-for-jenkins    文件:ValidationTest.java   
@Test
public void validatePluginInvalidActionTypeCategoryFailure() {
    final String error = "AWS CodePipeline Jenkins plugin setup error. One or more required configuration parameters have not been specified." + System.lineSeparator();

    thrown.expect(Failure.class);
    thrown.expectMessage(error);
    thrown.expectMessage("Category: Please Choose A Category");
    thrown.expectMessage("Version: 1");
    thrown.expectMessage("Provider: Jenkins-Build");

    Validation.validatePlugin(
            "",
            "",
            "us-east-1",
            CategoryType.PleaseChooseACategory.getName(),
            "Jenkins-Build",
            "1",
            "ProjectName",
            null);
}
项目:aws-codepipeline-plugin-for-jenkins    文件:ValidationTest.java   
@Test
public void validatePluginInvalidActionTypeVersionFailure() {
    final String error = "AWS CodePipeline Jenkins plugin setup error. One or more required configuration parameters have not been specified." + System.lineSeparator();

    thrown.expect(Failure.class);
    thrown.expectMessage(error);
    thrown.expectMessage("Category: Build");
    thrown.expectMessage("Version:");
    thrown.expectMessage("Provider: Jenkins-Build");

    Validation.validatePlugin(
            "",
            "",
            "us-east-1",
            CategoryType.Build.getName(),
            "Jenkins-Build",
            "",
            "ProjectName",
            null);
}
项目:aws-codepipeline-plugin-for-jenkins    文件:ValidationTest.java   
@Test
public void validatePluginAllFieldsMissingFailure() {
    thrown.expect(Failure.class);
    thrown.expectMessage("AWS CodePipeline Jenkins plugin setup error. One or more required configuration parameters have not been specified.");
    thrown.expectMessage("The specified AWS region is not valid.");
    thrown.expectMessage("The AWS credentials provided are not valid.");

    Validation.validatePlugin(
            null,
            null,
            "",
            CategoryType.Build.getName(),
            "Jenkins-Build",
            "",
            "ProjectName",
            null);
}
项目:ec2-plugin    文件:AmazonEC2Cloud.java   
public FormValidation doCheckCloudName(@QueryParameter String value) {
    try {
        Hudson.checkGoodName(value);
    } catch (Failure e){
        return FormValidation.error(e.getMessage());
    }

    String cloudId = createCloudId(value);
    int found = 0;
    for (Cloud c : Hudson.getInstance().clouds) {
        if (c.name.equals(cloudId)) {
            found++;
        }
    }
    if (found>1) {
        return FormValidation.error(Messages.AmazonEC2Cloud_NonUniqName());
    }
    return FormValidation.ok();
}
项目:jenkins.py    文件:ProjectNamingStrategyPW.java   
@Override
public void checkName(String name) throws Failure {
    initPython();
    if (pexec.isImplemented(1)) {
        pexec.execPythonVoid("check_name", name);
    } else {
        super.checkName(name);
    }
}
项目:jenkins-inheritance-plugin    文件:ParameterizedProjectReference.java   
private FormValidation validGoodName(String variance) {
    if (StringUtils.isBlank(variance)) {
        return FormValidation.ok();
    }
    try {
        Jenkins.checkGoodName(variance);
        return FormValidation.ok();
    } catch (Failure e) {
        return FormValidation.error(e.getMessage());
    }
}
项目:jenkins.py    文件:ProjectNamingStrategyPW.java   
public void superCheckName(String name) throws Failure {
    super.checkName(name);
}