Skip to content

Commit

Permalink
Merge pull request wildfly#18321 from kabir/undertow_transformers_wor…
Browse files Browse the repository at this point in the history
…karound

[WFLY-19885] Rework undertow transformers test so it will work with a…
  • Loading branch information
bstansberry authored Oct 24, 2024
2 parents 7000acc + 3f3fdb0 commit 956cd9a
Showing 1 changed file with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,32 @@ public void testTransformations() throws Exception {
KernelServicesBuilder builder = this.createKernelServicesBuilder(this.createAdditionalInitialization()).setSubsystemXml(this.readResource("undertow-transform.xml"));
KernelServices services = this.build(builder);

ModelFixer fixer = model -> {
model.get(HandlerDefinitions.PATH_ELEMENT.getKeyValuePair()).set(new ModelNode());
model.get(FilterDefinitions.PATH_ELEMENT.getKeyValuePair()).set(new ModelNode());
return model;
};

this.checkSubsystemModelTransformation(services, this.modelVersion, fixer, false);
// TODO https://issues.redhat.com/browse/WFLY-19886. Remove the try/catch block and keep only the
// .setEmptyObject() version of the ModelFixer. Also get rid of all the comments :-)
try {
// Try to use the approach introduced by https://issues.redhat.com/browse/WFCORE-7036
// If it fails we will fall back to the old approach
// This is for before https://issues.redhat.com/browse/WFCORE-7036 is merged and released
// Once it is released, we should remove this and use the code in the try block only
ModelFixer fixer = model -> {
model.get(HandlerDefinitions.PATH_ELEMENT.getKeyValuePair()).setEmptyObject();
model.get(FilterDefinitions.PATH_ELEMENT.getKeyValuePair()).setEmptyObject();
return model;
};

this.checkSubsystemModelTransformation(services, this.modelVersion, fixer, false);

} catch (AssertionError firstAssertionError) {
// This is for before https://issues.redhat.com/browse/WFCORE-7036 is merged and released
// Once it is released, we should remove this and use the code in the try block only
ModelFixer fixer = model -> {
model.get(HandlerDefinitions.PATH_ELEMENT.getKeyValuePair()).set(new ModelNode());
model.get(FilterDefinitions.PATH_ELEMENT.getKeyValuePair()).set(new ModelNode());
return model;
};

this.checkSubsystemModelTransformation(services, this.modelVersion, fixer, false);
}
}

@Test
Expand Down

0 comments on commit 956cd9a

Please sign in to comment.