KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > ozoneDB > xml > dom4j > RetrievalTest


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Library License version 1 published by ozone-db.org.
3
//
4
// The original code and portions created by SMB are
5
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
6
//
7
// $Id: RetrievalTest.java,v 1.2 2003/05/05 07:16:37 per_nyfelt Exp $
8
package test.ozoneDB.xml.dom4j;
9
10 import junit.framework.TestCase;
11 import org.dom4j.Document;
12 import org.ozoneDB.ExternalDatabase;
13 import org.ozoneDB.xml.dom4j.O3DocumentHelper;
14
15 /**
16  * $Id: RetrievalTest.java,v 1.2 2003/05/05 07:16:37 per_nyfelt Exp $
17  */

18 public class RetrievalTest extends TestCase {
19
20     ExternalDatabase db;
21
22     public RetrievalTest(String JavaDoc methodName) {
23         super(methodName);
24     }
25
26     public void testRetrieval() {
27         try {
28             db = ExternalDatabase.openDatabase("ozonedb:remote://localhost:3333");
29             O3DocumentHelper.configure(db);
30             Document doc = O3DocumentHelper.fetchDocument("build.xml");
31             assertNotNull("failed to find document named build.xml", doc);
32             System.out.println("retrieved document " + doc.asXML());
33             db.close();
34         } catch (Exception JavaDoc e) {
35             e.printStackTrace();
36             fail(e.toString());
37             try {
38                 if (db != null && db.isOpen() ) {
39                     db.close();
40                 }
41             } catch (Exception JavaDoc e1) {
42                 e1.printStackTrace();
43             }
44         }
45     }
46
47 }
48
Popular Tags