KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > archie > strategy > DefaultLookupStrategyTest


1 package org.sapia.archie.strategy;
2
3 import junit.framework.TestCase;
4
5 import org.sapia.archie.*;
6 import org.sapia.archie.impl.*;
7
8
9 /**
10  * @author Yanick Duchesne
11  *
12  * <dl>
13  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
14  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
15  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
16  * </dl>
17  */

18 public class DefaultLookupStrategyTest extends TestCase {
19   public DefaultLookupStrategyTest(String JavaDoc arg0) {
20     super(arg0);
21   }
22
23   public void testRelativeLookup() throws Exception JavaDoc {
24     DefaultNode root = new DefaultNode();
25     Name name = root.getNameParser().parse("some/path/name");
26     NamePart part = name.last();
27     Node child = (Node) new DefaultLookupNodeStrategy(true).lookup(name,
28                                                                           root);
29     child.putValue(part, "SomeObject", false);
30     new DefaultLookupStrategy().lookup(name.add(part), root);
31   }
32
33   public void testAbsoluteLookup() throws Exception JavaDoc {
34     DefaultNode root = new DefaultNode();
35     Name name = root.getNameParser().parse("some/path/name");
36     NamePart part = name.chopLast();
37     Node child = (Node) new DefaultLookupNodeStrategy(true).lookup(name,
38                                                                           root);
39     child.putValue(part, "SomeObject", false);
40
41     Name rootName = root.getNameParser().parse("/some/path/name");
42     new DefaultLookupStrategy().lookup(rootName, child);
43   }
44 }
45
Popular Tags