Class RoundTripAbstractTest

java.lang.Object
io.jenkins.plugins.casc.misc.RoundTripAbstractTest

@Deprecated public abstract class RoundTripAbstractTest extends Object
Deprecated.
Consider migrating to JUnit5 and use AbstractRoundTripTest instead.
Base test to check a complete test of each plugin configuration. What it makes: 1. Configure the instance with the configResource() implemented. 2. Check it was configured correctly. 3. Check the configuration is valid via Web UI. 4. Apply the configuration via Web UI. 5. Write the configuration to $JENKINS_HOME/jenkins.yaml. 6. Restart Jenkins. 7. Check the stringInLogExpected() is set during the restart. All the plugin author needs to do is override the methods providing: 1. The resource with the yaml configuration of the plugin in case they use their own name for the file. 2. A way to validate the configuration is established. 3. A string that should be present in the logs (casc logger) that guarantees the config is loaded. Usually a weird text configured.
Since:
1.20
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    org.jvnet.hudson.test.LoggerRule
    Deprecated.
     
    org.jvnet.hudson.test.RestartableJenkinsRule
    Deprecated.
     
    org.junit.rules.TemporaryFolder
    Deprecated.
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
    assertConfiguredAsExpected(org.jvnet.hudson.test.RestartableJenkinsRule j, String configContent)
    Deprecated.
    A method to assert if the configuration was correctly loaded.
    protected String
    Deprecated.
    Return the resource path (yaml file) to be loaded.
    void
    Deprecated.
    1.
    protected abstract String
    Deprecated.
    Return the string that should be in the logs of the JCasC logger to verify it's configured after a restart.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • r

      public org.jvnet.hudson.test.RestartableJenkinsRule r
      Deprecated.
    • tempFolder

      public org.junit.rules.TemporaryFolder tempFolder
      Deprecated.
    • logging

      public org.jvnet.hudson.test.LoggerRule logging
      Deprecated.
  • Constructor Details

    • RoundTripAbstractTest

      public RoundTripAbstractTest()
      Deprecated.
  • Method Details

    • assertConfiguredAsExpected

      protected abstract void assertConfiguredAsExpected(org.jvnet.hudson.test.RestartableJenkinsRule j, String configContent)
      Deprecated.
      A method to assert if the configuration was correctly loaded. The Jenkins rule and the content of the config supposedly loaded are passed.
      Parameters:
      j - a RestartableJenkinsRule instance.
      configContent - expected configuration.
    • configResource

      protected String configResource()
      Deprecated.
      Return the resource path (yaml file) to be loaded. i.e: If the resource is in the same package of the implementor class, then: my-config.yaml
      Returns:
      the resource name and path.
    • stringInLogExpected

      protected abstract String stringInLogExpected()
      Deprecated.
      Return the string that should be in the logs of the JCasC logger to verify it's configured after a restart. This string should be unique to avoid interpreting that it was configured successfully, but it wasn't.
      Returns:
      the unique string to be in the logs to certify the configuration was done successfully.
    • roundTripTest

      public void roundTripTest() throws IOException
      Deprecated.
      1. Configure the instance with the configResource() implemented. 2. Check it was configured correctly. 3. Check the configuration is valid via Web UI. 4. Apply the configuration via Web UI. 5. Write the configuration to $JENKINS_HOME/jenkins.yaml. 6. Restart Jenkins. 7. Check the stringInLogExpected() is set during the restart.
      Throws:
      IOException - If an exception is thrown managing resources or files.