hi florent

On Mon, Apr 14, 2008 at 9:30 PM, Florent Guillaume <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  I must be missing something about how refresh() works.
>  The following is tested in Jackrabbit 1.3.3 and 1.4.2, and the last two
> assertions always fail.

i quickly ran your test case on trunk. the 3rd and 4th assert fails
because jackrabbit
updates session state instantly. the 5th and 6th assert succedd as expected.

in jackrabbit Session.refresh(true) is a no-op, Session.refresh(false)
just discards
transient session state.

i have no idea why in your case 3rd/4th assert succeed and the last 2 fail...

cheers
stefan

>  Could someone point me in the right direction? How do I refresh my node to
> get the persistent state?
>
>  Thanks,
>  Florent
>
>
>  import javax.jcr.Node;
>  import javax.jcr.Repository;
>  import javax.jcr.Session;
>  import javax.jcr.SimpleCredentials;
>  import org.apache.jackrabbit.core.TransientRepository;
>  import junit.framework.TestCase;
>
>  public class TestRefresh extends TestCase {
>
>     public static void testRefresh() throws Exception {
>         Repository repository = new TransientRepository();
>         Session session = repository.login(new SimpleCredentials("username",
>                 "password".toCharArray()));
>         try {
>             Node root = session.getRootNode();
>
>             Node hello = root.addNode("hello");
>             hello.addNode("world");
>             assertEquals(1, hello.getNodes().getSize());
>             session.save();
>
>             session.getWorkspace().copy("/hello/world", "/hello/foo");
>             assertEquals(1, hello.getNodes().getSize());
>             assertFalse(hello.hasNode("foo"));
>
>             session.refresh(false); // following fails even if true
>             assertEquals(2, hello.getNodes().getSize()); // FAILS!
>             assertTrue(hello.hasNode("foo")); // FAILS!
>         } finally {
>             session.logout();
>         }
>     }
>  }
>
>  --
>  Florent Guillaume, Director of R&D, Nuxeo
>  Open Source Enterprise Content Management (ECM)
>  http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87
>
>
>
>

Reply via email to