congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
SnippetizerTester.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.jenkinsci.plugins.workflow.cps.SnippetizerTester
constructor

Best Java code snippets using org.jenkinsci.plugins.workflow.cps.SnippetizerTester.<init> (Showing top 8 results out of 315)

origin: jenkinsci/workflow-multibranch-plugin

@Issue("JENKINS-37219")
@Test
public void snippetGeneratorOverrideIndexing() throws Exception {
  String snippetJson = "{'propertiesMap':\n" +
      "{'stapler-class-bag': 'true', 'jenkins-branch-OverrideIndexTriggersJobProperty': \n" +
      "{'specified': true, 'enableTriggers': true}},\n" +
      "'stapler-class': 'org.jenkinsci.plugins.workflow.multibranch.JobPropertyStep',\n" +
      "'$class': 'org.jenkinsci.plugins.workflow.multibranch.JobPropertyStep'}";
  new SnippetizerTester(r).assertGenerateSnippet(snippetJson, "properties([overrideIndexTriggers(true)])", null);
}
origin: jenkinsci/workflow-multibranch-plugin

@Issue("JENKINS-37477")
@Test
public void configRoundTripTrigger() throws Exception {
  List<JobProperty> properties = Collections.<JobProperty>singletonList(new PipelineTriggersJobProperty(Collections.<Trigger>singletonList(new TimerTrigger("@daily"))));
  String snippetJson = "{'propertiesMap': {\n" +
      "    'stapler-class-bag': 'true',\n" +
      "    'org-jenkinsci-plugins-workflow-job-properties-PipelineTriggersJobProperty': {'triggers': {\n" +
      "      'stapler-class-bag': 'true',\n" +
      "      'hudson-triggers-TimerTrigger': {'spec': '@daily'}\n" +
      "    }}},\n" +
      "  'stapler-class': 'org.jenkinsci.plugins.workflow.multibranch.JobPropertyStep',\n" +
      "  '$class': 'org.jenkinsci.plugins.workflow.multibranch.JobPropertyStep'}";
  new SnippetizerTester(r).assertGenerateSnippet(snippetJson, "properties([pipelineTriggers([cron('@daily')])])", null);
  new SnippetizerTester(r).assertRoundTrip(new JobPropertyStep(properties), "properties([pipelineTriggers([cron('@daily')])])");
}
origin: jenkinsci/workflow-multibranch-plugin

@Issue("JENKINS-37721")
@Test
public void configRoundTripSCMTrigger() throws Exception {
  List<JobProperty> properties = Collections.<JobProperty>singletonList(new PipelineTriggersJobProperty(Collections.<Trigger>singletonList(new SCMTrigger("@daily"))));
  String snippetJson = "{'propertiesMap': {\n" +
      "    'stapler-class-bag': 'true',\n" +
      "    'org-jenkinsci-plugins-workflow-job-properties-PipelineTriggersJobProperty': {'triggers': {\n" +
      "      'stapler-class-bag': 'true',\n" +
      "      'hudson-triggers-SCMTrigger': {'scmpoll_spec': '@daily', 'ignorePostCommitHooks': false }\n" +
      "    }}},\n" +
      "  'stapler-class': 'org.jenkinsci.plugins.workflow.multibranch.JobPropertyStep',\n" +
      "  '$class': 'org.jenkinsci.plugins.workflow.multibranch.JobPropertyStep'}";
  new SnippetizerTester(r).assertGenerateSnippet(snippetJson, "properties([pipelineTriggers([pollSCM('@daily')])])", null);
  new SnippetizerTester(r).assertRoundTrip(new JobPropertyStep(properties), "properties([pipelineTriggers([pollSCM('@daily')])])");
}
origin: jenkinsci/workflow-multibranch-plugin

@Issue("JENKINS-34464")
@Test
public void configRoundTripReverseBuildTrigger() throws Exception {
  List<JobProperty> properties = Collections.<JobProperty>singletonList(new PipelineTriggersJobProperty(Collections.<Trigger>singletonList(new ReverseBuildTrigger("some-job", Result.UNSTABLE))));
  String snippetJson = "{'propertiesMap': {\n" +
      "    'stapler-class-bag': 'true',\n" +
      "    'org-jenkinsci-plugins-workflow-job-properties-PipelineTriggersJobProperty': {'triggers': {\n" +
      "      'stapler-class-bag': 'true',\n" +
      "      'jenkins-triggers-ReverseBuildTrigger': { 'threshold': 'UNSTABLE', 'upstreamProjects': 'some-job'}\n" +
      "    }}},\n" +
      "  'stapler-class': 'org.jenkinsci.plugins.workflow.multibranch.JobPropertyStep',\n" +
      "  '$class': 'org.jenkinsci.plugins.workflow.multibranch.JobPropertyStep'}";
  new SnippetizerTester(r).assertGenerateSnippet(snippetJson, "properties([pipelineTriggers([upstream(threshold: 'UNSTABLE', upstreamProjects: 'some-job')])])", null);
  new SnippetizerTester(r).assertRoundTrip(new JobPropertyStep(properties), "properties([pipelineTriggers([upstream(threshold: 'UNSTABLE', upstreamProjects: 'some-job')])])");
}
origin: jenkinsci/workflow-multibranch-plugin

@Issue("JENKINS-26143")
@Test
public void testChoiceParameterSnippetizer() throws Exception {
  //new SnippetizerTester(r).assertGenerateSnippet();
  new SnippetizerTester(r).assertRoundTrip(new JobPropertyStep(Arrays.asList(new ParametersDefinitionProperty(new ChoiceParameterDefinition("paramName", new String[] { "foo", "bar", "baz" }, "")))),
    "properties([parameters([choice(choices: ['foo', 'bar', 'baz'], description: '', name: 'paramName')])])");
}
origin: jenkinsci/junit-plugin

@Test
public void configRoundTrip() throws Exception {
  SnippetizerTester st = new SnippetizerTester(rule);
  JUnitResultsStep step = new JUnitResultsStep("**/target/surefire-reports/TEST-*.xml");
  st.assertRoundTrip(step, "junit '**/target/surefire-reports/TEST-*.xml'");
  step.setAllowEmptyResults(true);
  st.assertRoundTrip(step, "junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'");
  step.setHealthScaleFactor(2.0);
  st.assertRoundTrip(step, "junit allowEmptyResults: true, healthScaleFactor: 2.0, testResults: '**/target/surefire-reports/TEST-*.xml'");
  MockTestDataPublisher publisher = new MockTestDataPublisher("testing");
  step.setTestDataPublishers(Collections.<TestDataPublisher>singletonList(publisher));
  st.assertRoundTrip(step, "junit allowEmptyResults: true, healthScaleFactor: 2.0, testDataPublishers: [[$class: 'MockTestDataPublisher', name: 'testing']], testResults: '**/target/surefire-reports/TEST-*.xml'");
}
origin: jenkinsci/workflow-multibranch-plugin

@SuppressWarnings("rawtypes")
@Test public void configRoundTripParameters() throws Exception {
  List<JobProperty> properties = Collections.<JobProperty>singletonList(new ParametersDefinitionProperty(new BooleanParameterDefinition("flag", true, null)));
  // TODO *ParameterDefinition.description ought to be defaulted to null:
  new SnippetizerTester(r).assertRoundTrip(new JobPropertyStep(properties), "properties([parameters([booleanParam(defaultValue: true, name: 'flag')])])");
  StepConfigTester tester = new StepConfigTester(r);
  properties = tester.configRoundTrip(new JobPropertyStep(properties)).getProperties();
  assertEquals(1, properties.size());
  ParametersDefinitionProperty pdp = getPropertyFromList(ParametersDefinitionProperty.class, properties);
  assertNotNull(pdp);
  assertEquals(1, pdp.getParameterDefinitions().size());
  assertEquals(BooleanParameterDefinition.class, pdp.getParameterDefinitions().get(0).getClass());
  BooleanParameterDefinition bpd = (BooleanParameterDefinition) pdp.getParameterDefinitions().get(0);
  assertEquals("flag", bpd.getName());
  assertTrue(bpd.isDefaultValue());
  List<JobProperty> emptyInput = tester.configRoundTrip(new JobPropertyStep(Collections.<JobProperty>emptyList())).getProperties();
  assertEquals(Collections.emptyList(), removeTriggerProperty(emptyInput));
}
origin: jenkinsci/workflow-multibranch-plugin

@SuppressWarnings("rawtypes")
@Test public void configRoundTripBuildDiscarder() throws Exception {
  List<JobProperty> properties = Collections.<JobProperty>singletonList(new BuildDiscarderProperty(new LogRotator(1, 2, -1, 3)));
  // TODO structural form of LogRotator is awful; confusion between integer and string types, and failure to handle default values:
  new SnippetizerTester(r).assertRoundTrip(new JobPropertyStep(properties), "properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '3', daysToKeepStr: '1', numToKeepStr: '2'))])");
  StepConfigTester tester = new StepConfigTester(r);
  properties = tester.configRoundTrip(new JobPropertyStep(properties)).getProperties();
  assertEquals(1, properties.size());
  BuildDiscarderProperty bdp = getPropertyFromList(BuildDiscarderProperty.class, properties);
  assertNotNull(bdp);
  BuildDiscarder strategy = bdp.getStrategy();
  assertNotNull(strategy);
  assertEquals(LogRotator.class, strategy.getClass());
  LogRotator lr = (LogRotator) strategy;
  assertEquals(1, lr.getDaysToKeep());
  assertEquals(2, lr.getNumToKeep());
  assertEquals(-1, lr.getArtifactDaysToKeep());
  assertEquals(3, lr.getArtifactNumToKeep());
}
org.jenkinsci.plugins.workflow.cpsSnippetizerTester<init>

Javadoc

This helper requires JenkinsRule.

Popular methods of SnippetizerTester

  • assertRoundTrip
    Given a fully configured Step, make sure the output from the snippetizer matches the expected value.
  • assertGenerateSnippet
    Tests a form submitting part of snippetizer.
  • assertDocGeneration
    Recurses through the model of a Describable class's DescribableModel and its parameters to verify th
  • recurseOnModel
  • recurseOnTypes

Popular in Java

  • Making http post requests using okhttp
  • getExternalFilesDir (Context)
  • putExtra (Intent)
  • getSystemService (Context)
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now