[MAGNOLIA-6423] ModuleVersionHandlerTestCase: late node type registration may cause NoSuchNodeTypeException Created: 20/Oct/15 Updated: 19/May/22 Resolved: 19/May/22 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | testing |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Federico Grilli | Assignee: | Unassigned |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||
| Date of First Response: | |||||||||
| Description |
|
MVHTestCase features a method to register extra node types info.magnolia.module.ModuleVersionHandlerTestCase.getExtraNodeTypes() however the actual registration happens only when running info.magnolia.module.ModuleVersionHandlerTestCase.executeUpdatesAsIfTheCurrentlyInstalledVersionWas(Version) that is when the repo structure with nodes of a certain type typically has already been set. This may cause a javax.jcr.nodetype.NoSuchNodeTypeException. Consider the following case
@Test
public void something() throws Exception {
// GIVEN
websiteSession.getRootNode().addNode("foo", "mgnl:page");
websiteSession.getRootNode().addNode("foo/bar", "mgnl:variants");
// WHEN
executeUpdatesAsIfTheCurrentlyInstalledVersionWas(null);
//rest omitted
}
mgnl:variants is a personalization node type which is provided to the test via
@Override
protected String getExtraNodeTypes() {
return "/mgnl-nodetypes/magnolia-personalization-nodetypes.xml";
}
The above test will fail with javax.jcr.nodetype.NoSuchNodeTypeException: {http://www.magnolia.info/jcr/mgnl}variants
at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.getEffectiveNodeType(NodeTypeRegistry.java:1037)
at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.getEffectiveNodeType(NodeTypeRegistry.java:472)
at org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl.getNodeType(NodeTypeManagerImpl.java:186)
at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1255)
...
|
| Comments |
| Comment by Roman Kovařík [ 19/May/22 ] |
|
Hello, This ticket is now marked as closed due to one of the following reasons:
If you are still facing a problem or consider this issue still relevant, please feel free to re-open the ticket and we will reach out to you. Thank you, |