Class RoundTripAbstractTest
java.lang.Object
io.jenkins.plugins.casc.misc.RoundTripAbstractTest
Deprecated.
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
FieldsModifier and TypeFieldDescriptionorg.jvnet.hudson.test.LoggerRuleDeprecated.org.jvnet.hudson.test.RestartableJenkinsRuleDeprecated.org.junit.rules.TemporaryFolderDeprecated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidassertConfiguredAsExpected(org.jvnet.hudson.test.RestartableJenkinsRule j, String configContent) Deprecated.A method to assert if the configuration was correctly loaded.protected StringDeprecated.Return the resource path (yaml file) to be loaded.voidDeprecated.1.protected abstract StringDeprecated.Return the string that should be in the logs of the JCasC logger to verify it's configured after a restart.
-
Field Details
-
r
public org.jvnet.hudson.test.RestartableJenkinsRule rDeprecated. -
tempFolder
public org.junit.rules.TemporaryFolder tempFolderDeprecated. -
logging
public org.jvnet.hudson.test.LoggerRule loggingDeprecated.
-
-
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
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
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
Deprecated.1. Configure the instance with theconfigResource()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 thestringInLogExpected()is set during the restart.- Throws:
IOException- If an exception is thrown managing resources or files.
-
AbstractRoundTripTestinstead.