Assert.assertEquals("anonymous", author1.getName());
}
//@Test
public void addingRendezvousMessages2() throws DbException, XQueryException {
XStream xstream = new XStream();
XBirdCollectionStrategy<String, Object> strategy = new XBirdCollectionStrategy<String, Object>(COLLECTION_NAME, xstream);
xstream.processAnnotations(RendezvousMessage.class);
xstream.processAnnotations(Author.class);
List<Author> author1 = Arrays.asList(new Author("anonymous"));
RendezvousMessage msg1 = new RendezvousMessage(15, author1);
System.out.println(xstream.toXML(msg1));
System.out.println();
List<Author> author2 = Arrays.asList(new Author("makoto"), new Author("leo"), new Author("grun"));
RendezvousMessage msg2 = new RendezvousMessage(15, author2, "firstPart", "secondPart");
System.out.println(xstream.toXML(msg2));
System.out.println();
List<RendezvousMessage> list = new XmlArrayList(strategy);
list.add(msg1);
list.add(msg2);
Assert.assertEquals(2, list.size());
String query1 = "fn:collection('/" + COLLECTION_NAME + "/.*.xml')//author";
XQueryProcessor proc = new XQueryProcessor();
XQueryModule compiled1 = proc.parse(query1);
Sequence<? extends Item> items = proc.execute(compiled1);
INodeSequence<DTMElement> nodes = ProxyNodeSequence.wrap(items, DynamicContext.DUMMY);
for(DTMElement node : nodes) {
Object unmarshalled = xstream.unmarshal(new DTMReader(node));
Author author = (Author) unmarshalled;
System.out.println("author: " + author.getName());
}
}