Examples of ProxyTrustIterator


Examples of net.jini.security.proxytrust.ProxyTrustIterator

     *
     * @return a proxy trust iterator suitable for use by
     * <code>ProxyTrustVerifier</code>
     **/
    protected ProxyTrustIterator getProxyTrustIterator() {
  return new ProxyTrustIterator() {
      private int retries = MAX_RETRIES + 1;
      private boolean force = false;
      private Remote currProxy = null;
      private Exception fail = null;
      private RemoteException ex = null;
View Full Code Here

Examples of net.jini.security.proxytrust.ProxyTrustIterator

     *
     * @return a proxy trust iterator suitable for use by
     * <code>ProxyTrustVerifier</code>
     **/
    protected ProxyTrustIterator getProxyTrustIterator() {
  return new ProxyTrustIterator() {
      private int retries = MAX_RETRIES + 1;
      private boolean force = false;
      private Remote currProxy = null;
      private Exception fail = null;
      private RemoteException ex = null;
View Full Code Here

Examples of net.jini.security.proxytrust.ProxyTrustIterator

    /**
     * This method performs all actions mentioned in class description.
     *
     */
    public void run() throws Exception {
        ProxyTrustIterator pti = null;
        Object obj = new Object();
        RemoteException re = new RemoteException();

        try {
            pti = new SingletonProxyTrustIterator(null);

            // FAIL
            throw new TestException(
                    "Constructor invocation of SingletonProxyTrustIterator "
                    + "with null parameter did not throw any exception "
                    + "while NullPointerException was expected.");
        } catch (NullPointerException npe) {
            // PASS
            logger.fine("Constructor invocation of "
                    + "SingletonProxyTrustIterator with null parameter "
                    + "threw NullPointerException as expected.");
        }
        pti = new SingletonProxyTrustIterator(obj);
        logger.fine("Constructed SingletonProxyTrustIterator(" + obj + ").");

            try {
            pti.setException(re);

            // FAIL
            throw new TestException(
                    "'setExcepion' method invocation of constructed "
                    + "SingletonProxyTrustIterator just after it's "
                    + "construction did not throw any exception "
                    + "while IllegalStateException was expected.");
        } catch (IllegalStateException ise) {
            // PASS
            logger.fine("'setExcepion' method invocation of constructed "
                    + "SingletonProxyTrustIterator just after it's "
                    + "construction threw IllegalStateException "
                    + "as expected.");
        }

        if (!pti.hasNext()) {
            // FAIL
            throw new TestException(
                    "First 'hasNext' method invocation of constructed "
                    + "SingletonProxyTrustIterator just after it's "
                    + "construction returned false while true was "
                    + "expected");
        }

        // PASS
        logger.fine("First 'hasNext' method invocation of constructed "
                + "SingletonProxyTrustIterator just after it's "
                + "construction returned true as expected");

        try {
            pti.setException(re);

            // FAIL
            throw new TestException(
                    "'setExcepion' method invocation of constructed "
                    + "SingletonProxyTrustIterator after it's 'hasNext' "
                    + "method invocation did not throw any exception "
                    + "while IllegalStateException was expected.");
        } catch (IllegalStateException ise) {
            // PASS
            logger.fine("'setExcepion' method invocation of constructed "
                    + "SingletonProxyTrustIterator after it's 'hasNext' "
                    + "method invocation threw IllegalStateException "
                    + "as expected.");
        }
        Object res = pti.next();

        if (res != obj) {
            // FAIL
            throw new TestException(
                    "First 'next' method invocation of constructed "
                    + "SingletonProxyTrustIterator returned " + res
                    + " while " + obj + " was expected.");
        }

        // PASS
        logger.fine("First 'next' method invocation of constructed "
                + "SingletonProxyTrustIterator returned " + obj
                + " as expected.");
        pti.setException(re);

        // PASS
        logger.fine("'setExcepion' method invocation of constructed "
                + "SingletonProxyTrustIterator after it's 'next' "
                + "method invocation did not throw any exception "
                + "as expected.");

        try {
            pti.setException(re);

            // FAIL
            throw new TestException(
                    "2-nd 'setExcepion' method invocation of constructed "
                    + "SingletonProxyTrustIterator after it's 'next' "
                    + "method invocation did not throw any exception "
                    + "while IllegalStateException was expected.");
        } catch (IllegalStateException ise) {
            // PASS
            logger.fine("2-nd 'setExcepion' method invocation of "
                    + "constructed SingletonProxyTrustIterator after it's "
                    + "'next' method invocation threw "
                    + "IllegalStateException as expected.");
        }

        if (pti.hasNext()) {
            // FAIL
            throw new TestException(
                    "2-nd 'hasNext' method invocation of constructed "
                    + "SingletonProxyTrustIterator returned true while "
                    + "false was expected");
        }

        // PASS
        logger.fine("2-nd 'hasNext' method invocation of constructed "
                + "SingletonProxyTrustIterator returned false as expected");

        try {
            res = pti.next();

            // FAIL
            throw new TestException(
                    "2-nd 'next' method invocation of constructed "
                    + "SingletonProxyTrustIterator did not throw any "
                    + "exception while NoSuchElementException was "
                    + "expected.");
        } catch (NoSuchElementException nsee) {
            // PASS
            logger.fine("2-nd 'next' method invocation of constructed "
                    + "SingletonProxyTrustIterator threw "
                    + "NoSuchElementException as expected.");
        }
        pti = new SingletonProxyTrustIterator(obj);
        logger.fine("Constructed SingletonProxyTrustIterator(" + obj
                + ") again.");
        pti.next();
        pti.hasNext();

        try {
            pti.setException(re);

            // FAIL
            throw new TestException(
                    "'setExcepion' method invocation of constructed "
                    + "SingletonProxyTrustIterator after it's 'next' and "
View Full Code Here

Examples of net.jini.security.proxytrust.ProxyTrustIterator

        ProxyTrust boot = createValidBootProxy();
        ProxyTrustInvocationHandler ptih = createPTIH(main, boot);
        Method m = ProxyTrustInvocationHandler.class.getDeclaredMethod(
                "getProxyTrustIterator", new Class[0]);
        m.setAccessible(true);
        ProxyTrustIterator res = (ProxyTrustIterator) m.invoke(ptih, null);

        if (!res.hasNext()) {
            // FAIL
            throw new TestException(
                    "'getProxyTrustIterator' method of constructed "
                    + "ProxyTrustInvocationHandler returned empty "
                    + "ProxyTrustIterator.");
        }
        Object cont = res.next();

        if (cont != boot) {
            // FAIL
            throw new TestException(
                    "'getProxyTrustIterator' method of constructed "
                    + "ProxyTrustInvocationHandler returned "
                    + "ProxyTrustIterator, 1-st element of which contains "
                    + cont + " while " + boot + " was expected.");
        }

        if (res.hasNext()) {
            // FAIL
            throw new TestException(
                    "'getProxyTrustIterator' method of constructed "
                    + "ProxyTrustInvocationHandler returned "
                    + "ProxyTrustIterator which contains more than 1 "
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.