package org.huihoo.jfox.jndi.test;
import javax.naming.Name;
import javax.naming.NameParser;
import junit.framework.TestCase;
import org.huihoo.jfox.jndi.NameParserImpl;
public class NameTest extends TestCase {
private Name relativeName;
private Name absName;
private Name fullName;
private Name fqnName;
private NameParser np;
protected void setUp() throws Exception {
np = NameParserImpl.getInstance();
relativeName = np.parse("a/b/c");
absName = np.parse("/a/b/c");
fullName = np.parse("java:/a/b/c");
fqnName = np.parse("java://localhost:1099/a/b/c");
}
public void testToString() {
System.out.println(relativeName.toString());
System.out.println(absName.toString());
System.out.println(fullName.toString());
System.out.println(fqnName.toString());
}
public void testPart0(){
System.out.println(relativeName.get(0));
System.out.println(absName.get(0));
System.out.println(fullName.get(0));
System.out.println(fqnName.get(0));
}
public void testSuffix(){
System.out.println(relativeName.getSuffix(1));
System.out.println(absName.getSuffix(1));
System.out.println(fullName.getSuffix(1));
System.out.println(fqnName.getSuffix(2));
}
public void testStartWith() throws Exception {
System.out.println(relativeName.startsWith(np.parse("/")));
System.out.println(absName.startsWith(np.parse("/")));
System.out.println(fullName.startsWith(np.parse("/")));
}
public static void main(String[] args) {
}
}