You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Gao Tiantian (JIRA)" <ji...@apache.org> on 2008/11/17 05:12:46 UTC
[jira] Created: (JCR-1860) Something wrong with restoreing of
nt:resource node
Something wrong with restoreing of nt:resource node
---------------------------------------------------
Key: JCR-1860
URL: https://issues.apache.org/jira/browse/JCR-1860
Project: Jackrabbit
Issue Type: Bug
Components: jackrabbit-core
Affects Versions: core 1.4.5
Environment: windows xp professional
Reporter: Gao Tiantian
Today, i write a JUnit test about restore nt:resource node, then i got something wrong.
I add a nt:unstructured node parentNode under my testRootNode, it's versionable.
Then i add a nt:resource node fileNode under parentNode, also the fileNode is versionable.
First I remove the fileNode, then I want to restore, then i got something wrong like this:
javax.jcr.nodetype.ConstraintViolationException: /testRootNode/testRestoreParent/testRestoreFile: mandatory property {http://www.jcp.org/jcr/1.0}lastModified does not exist
at org.apache.jackrabbit.core.ItemImpl.validateTransientItems(ItemImpl.java:538)
at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1205)
at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:897)
at org.apache.jackrabbit.core.NodeImpl.internalRestore(NodeImpl.java:3812)
at org.apache.jackrabbit.core.NodeImpl.restoreByLabel(NodeImpl.java:3165)
at com.nikoyo.dm6p.core.version.VersionRestoreTest.testRestoreFile(VersionRestoreTest.java:151)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
This is the test code of my junit test:
Node parentNode = testRootNode.addNode("testRestoreParent");
parentNode.addMixin(JcrConstants.MIX_VERSIONABLE);
parentNode.setProperty("prop1", "111");
parentNode.setProperty("prop2", 1111);
save();
// parentNode adds a child nt:resource node, and it' versionable
parentNode.checkout();
Node fileNode = parentNode.addNode("testRestoreFile", "nt:resource");
fileNode.addMixin(JcrConstants.MIX_VERSIONABLE);
fileNode.setProperty(JcrConstants.JCR_ENCODING, "utf-8");
fileNode.setProperty(JcrConstants.JCR_MIMETYPE, "text/plain");
fileNode.setProperty(JcrConstants.JCR_LASTMODIFIED, Calendar.getInstance());
fileNode.setProperty(JcrConstants.JCR_DATA, new ByteArrayInputStream("test restore nt:resource node".getBytes()));
save();
fileNode.checkout();
fileNode.checkin();
// version label 1.0
VersionHistory versionHistory = parentNode.getVersionHistory();
Version version1 = parentNode.checkin();
versionHistory.addVersionLabel(version1.getName(), "1.0", true);
// parentNode remove the child nt:resource node
parentNode.checkout();
fileNode.remove();
save();
// version label 1.1
Version version2 = parentNode.checkin();
versionHistory.addVersionLabel(version2.getName(), "1.1", true);
// restore version 1.0
parentNode.restoreByLabel("1.0", true);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-1860) Something wrong with restoreing of
nt:resource node
Posted by "Gao Tiantian (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12650831#action_12650831 ]
Gao Tiantian commented on JCR-1860:
-----------------------------------
Today i just looked up the source code, and then i found the reason.
The nodetype definition of nt:resource:
PropertyDefinition
Name jcr:lastModified
RequiredType DATE
ValueConstraints []
DefaultValues null
AutoCreated false
Mandatory true
OnParentVersion IGNORE
Protected false
Multiple false
I found that the OnParentVersion of property jcr:lastModified is IGNORE, so in the version history there is no jcr:lastModified property in jcr:frozenNode,
and when i delete the nt:resource node, and when i want to restore the parent node, the property jcr:lastModified won't be filled. This is the problem jcr:lastModified is mandatory.
> Something wrong with restoreing of nt:resource node
> ---------------------------------------------------
>
> Key: JCR-1860
> URL: https://issues.apache.org/jira/browse/JCR-1860
> Project: Jackrabbit
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5
> Environment: windows xp professional
> Reporter: Gao Tiantian
>
> Today, i write a JUnit test about restore nt:resource node, then i got something wrong.
> I add a nt:unstructured node parentNode under my testRootNode, it's versionable.
> Then i add a nt:resource node fileNode under parentNode, also the fileNode is versionable.
> First I remove the fileNode, then I want to restore, then i got something wrong like this:
> javax.jcr.nodetype.ConstraintViolationException: /testRootNode/testRestoreParent/testRestoreFile: mandatory property {http://www.jcp.org/jcr/1.0}lastModified does not exist
> at org.apache.jackrabbit.core.ItemImpl.validateTransientItems(ItemImpl.java:538)
> at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1205)
> at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:897)
> at org.apache.jackrabbit.core.NodeImpl.internalRestore(NodeImpl.java:3812)
> at org.apache.jackrabbit.core.NodeImpl.restoreByLabel(NodeImpl.java:3165)
> at com.nikoyo.dm6p.core.version.VersionRestoreTest.testRestoreFile(VersionRestoreTest.java:151)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> This is the test code of my junit test:
> Node parentNode = testRootNode.addNode("testRestoreParent");
> parentNode.addMixin(JcrConstants.MIX_VERSIONABLE);
> parentNode.setProperty("prop1", "111");
> parentNode.setProperty("prop2", 1111);
> save();
> // parentNode adds a child nt:resource node, and it' versionable
> parentNode.checkout();
> Node fileNode = parentNode.addNode("testRestoreFile", "nt:resource");
> fileNode.addMixin(JcrConstants.MIX_VERSIONABLE);
> fileNode.setProperty(JcrConstants.JCR_ENCODING, "utf-8");
> fileNode.setProperty(JcrConstants.JCR_MIMETYPE, "text/plain");
> fileNode.setProperty(JcrConstants.JCR_LASTMODIFIED, Calendar.getInstance());
> fileNode.setProperty(JcrConstants.JCR_DATA, new ByteArrayInputStream("test restore nt:resource node".getBytes()));
> save();
> fileNode.checkout();
> fileNode.checkin();
> // version label 1.0
> VersionHistory versionHistory = parentNode.getVersionHistory();
> Version version1 = parentNode.checkin();
> versionHistory.addVersionLabel(version1.getName(), "1.0", true);
> // parentNode remove the child nt:resource node
> parentNode.checkout();
> fileNode.remove();
> save();
> // version label 1.1
> Version version2 = parentNode.checkin();
> versionHistory.addVersionLabel(version2.getName(), "1.1", true);
> // restore version 1.0
> parentNode.restoreByLabel("1.0", true);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (JCR-1860) Error occurs when restore nt:resource
node after delete
Posted by "Tobias Bocanegra (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1860?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tobias Bocanegra reassigned JCR-1860:
-------------------------------------
Assignee: Tobias Bocanegra
> Error occurs when restore nt:resource node after delete
> -------------------------------------------------------
>
> Key: JCR-1860
> URL: https://issues.apache.org/jira/browse/JCR-1860
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5
> Environment: windows xp professional
> Reporter: Gao Tiantian
> Assignee: Tobias Bocanegra
>
> Today, i write a JUnit test about restore nt:resource node, then i got something wrong.
> I add a nt:unstructured node parentNode under my testRootNode, it's versionable.
> Then i add a nt:resource node fileNode under parentNode, also the fileNode is versionable.
> First I remove the fileNode, then I want to restore, then i got something wrong like this:
> javax.jcr.nodetype.ConstraintViolationException: /testRootNode/testRestoreParent/testRestoreFile: mandatory property {http://www.jcp.org/jcr/1.0}lastModified does not exist
> at org.apache.jackrabbit.core.ItemImpl.validateTransientItems(ItemImpl.java:538)
> at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1205)
> at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:897)
> at org.apache.jackrabbit.core.NodeImpl.internalRestore(NodeImpl.java:3812)
> at org.apache.jackrabbit.core.NodeImpl.restoreByLabel(NodeImpl.java:3165)
> at com.nikoyo.dm6p.core.version.VersionRestoreTest.testRestoreFile(VersionRestoreTest.java:151)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> This is the test code of my junit test:
> Node parentNode = testRootNode.addNode("testRestoreParent");
> parentNode.addMixin(JcrConstants.MIX_VERSIONABLE);
> parentNode.setProperty("prop1", "111");
> parentNode.setProperty("prop2", 1111);
> save();
> // parentNode adds a child nt:resource node, and it' versionable
> parentNode.checkout();
> Node fileNode = parentNode.addNode("testRestoreFile", "nt:resource");
> fileNode.addMixin(JcrConstants.MIX_VERSIONABLE);
> fileNode.setProperty(JcrConstants.JCR_ENCODING, "utf-8");
> fileNode.setProperty(JcrConstants.JCR_MIMETYPE, "text/plain");
> fileNode.setProperty(JcrConstants.JCR_LASTMODIFIED, Calendar.getInstance());
> fileNode.setProperty(JcrConstants.JCR_DATA, new ByteArrayInputStream("test restore nt:resource node".getBytes()));
> save();
> fileNode.checkout();
> fileNode.checkin();
> // version label 1.0
> VersionHistory versionHistory = parentNode.getVersionHistory();
> Version version1 = parentNode.checkin();
> versionHistory.addVersionLabel(version1.getName(), "1.0", true);
> // parentNode remove the child nt:resource node
> parentNode.checkout();
> fileNode.remove();
> save();
> // version label 1.1
> Version version2 = parentNode.checkin();
> versionHistory.addVersionLabel(version2.getName(), "1.1", true);
> // restore version 1.0
> parentNode.restoreByLabel("1.0", true);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (JCR-1860) Error occurs when restore
nt:resource node after delete
Posted by "Gao Tiantian (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12650831#action_12650831 ]
Gao Tiantian edited comment on JCR-1860 at 8/5/09 1:48 AM:
-----------------------------------------------------------
Today i just looked up the source code, and then i found the reason.
The nodetype definition of nt:resource:
PropertyDefinition
Name jcr:lastModified
RequiredType DATE
ValueConstraints []
DefaultValues null
AutoCreated false
Mandatory true
OnParentVersion IGNORE
Protected false
Multiple false
I found that the OnParentVersion of property jcr:lastModified is IGNORE, so in the version history there is no jcr:lastModified property in jcr:frozenNode,
if i delete the nt:resource node, then i want to restore from it's parent node's version history, the property jcr:lastModified won't be filled. This is the problem jcr:lastModified is mandatory.
was (Author: markao):
Today i just looked up the source code, and then i found the reason.
The nodetype definition of nt:resource:
PropertyDefinition
Name jcr:lastModified
RequiredType DATE
ValueConstraints []
DefaultValues null
AutoCreated false
Mandatory true
OnParentVersion IGNORE
Protected false
Multiple false
I found that the OnParentVersion of property jcr:lastModified is IGNORE, so in the version history there is no jcr:lastModified property in jcr:frozenNode,
and when i delete the nt:resource node, and when i want to restore the parent node, the property jcr:lastModified won't be filled. This is the problem jcr:lastModified is mandatory.
> Error occurs when restore nt:resource node after delete
> -------------------------------------------------------
>
> Key: JCR-1860
> URL: https://issues.apache.org/jira/browse/JCR-1860
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5
> Environment: windows xp professional
> Reporter: Gao Tiantian
>
> Today, i write a JUnit test about restore nt:resource node, then i got something wrong.
> I add a nt:unstructured node parentNode under my testRootNode, it's versionable.
> Then i add a nt:resource node fileNode under parentNode, also the fileNode is versionable.
> First I remove the fileNode, then I want to restore, then i got something wrong like this:
> javax.jcr.nodetype.ConstraintViolationException: /testRootNode/testRestoreParent/testRestoreFile: mandatory property {http://www.jcp.org/jcr/1.0}lastModified does not exist
> at org.apache.jackrabbit.core.ItemImpl.validateTransientItems(ItemImpl.java:538)
> at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1205)
> at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:897)
> at org.apache.jackrabbit.core.NodeImpl.internalRestore(NodeImpl.java:3812)
> at org.apache.jackrabbit.core.NodeImpl.restoreByLabel(NodeImpl.java:3165)
> at com.nikoyo.dm6p.core.version.VersionRestoreTest.testRestoreFile(VersionRestoreTest.java:151)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> This is the test code of my junit test:
> Node parentNode = testRootNode.addNode("testRestoreParent");
> parentNode.addMixin(JcrConstants.MIX_VERSIONABLE);
> parentNode.setProperty("prop1", "111");
> parentNode.setProperty("prop2", 1111);
> save();
> // parentNode adds a child nt:resource node, and it' versionable
> parentNode.checkout();
> Node fileNode = parentNode.addNode("testRestoreFile", "nt:resource");
> fileNode.addMixin(JcrConstants.MIX_VERSIONABLE);
> fileNode.setProperty(JcrConstants.JCR_ENCODING, "utf-8");
> fileNode.setProperty(JcrConstants.JCR_MIMETYPE, "text/plain");
> fileNode.setProperty(JcrConstants.JCR_LASTMODIFIED, Calendar.getInstance());
> fileNode.setProperty(JcrConstants.JCR_DATA, new ByteArrayInputStream("test restore nt:resource node".getBytes()));
> save();
> fileNode.checkout();
> fileNode.checkin();
> // version label 1.0
> VersionHistory versionHistory = parentNode.getVersionHistory();
> Version version1 = parentNode.checkin();
> versionHistory.addVersionLabel(version1.getName(), "1.0", true);
> // parentNode remove the child nt:resource node
> parentNode.checkout();
> fileNode.remove();
> save();
> // version label 1.1
> Version version2 = parentNode.checkin();
> versionHistory.addVersionLabel(version2.getName(), "1.1", true);
> // restore version 1.0
> parentNode.restoreByLabel("1.0", true);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-1860) Error occurs when restore nt:resource
node after delete
Posted by "Gao Tiantian (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1860?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gao Tiantian updated JCR-1860:
------------------------------
Summary: Error occurs when restore nt:resource node after delete (was: Something wrong with restoreing of nt:resource node)
> Error occurs when restore nt:resource node after delete
> -------------------------------------------------------
>
> Key: JCR-1860
> URL: https://issues.apache.org/jira/browse/JCR-1860
> Project: Jackrabbit
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5
> Environment: windows xp professional
> Reporter: Gao Tiantian
>
> Today, i write a JUnit test about restore nt:resource node, then i got something wrong.
> I add a nt:unstructured node parentNode under my testRootNode, it's versionable.
> Then i add a nt:resource node fileNode under parentNode, also the fileNode is versionable.
> First I remove the fileNode, then I want to restore, then i got something wrong like this:
> javax.jcr.nodetype.ConstraintViolationException: /testRootNode/testRestoreParent/testRestoreFile: mandatory property {http://www.jcp.org/jcr/1.0}lastModified does not exist
> at org.apache.jackrabbit.core.ItemImpl.validateTransientItems(ItemImpl.java:538)
> at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1205)
> at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:897)
> at org.apache.jackrabbit.core.NodeImpl.internalRestore(NodeImpl.java:3812)
> at org.apache.jackrabbit.core.NodeImpl.restoreByLabel(NodeImpl.java:3165)
> at com.nikoyo.dm6p.core.version.VersionRestoreTest.testRestoreFile(VersionRestoreTest.java:151)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> This is the test code of my junit test:
> Node parentNode = testRootNode.addNode("testRestoreParent");
> parentNode.addMixin(JcrConstants.MIX_VERSIONABLE);
> parentNode.setProperty("prop1", "111");
> parentNode.setProperty("prop2", 1111);
> save();
> // parentNode adds a child nt:resource node, and it' versionable
> parentNode.checkout();
> Node fileNode = parentNode.addNode("testRestoreFile", "nt:resource");
> fileNode.addMixin(JcrConstants.MIX_VERSIONABLE);
> fileNode.setProperty(JcrConstants.JCR_ENCODING, "utf-8");
> fileNode.setProperty(JcrConstants.JCR_MIMETYPE, "text/plain");
> fileNode.setProperty(JcrConstants.JCR_LASTMODIFIED, Calendar.getInstance());
> fileNode.setProperty(JcrConstants.JCR_DATA, new ByteArrayInputStream("test restore nt:resource node".getBytes()));
> save();
> fileNode.checkout();
> fileNode.checkin();
> // version label 1.0
> VersionHistory versionHistory = parentNode.getVersionHistory();
> Version version1 = parentNode.checkin();
> versionHistory.addVersionLabel(version1.getName(), "1.0", true);
> // parentNode remove the child nt:resource node
> parentNode.checkout();
> fileNode.remove();
> save();
> // version label 1.1
> Version version2 = parentNode.checkin();
> versionHistory.addVersionLabel(version2.getName(), "1.1", true);
> // restore version 1.0
> parentNode.restoreByLabel("1.0", true);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.