Java 类javax.naming.CompoundName 实例源码

项目:cn1    文件:CompositeNameTest.java   
/**
 * Test addAll(Name), include exceptional case
 */
public void testAddAllName() throws InvalidNameException {
    log.setMethod("testAddAllName()");
    int oldSize = name.size();
    name.addAll(new CompositeName(initName));
    assertEquals(name.size(), oldSize * 2);
    assertEquals(name.getPrefix(3).toString(), name.getSuffix(3).toString());
    assertEquals(name.getPrefix(3).toString(), initName);
    name = new CompositeName("a");
    try {
        name.addAll(new CompoundName("b/c", props));
        fail("name.addAll(new CompoundName(\"b/c\", props));");
    } catch (InvalidNameException t) {
    }
    try {
        name.addAll(null);
        fail("Add null should throw NullPointerException");
    } catch (NullPointerException e) {
    }
}
项目:cn1    文件:ResolveResultTest.java   
public void testConstrcutor_ByCompoundName() throws InvalidNameException {
    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);

    ResolveResult resolveResult = new ResolveResult(strObj, compoundName);
    assertEquals(strObj, resolveResult.getResolvedObj());
    assertEquals(compoundName, resolveResult.getRemainingName());
}
项目:cn1    文件:ResolveResultTest.java   
public void testAppendRemainingName_InvalidName()
        throws InvalidNameException {
    ResolveResult resolveResult = new ResolveResult(strObj, name);

    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);
    try {
        resolveResult.appendRemainingName(compoundName);
        fail("Should throw a Error.");
    } catch (Error e) {
    }
}
项目:cn1    文件:ResolveResultTest.java   
public void testAppendRemainingName_withCompoundName()
        throws InvalidNameException {
    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);

    ResolveResult resolveResult = new ResolveResult(strObj, compoundName);
    CompositeName newName = new CompositeName("a/b/c/d");
    try {
        resolveResult.appendRemainingName(newName);
        fail("Should throw a Error here.");
    } catch (Error e) {
    }

    // compoundName.addAll(newName);
    // assertEquals(compoundName, resolveResult.getRemainingName());
}
项目:cn1    文件:ResolveResultTest.java   
public void testAppendRemainingName_withCompoundName2()
        throws InvalidNameException {
    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);

    ResolveResult resolveResult = new ResolveResult(strObj, compoundName);
    CompoundName newName = new CompoundName("b", props);
    resolveResult.appendRemainingName(newName);

    compoundName.addAll(newName);
    assertEquals(compoundName, resolveResult.getRemainingName());
}
项目:cn1    文件:ResolveResultTest.java   
public void testSetRemainingName_InvalidName() throws InvalidNameException {
    ResolveResult resolveResult = new ResolveResult(strObj, name);

    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);

    resolveResult.setRemainingName(compoundName);
    assertEquals(compoundName, resolveResult.getRemainingName());
}
项目:cn1    文件:ResolveResultTest.java   
public void testSetRemainingName_withCompoundName2()
        throws InvalidNameException {
    ResolveResult resolveResult = new ResolveResult(strObj, name);

    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);

    resolveResult.setRemainingName(compoundName);

    CompoundName newName = new CompoundName("b", props);
    resolveResult.appendRemainingName(newName);

    compoundName.addAll(newName);
    assertEquals(compoundName, resolveResult.getRemainingName());
}
项目:cn1    文件:CompoundNameTest.java   
public void testProperties_IgnoreCaseAndTrimBlank_DefaultValue()
        throws InvalidNameException {
    log.setMethod("testProperties_IgnoreCaseAndTrimBlank_DefaultValue()");

    props.remove("jndi.syntax.ignorecase");
    props.remove("jndi.syntax.trimblanks");
    CompoundName abcd = new CompoundName("a/b/c/d", props);
    CompoundName ABCD = new CompoundName("A/B/C/D", props);
    CompoundName _a_b_c_d_ = new CompoundName(" a / b / c / d ", props);
    assertFalse(abcd.equals(ABCD));
    assertFalse(abcd.equals(_a_b_c_d_));

    props.remove("jndi.syntax.beginquote");
    props.remove("jndi.syntax.endquote");
    props.remove("jndi.syntax.beginquote2");
    props.remove("jndi.syntax.endquote2");
    CompoundName quote = new CompoundName("a/\\/b/c", props);
    assertEquals("a/\\/b/c", quote.toString());
}
项目:freeVM    文件:CompositeNameTest.java   
/**
 * Test addAll(Name), include exceptional case
 */
public void testAddAllName() throws InvalidNameException {
    log.setMethod("testAddAllName()");
    int oldSize = name.size();
    name.addAll(new CompositeName(initName));
    assertEquals(name.size(), oldSize * 2);
    assertEquals(name.getPrefix(3).toString(), name.getSuffix(3).toString());
    assertEquals(name.getPrefix(3).toString(), initName);
    name = new CompositeName("a");
    try {
        name.addAll(new CompoundName("b/c", props));
        fail("name.addAll(new CompoundName(\"b/c\", props));");
    } catch (InvalidNameException t) {
    }
    try {
        name.addAll(null);
        fail("Add null should throw NullPointerException");
    } catch (NullPointerException e) {
    }
}
项目:freeVM    文件:ResolveResultTest.java   
public void testConstrcutor_ByCompoundName() throws InvalidNameException {
    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);

    ResolveResult resolveResult = new ResolveResult(strObj, compoundName);
    assertEquals(strObj, resolveResult.getResolvedObj());
    assertEquals(compoundName, resolveResult.getRemainingName());
}
项目:freeVM    文件:ResolveResultTest.java   
public void testAppendRemainingName_InvalidName()
        throws InvalidNameException {
    ResolveResult resolveResult = new ResolveResult(strObj, name);

    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);
    try {
        resolveResult.appendRemainingName(compoundName);
        fail("Should throw a Error.");
    } catch (Error e) {
    }
}
项目:freeVM    文件:ResolveResultTest.java   
public void testAppendRemainingName_withCompoundName()
        throws InvalidNameException {
    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);

    ResolveResult resolveResult = new ResolveResult(strObj, compoundName);
    CompositeName newName = new CompositeName("a/b/c/d");
    try {
        resolveResult.appendRemainingName(newName);
        fail("Should throw a Error here.");
    } catch (Error e) {
    }

    // compoundName.addAll(newName);
    // assertEquals(compoundName, resolveResult.getRemainingName());
}
项目:freeVM    文件:ResolveResultTest.java   
public void testAppendRemainingName_withCompoundName2()
        throws InvalidNameException {
    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);

    ResolveResult resolveResult = new ResolveResult(strObj, compoundName);
    CompoundName newName = new CompoundName("b", props);
    resolveResult.appendRemainingName(newName);

    compoundName.addAll(newName);
    assertEquals(compoundName, resolveResult.getRemainingName());
}
项目:freeVM    文件:ResolveResultTest.java   
public void testSetRemainingName_InvalidName() throws InvalidNameException {
    ResolveResult resolveResult = new ResolveResult(strObj, name);

    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);

    resolveResult.setRemainingName(compoundName);
    assertEquals(compoundName, resolveResult.getRemainingName());
}
项目:freeVM    文件:ResolveResultTest.java   
public void testSetRemainingName_withCompoundName2()
        throws InvalidNameException {
    ResolveResult resolveResult = new ResolveResult(strObj, name);

    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);

    resolveResult.setRemainingName(compoundName);

    CompoundName newName = new CompoundName("b", props);
    resolveResult.appendRemainingName(newName);

    compoundName.addAll(newName);
    assertEquals(compoundName, resolveResult.getRemainingName());
}
项目:freeVM    文件:CompoundNameTest.java   
public void testProperties_IgnoreCaseAndTrimBlank_DefaultValue()
        throws InvalidNameException {
    log.setMethod("testProperties_IgnoreCaseAndTrimBlank_DefaultValue()");

    props.remove("jndi.syntax.ignorecase");
    props.remove("jndi.syntax.trimblanks");
    CompoundName abcd = new CompoundName("a/b/c/d", props);
    CompoundName ABCD = new CompoundName("A/B/C/D", props);
    CompoundName _a_b_c_d_ = new CompoundName(" a / b / c / d ", props);
    assertFalse(abcd.equals(ABCD));
    assertFalse(abcd.equals(_a_b_c_d_));

    props.remove("jndi.syntax.beginquote");
    props.remove("jndi.syntax.endquote");
    props.remove("jndi.syntax.beginquote2");
    props.remove("jndi.syntax.endquote2");
    CompoundName quote = new CompoundName("a/\\/b/c", props);
    assertEquals("a/\\/b/c", quote.toString());
}
项目:freeVM    文件:CompositeNameTest.java   
/**
 * Test addAll(Name), include exceptional case
 */
public void testAddAllName() throws InvalidNameException {
    log.setMethod("testAddAllName()");
    int oldSize = name.size();
    name.addAll(new CompositeName(initName));
    assertEquals(name.size(), oldSize * 2);
    assertEquals(name.getPrefix(3).toString(), name.getSuffix(3).toString());
    assertEquals(name.getPrefix(3).toString(), initName);
    name = new CompositeName("a");
    try {
        name.addAll(new CompoundName("b/c", props));
        fail("name.addAll(new CompoundName(\"b/c\", props));");
    } catch (InvalidNameException t) {
    }
    try {
        name.addAll(null);
        fail("Add null should throw NullPointerException");
    } catch (NullPointerException e) {
    }
}
项目:freeVM    文件:ResolveResultTest.java   
public void testConstrcutor_ByCompoundName() throws InvalidNameException {
    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);

    ResolveResult resolveResult = new ResolveResult(strObj, compoundName);
    assertEquals(strObj, resolveResult.getResolvedObj());
    assertEquals(compoundName, resolveResult.getRemainingName());
}
项目:freeVM    文件:ResolveResultTest.java   
public void testAppendRemainingName_InvalidName()
        throws InvalidNameException {
    ResolveResult resolveResult = new ResolveResult(strObj, name);

    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);
    try {
        resolveResult.appendRemainingName(compoundName);
        fail("Should throw a Error.");
    } catch (Error e) {
    }
}
项目:freeVM    文件:ResolveResultTest.java   
public void testAppendRemainingName_withCompoundName()
        throws InvalidNameException {
    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);

    ResolveResult resolveResult = new ResolveResult(strObj, compoundName);
    CompositeName newName = new CompositeName("a/b/c/d");
    try {
        resolveResult.appendRemainingName(newName);
        fail("Should throw a Error here.");
    } catch (Error e) {
    }

    // compoundName.addAll(newName);
    // assertEquals(compoundName, resolveResult.getRemainingName());
}
项目:freeVM    文件:ResolveResultTest.java   
public void testAppendRemainingName_withCompoundName2()
        throws InvalidNameException {
    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);

    ResolveResult resolveResult = new ResolveResult(strObj, compoundName);
    CompoundName newName = new CompoundName("b", props);
    resolveResult.appendRemainingName(newName);

    compoundName.addAll(newName);
    assertEquals(compoundName, resolveResult.getRemainingName());
}
项目:freeVM    文件:ResolveResultTest.java   
public void testSetRemainingName_InvalidName() throws InvalidNameException {
    ResolveResult resolveResult = new ResolveResult(strObj, name);

    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);

    resolveResult.setRemainingName(compoundName);
    assertEquals(compoundName, resolveResult.getRemainingName());
}
项目:freeVM    文件:ResolveResultTest.java   
public void testSetRemainingName_withCompoundName2()
        throws InvalidNameException {
    ResolveResult resolveResult = new ResolveResult(strObj, name);

    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);

    resolveResult.setRemainingName(compoundName);

    CompoundName newName = new CompoundName("b", props);
    resolveResult.appendRemainingName(newName);

    compoundName.addAll(newName);
    assertEquals(compoundName, resolveResult.getRemainingName());
}
项目:freeVM    文件:CompoundNameTest.java   
public void testProperties_IgnoreCaseAndTrimBlank_DefaultValue()
        throws InvalidNameException {
    log.setMethod("testProperties_IgnoreCaseAndTrimBlank_DefaultValue()");

    props.remove("jndi.syntax.ignorecase");
    props.remove("jndi.syntax.trimblanks");
    CompoundName abcd = new CompoundName("a/b/c/d", props);
    CompoundName ABCD = new CompoundName("A/B/C/D", props);
    CompoundName _a_b_c_d_ = new CompoundName(" a / b / c / d ", props);
    assertFalse(abcd.equals(ABCD));
    assertFalse(abcd.equals(_a_b_c_d_));

    props.remove("jndi.syntax.beginquote");
    props.remove("jndi.syntax.endquote");
    props.remove("jndi.syntax.beginquote2");
    props.remove("jndi.syntax.endquote2");
    CompoundName quote = new CompoundName("a/\\/b/c", props);
    assertEquals("a/\\/b/c", quote.toString());
}
项目:picketbox    文件:PermissionName.java   
/** Creates new NamespacePermission */
public PermissionName(String name) throws IllegalArgumentException
{
    try
    {
        this.name = new CompoundName(name, nameSyntax);
    }
    catch(NamingException e)
    {
        throw new IllegalArgumentException(e.toString(true));
    }
}
项目:scriptella-etl    文件:LdifScript.java   
/**
 * @param rootDn root context DN.
 * @param dn     DN to compute a relative name. DN must starts with rootDn.
 * @return name relative to a root context DN.
 */
static Name getRelativeDN(final String rootDn, final String dn) throws NamingException {
    CompoundName root = new CompoundName(rootDn, DN_SYNTAX);
    CompoundName entry = new CompoundName(dn, DN_SYNTAX);
    if (!entry.startsWith(root)) {
        throw new NamingException("Dn " + dn + " is not from root DN " + rootDn);
    }
    return entry.getSuffix(root.size());
}
项目:jeffaschenk-commons    文件:idxParseDN.java   
/**
 * Returns a CompoundName from the Parsed DN.
 *
 * @return CompoundName based upon DN.
 * @throws Exception if the DN were have is not valid.
 */
public CompoundName getCompoundName()
        throws Exception {

    // *********************************
    // Is our Contents Valid.
    if (!isValid()) {
        throw new Exception("Current value of [" +
                aOriginalName +
                "] is not a valid DN.");
    }

    // *********************************
    // Obtain a Compound Name.
    try {
        idxNameParser np = new idxNameParser();
        CompoundName cName = np.parse(getDN());
        return (cName);
    } catch (Exception e) {

        throw new Exception("Current DN[" +
                getDN() +
                "] could not obtain a CompoundName,:" + e);

    } // End of Exception.

}
项目:cn1    文件:LinkExceptionTest.java   
public void testSetLinkResolvedName() throws InvalidNameException {
    LinkException ex = new LinkException("Test");
    Properties env = new Properties();
    env.put("jndi.syntax.direction", "flat");
    Name name = new CompoundName("Test", env);
    ex.setLinkResolvedName(name);
    ex.setLinkResolvedName(null);
    assertNull(ex.getLinkResolvedName());
}
项目:cn1    文件:LinkExceptionTest.java   
public void testSetLinkRemainingName() throws InvalidNameException {
    LinkException ex = new LinkException("Test");
    Properties env = new Properties();
    env.put("jndi.syntax.direction", "flat");
    Name name = new CompoundName("Test", env);
    ex.setLinkRemainingName(name);
    ex.setLinkRemainingName(null);
    assertNull(ex.getLinkRemainingName());
}
项目:cn1    文件:LinkLoopExceptionTest.java   
public void testSetLinkResolvedName() throws InvalidNameException {
    LinkLoopException ex = new LinkLoopException("Test");
    Properties env = new Properties();
    env.put("jndi.syntax.direction", "flat");
    Name name = new CompoundName("Test", env);
    ex.setLinkResolvedName(name);
    ex.setLinkResolvedName(null);
    assertNull(ex.getLinkResolvedName());
}
项目:cn1    文件:LinkLoopExceptionTest.java   
public void testSetLinkRemainingName() throws InvalidNameException {
    LinkLoopException ex = new LinkLoopException("Test");
    Properties env = new Properties();
    env.put("jndi.syntax.direction", "flat");
    Name name = new CompoundName("Test", env);
    ex.setLinkRemainingName(name);
    ex.setLinkRemainingName(null);
    assertNull(ex.getLinkRemainingName());
}
项目:cn1    文件:MalformedLinkExceptionTest.java   
public void testSetLinkResolvedName() throws InvalidNameException {
    MalformedLinkException ex = new MalformedLinkException("Test");
    Properties env = new Properties();
    env.put("jndi.syntax.direction", "flat");
    Name name = new CompoundName("Test", env);
    ex.setLinkResolvedName(name);
    ex.setLinkResolvedName(null);
    assertNull(ex.getLinkResolvedName());
}
项目:cn1    文件:MalformedLinkExceptionTest.java   
public void testSetLinkRemainingName() throws InvalidNameException {
    MalformedLinkException ex = new MalformedLinkException("Test");
    Properties env = new Properties();
    env.put("jndi.syntax.direction", "flat");
    Name name = new CompoundName("Test", env);
    ex.setLinkRemainingName(name);
    ex.setLinkRemainingName(null);
    assertNull(ex.getLinkRemainingName());
}
项目:cn1    文件:ResolveResultTest.java   
public void testSetRemainingName_withCompoundName()
        throws InvalidNameException {
    ResolveResult resolveResult = new ResolveResult(strObj, name);

    Properties props = new Properties();
    props.put("jndi.syntax.separator", "/");
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.escape", "\\");
    props.put("jndi.syntax.beginquote", "<");
    props.put("jndi.syntax.endquote", ">");
    props.put("jndi.syntax.beginquote2", "'");
    props.put("jndi.syntax.endquote2", "'");
    props.put("jndi.syntax.ignorecase", "false");
    props.put("jndi.syntax.trimblanks", "false");
    CompoundName compoundName = new CompoundName("a", props);

    resolveResult.setRemainingName(compoundName);

    CompositeName newName = new CompositeName("a/b/c/d");
    try {
        resolveResult.appendRemainingName(newName);
        fail("Should throw a Error here");
    } catch (Error e) {
    }
    // compoundName.addAll(newName);
    // assertEquals(compoundName, resolveResult.getRemainingName());
}
项目:cn1    文件:CompoundNameTest.java   
public void testConstructor_Null_String() throws InvalidNameException {
    log.setMethod("testConstructor_Null_String()");

    try {
        new CompoundName((String) null, props);
        fail("should be null pointer exception");
    } catch (NullPointerException e) {
    }
}
项目:cn1    文件:CompoundNameTest.java   
public void testConstructor_Null_Props() throws InvalidNameException {
    log.setMethod("testConstructor_Null_Props()");

    try {
        new CompoundName("abc", null);
        fail("should be null pointer exception");
    } catch (NullPointerException e) {
    }
}
项目:cn1    文件:CompoundNameTest.java   
public void testConstructor_WithProps_D_NotFlat()
        throws InvalidNameException {
    log.setMethod("testConstructor_WithProps_D_NotFlat()");
    props.clear();
    props.put("jndi.syntax.direction", "left_to_right");

    try {
        new CompoundName("a/b/c", props);
        fail("has direction but no separator, should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
    }
}
项目:cn1    文件:CompoundNameTest.java   
public void testConstructor_WithProps_DS2() throws InvalidNameException {
    log.setMethod("testConstructor_WithProps_DS2()");
    props.clear();
    props.put("jndi.syntax.direction", "left_to_right");
    props.put("jndi.syntax.separator2", "/");
    try {
        new CompoundName("a/b/c", props);
        fail("IllegalArgumentException expected");
    } catch (IllegalArgumentException e) {
    }
}
项目:cn1    文件:CompoundNameTest.java   
public void testConstructor_WithIrregularProps() throws InvalidNameException {
    log.setMethod("testConstructor_WithIrregularProps()");
    try{
        new CompoundName("name", new UncloneableProperties());
    }catch(UnsupportedOperationException e){
        fail("unexpected UnsupportedOperationException");
    }
}
项目:cn1    文件:CompoundNameTest.java   
public void testConstructor_Advanced() throws InvalidNameException {
    log.setMethod("testConstructor_Advanced()");

    assertNameEmpty(new CompoundName("", props));
    assertNameEquals(new CompoundName("/", props), "");
    assertNameEquals(new CompoundName("//", props), "", "");
    assertNameEquals(new CompoundName("/a/", props), "", "a", "");
    assertNameEquals(new CompoundName("//a/", props), "", "", "a", "");
    assertNameEquals(new CompoundName("a/b/c/", props), "a", "b", "c", "");
    assertNameEquals(new CompoundName("/a/b/c", props), "", "a", "b", "c");

    assertNameEquals(new CompoundName("a/\\/b/c", props), "a", "/b", "c");
    assertNameEquals(new CompoundName("a/\\b/c", props), "a", "\\b", "c");
    assertInvalidName("a/b\\", props);

    assertNameEquals(new CompoundName("a/<b/>/c", props), "a", "b/", "c");
    assertNameEquals(new CompoundName("a/b<b/>b/c", props), "a", "b<b",
            ">b", "c");
    assertNameEquals(new CompoundName("a/<b</>/c", props), "a", "b</", "c");
    assertNameEquals(new CompoundName("a/\\/b>>>/c", props), "a", "/b>>>",
            "c");
    assertNameEquals(new CompoundName("a/</b\\a\\>b>/c", props), "a",
            "/b\\a>b", "c");
    assertInvalidName("a/<b/>b/c", props);
    assertInvalidName("a/</b>>/c", props);

    assertNameEquals(new CompoundName("a/'b/'/c", props), "a", "b/", "c");
    assertNameEquals(new CompoundName("a/'/b\\a\\'b'/c", props), "a",
            "/b\\a'b", "c");
    assertInvalidName("a/b'b/'b/c", props);
    assertInvalidName("a/'b/'b/c", props);
}