Skip to content
Snippets Groups Projects
Commit 1791f301 authored by Jeffrey Phillips Freeman's avatar Jeffrey Phillips Freeman :boom:
Browse files

Changed the unit test to be more useful.

parent eac0306b
No related branches found
No related tags found
No related merge requests found
package com.syncleus.tutorial.jackrabbit.hello;
import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
......@@ -19,6 +20,7 @@ import org.apache.jackrabbit.core.TransientRepository;
public class AppTest
extends TestCase
{
private static final String MESSAGE = "Hello, World!";
/**
* Create the test case
*
......@@ -45,14 +47,25 @@ public class AppTest
Repository repo = new TransientRepository();
Session session = repo.login(
new SimpleCredentials("admin","admin".toCharArray()));
Node root = session.getRootNode();
NodeIterator i = root.getNodes();
while(i.hasNext()){
Node node = i.nextNode();
System.out.println(node.getName());
try {
Node root = session.getRootNode();
// Store content
Node hello = root.addNode("hello");
Node world = hello.addNode("world");
world.setProperty("message", MESSAGE);
session.save();
// Retrieve content
Node node = root.getNode("hello/world");
Assert.assertEquals(MESSAGE, node.getProperty("message").getString());
// Remove content
root.getNode("hello").remove();
session.save();
}
session.logout();
finally {
session.logout();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment