[MAGNOLIA-6315] Version workspace name comparison issue (magnolia-mgnlVersion not equal to mgnlVersion) Created: 22/Jul/15 Updated: 15/Apr/16 Resolved: 04/Aug/15 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | core |
| Affects Version/s: | 5.4 |
| Fix Version/s: | 5.4.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Eric Hechinger | Assignee: | Robert Šiška |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | affect-vn-project, backlog541 | ||
| Remaining Estimate: | 0d | ||
| Time Spent: | 0.5d | ||
| Original Estimate: | Not Specified | ||
| 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: | |
| Sprint: | Sprint 4 (Kromeriz) |
| Story Points: | 3 |
| Description |
|
We have override BaseVersionManager in order to add Label support on versions.
private void checkOwnVersion(Version version)
throws VersionException, RepositoryException {
if (!version.getParent().isSame(this)) {
.....
version.getParent() = ContentDecoratorVersionWrapper.getParent() seems to be wrapped correctly but then
version.getParent().isSame(this) = DelegateNodeWrapper. isSame(Item otherItem)
failed in
getSession().getWorkspace().getName(). --> magnolia-mgnlVersion
equals(
otherItem.getSession().getWorkspace().getName()) --> mgnlVersion
In order to reproduce add the following test method in
@Test
public void getVersionForALabel() throws RepositoryException {
// GIVEN
String label = "label";
VersionManager versionManager = VersionManager.getInstance();
// Create node structure
Node node = MgnlContext.getJCRSession(RepositoryConstants.WEBSITE).getRootNode().addNode("test", NodeTypes.Content.NAME);
Node firstLevel = node.addNode("first-level", NodeTypes.Content.NAME);
firstLevel.setProperty("text", " firstLevel V1");
Node secondLevel = firstLevel.addNode("second-level", NodeTypes.Content.NAME);
secondLevel.setProperty("text", " secondLevel V1");
node.getSession().save();
// Create version
Version v1 = versionManager.addVersion(node);
// Add label
v1.getContainingHistory().addVersionLabel(v1.getName(), label, true);
Version v2 = versionManager.addVersion(node);
assertEquals("magnolia-mgnlVersion", v2.getSession().getWorkspace().getName());
// WHEN
Version baseVersion = versionManager.getBaseVersion(node);
assertEquals("magnolia-mgnlVersion", baseVersion.getSession().getWorkspace().getName());
VersionHistory versionHistory = versionManager.getVersionHistory(node);
assertEquals("magnolia-mgnlVersion", versionHistory.getSession().getWorkspace().getName());
// WHEN
boolean haveLabel = versionHistory.hasVersionLabel(v2, label);
// THEN
assertTrue(haveLabel);
}
|
| Comments |
| Comment by Robert Šiška [ 04/Aug/15 ] |
|
IMHO, this is a non-issue, because it tries to pass our ContentDecoratorVersionWrapper straight into the jackrabbit code. boolean haveLabel = versionHistory.hasVersionLabel(VersionUtil.unwrap(v2), label); Other option would be unwrapping in ContentDecoratorVersionHistoryWrapper, but that would be uglier... |
| Comment by Jan Haderka [ 04/Aug/15 ] |
|
rsiska but v2 in your code, is returned from Verison manager that is wrapped no? Same for versionHistory, so to deal with it correctly, I would expect VersionHistory wrapper to internally detect if version is wrapped and if necessary unwrap it by itself rather than forcing client code to be aware of internal wrapping done by Magnolia. |