Package javax.naming

Examples of javax.naming.CannotProceedException


            }
        }
    }

    private static CannotProceedException cannotProceedException(final Object resolvedObject, final Name remainingName) {
        final CannotProceedException cpe = new CannotProceedException();
        cpe.setResolvedObj(resolvedObject);
        cpe.setRemainingName(remainingName);
        return cpe;
    }
View Full Code Here


  private static final Log log = new Log(CannotProceedExceptionTest.class);

  public void testConstructorAndGetterSetter() throws InvalidNameException {
    log.setMethod("testConstructorAndGetterSetter()");

    CannotProceedException cpe = new CannotProceedException();
    Name altName = new CompositeName("1");
    Context altContext = null;
    Hashtable<?, ?> h = new Hashtable<Object, Object>();
    Name newName = new CompositeName("2");

    cpe.setAltName(altName);
    assertEquals(altName, cpe.getAltName());

    cpe.setAltNameCtx(altContext);
    assertEquals(altContext, cpe.getAltNameCtx());

    cpe.setEnvironment(h);
    assertEquals(h, cpe.getEnvironment());

    cpe.setRemainingNewName(newName);
    assertEquals(newName, cpe.getRemainingNewName());
  }
View Full Code Here

    cpe.setRemainingNewName(newName);
    assertEquals(newName, cpe.getRemainingNewName());
  }

  public void testConstructor_defaultValue() {
    CannotProceedException cpe = new CannotProceedException();
    assertNull(cpe.getMessage());
    assertNull(cpe.getAltName());
    assertNull(cpe.getAltNameCtx());
    assertNull(cpe.getEnvironment());
    assertNull(cpe.getRemainingNewName());
  }
View Full Code Here

    assertNull(cpe.getEnvironment());
    assertNull(cpe.getRemainingNewName());
  }

  public void testGetEnvironment() {
    CannotProceedException exception = new CannotProceedException("Test");
    assertNull(exception.getEnvironment());
  }
View Full Code Here

        return false;
    }

    protected Context findNnsContext(Name name) throws NamingException {
        CannotProceedException cpe = null;
        if (env.containsKey(NamingManager.CPE)) {
            cpe = (CannotProceedException) env.get(NamingManager.CPE);
        } else {
            cpe = new CannotProceedException();
        }

        String dn = name.get(0);

        // seems altName always is "/"
        Name altName = new CompositeName();
        altName.add("");

        // if the dn doesn't exist, throw NameNotFoundException
        lookup(dn);

        Name resolvedName = cpe.getResolvedName();
        if (resolvedName == null) {
            resolvedName = new CompositeName();

        }

        resolvedName.add(dn);

        Name remainingName = name.getSuffix(1);
        if (remainingName.size() == 1 && remainingName.get(0).equals("")) {
            remainingName = new CompositeName();
            if (!resolvedName.get(resolvedName.size() - 1).equals("")) {
                resolvedName.add("");
            }
        }

        final LdapContextImpl context = new LdapContextImpl(this, env,
                composeName(new LdapName(dn), contextDn).toString());

        cpe.setAltName(altName);
        cpe.setAltNameCtx(context);
        cpe.setEnvironment((Hashtable<Object, Object>) env.clone());
        cpe.setRemainingName(remainingName);
        cpe.setResolvedName(resolvedName);

        RefAddr addr = new RefAddr("nns") { //$NON-NLS-1$

            private static final long serialVersionUID = -5428706819217461955L;

            @Override
            public Object getContent() {
                return context;
            }

        };

        // class name is always java.lang.Object in RI
        Reference ref = new Reference(Object.class.getName(), addr);

        cpe.setResolvedObj(ref);

        return DirectoryManager.getContinuationDirContext(cpe);
    }
View Full Code Here

    // Step 2: Create an instance of MyLdapContext
    DirContext context = new MyLdapContext();

    // Step 3: Create an instance of CannotProceedException,
    // and set the resolve object as "context"
    CannotProceedException exception = new CannotProceedException(
        "TestGetContinuationDirContext");
    exception.setResolvedObj(context);
    // Step 4: Call DirectoryManager.getContinuationDirContext and pass
    // the "exception";

    DirContext newContext = DirectoryManager
        .getContinuationDirContext(exception);
View Full Code Here

    Context context = new MyContext161();

    // 3.Set the Resolved Object of the CannotProceedException to be the
    // Context
    // created in step 2 using the setResolvedObj method.
    CannotProceedException ex = new CannotProceedException(
        "TestGetContinuationDirContext2");
    ex.setResolvedObj(context);

    // 4. Call the getcontinuationDirContext method of the DirectoryManager
    // class
    // passing the CannotProceedException object and modified at step 3.
    DirContext newContext = null;
View Full Code Here

    // 5. Check the DirContext returned in step 4: this will throw
    // javax.naming.CannotProceedException
  }

  public void testGetContinuationDirContext3() throws NamingException {
    CannotProceedException cpe = new CannotProceedException(
        "TestGetContinuationDirContext3");
    DirContext ctx = DirectoryManager.getContinuationDirContext(cpe);
    assertNotNull(ctx);
  }
View Full Code Here

     * @throws NamingException
     *             If some naming error occurs.
     */
    protected final CannotProceedException createCannotProceedException(
            Name name) throws NamingException {
        CannotProceedException cpe = new CannotProceedException();
        cpe.setResolvedObj(lookup(name.get(0)));
        cpe.setEnvironment(environment);
        return cpe;
    }
View Full Code Here

            throw new InvalidNameException(Messages.getString("jndi.4B")); //$NON-NLS-1$
        }

        // we should have correct nameToLookFor at this point
        if (remainingName != null) {
            CannotProceedException cpe = constructCannotProceedException(
                    altName, remainingName);
            DirContext nnsContext = DirectoryManager
                    .getContinuationDirContext(cpe);

            attrs = nnsContext.getAttributes(remainingName, attrNames);
View Full Code Here

TOP

Related Classes of javax.naming.CannotProceedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.