Java 类javax.naming.ldap.StartTlsRequest 实例源码

项目:cn1    文件:StartTlsRequestTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.StartTlsRequest.createExtendedResponse(String, byte[], int, int)'</p>
 * <p>Here we are testing if this method creates an extended response object that corresponds to the LDAP StartTLS extended request.
 * In this case we are testing the extended response with the argument ID=""</p>
 * <p>The expected result is an exception.</p>
 */
public void testCreateExtendedResponse005() {
       StartTlsRequest str = new StartTlsRequest();
       try {
           str.createExtendedResponse("", null, 1, 2);
           fail("NamingException expected");
       } catch (NamingException e) {}
   }
项目:cn1    文件:StartTlsRequestTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.StartTlsRequest.createExtendedResponse(String, byte[], int, int)'</p>
 * <p>Here we are testing if this method creates an extended response object that corresponds to the LDAP StartTLS extended request.
 * In this case we are testing the extended response with the argument ID="1.3.6.1.4.1.1466.20037" and the others arguments should be ignored.</p>
 * <p>Notice here that this package does not have a provider so an implementation does not exist, so this test must not fail with a provider 
 * and fail with no provider.</p>
 * <p>The expected result is a Tls response.</p>
 */
public void testCreateExtendedResponse004() throws Exception {
    StartTlsRequest str = new StartTlsRequest();
    String ID = "1.3.6.1.4.1.1466.20037";
    int t1 = 210, t2 = 650;
    byte[] t0 = ID.getBytes();

    StartTlsResponse x = (StartTlsResponse) str.createExtendedResponse(ID,
            t0, t1, t2);
    assertEquals(MockStartTlsResponse.class, x.getClass());
}
项目:freeVM    文件:StartTlsRequestTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.StartTlsRequest.createExtendedResponse(String, byte[], int, int)'</p>
 * <p>Here we are testing if this method creates an extended response object that corresponds to the LDAP StartTLS extended request.
 * In this case we are testing the extended response with the argument ID=""</p>
 * <p>The expected result is an exception.</p>
 */
public void testCreateExtendedResponse005() {
       StartTlsRequest str = new StartTlsRequest();
       try {
           str.createExtendedResponse("", null, 1, 2);
           fail("NamingException expected");
       } catch (NamingException e) {}
   }
项目:freeVM    文件:StartTlsRequestTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.StartTlsRequest.createExtendedResponse(String, byte[], int, int)'</p>
 * <p>Here we are testing if this method creates an extended response object that corresponds to the LDAP StartTLS extended request.
 * In this case we are testing the extended response with the argument ID="1.3.6.1.4.1.1466.20037" and the others arguments should be ignored.</p>
 * <p>Notice here that this package does not have a provider so an implementation does not exist, so this test must not fail with a provider 
 * and fail with no provider.</p>
 * <p>The expected result is a Tls response.</p>
 */
public void testCreateExtendedResponse004() throws Exception {
    StartTlsRequest str = new StartTlsRequest();
    String ID = "1.3.6.1.4.1.1466.20037";
    int t1 = 210, t2 = 650;
    byte[] t0 = ID.getBytes();

    StartTlsResponse x = (StartTlsResponse) str.createExtendedResponse(ID,
            t0, t1, t2);
    assertEquals(MockStartTlsResponse.class, x.getClass());
}
项目:freeVM    文件:StartTlsRequestTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.StartTlsRequest.createExtendedResponse(String, byte[], int, int)'</p>
 * <p>Here we are testing if this method creates an extended response object that corresponds to the LDAP StartTLS extended request.
 * In this case we are testing the extended response with the argument ID=""</p>
 * <p>The expected result is an exception.</p>
 */
public void testCreateExtendedResponse005() {
       StartTlsRequest str = new StartTlsRequest();
       try {
           str.createExtendedResponse("", null, 1, 2);
           fail("NamingException expected");
       } catch (NamingException e) {}
   }
项目:freeVM    文件:StartTlsRequestTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.StartTlsRequest.createExtendedResponse(String, byte[], int, int)'</p>
 * <p>Here we are testing if this method creates an extended response object that corresponds to the LDAP StartTLS extended request.
 * In this case we are testing the extended response with the argument ID="1.3.6.1.4.1.1466.20037" and the others arguments should be ignored.</p>
 * <p>Notice here that this package does not have a provider so an implementation does not exist, so this test must not fail with a provider 
 * and fail with no provider.</p>
 * <p>The expected result is a Tls response.</p>
 */
public void testCreateExtendedResponse004() throws Exception {
    StartTlsRequest str = new StartTlsRequest();
    String ID = "1.3.6.1.4.1.1466.20037";
    int t1 = 210, t2 = 650;
    byte[] t0 = ID.getBytes();

    StartTlsResponse x = (StartTlsResponse) str.createExtendedResponse(ID,
            t0, t1, t2);
    assertEquals(MockStartTlsResponse.class, x.getClass());
}
项目:spring-ldap    文件:AbstractTlsDirContextAuthenticationStrategy.java   
public final DirContext processContextAfterCreation(DirContext ctx, String userDn, String password)
        throws NamingException {

    if (ctx instanceof LdapContext) {
        final LdapContext ldapCtx = (LdapContext) ctx;
        final StartTlsResponse tlsResponse = (StartTlsResponse) ldapCtx.extendedOperation(new StartTlsRequest());
        try {
            if (hostnameVerifier != null) {
                tlsResponse.setHostnameVerifier(hostnameVerifier);
            }
            tlsResponse.negotiate(sslSocketFactory); // If null, the default SSL socket factory is used
            applyAuthentication(ldapCtx, userDn, password);

            if (shutdownTlsGracefully) {
                // Wrap the target context in a proxy to intercept any calls
                // to 'close', so that we can shut down the TLS connection
                // gracefully first.
                return (DirContext) Proxy.newProxyInstance(DirContextProxy.class.getClassLoader(), new Class<?>[] {
                        LdapContext.class, DirContextProxy.class }, new TlsAwareDirContextProxy(ldapCtx,
                        tlsResponse));
            }
            else {
                return ctx;
            }
        }
        catch (IOException e) {
            LdapUtils.closeContext(ctx);
            throw new UncategorizedLdapException("Failed to negotiate TLS session", e);
        }
    }
    else {
        throw new IllegalArgumentException(
                "Processed Context must be an LDAPv3 context, i.e. an LdapContext implementation");
    }

}
项目:pentaho-kettle    文件:LdapTlsProtocolIT.java   
@Before
public void setup() throws NamingException {
  mockLogChannelInterface = mock( LogChannelInterface.class );
  mockVariableSpace = mock( VariableSpace.class );
  mockLdapMeta = mock( LdapMeta.class );
  mockInitialLdapContext = mock( InitialLdapContext.class );
  mockStartTlsResponse = mock( StartTlsResponse.class );
  when( mockInitialLdapContext.extendedOperation( any( StartTlsRequest.class ) ) ).thenReturn(
    mockStartTlsResponse );
}
项目:cn1    文件:LdapClient.java   
private void processResponse(LdapMessage response, Exception ex) {
    // unsolicited notification
    if (response.getMessageId() == 0) {
        notifyUnls(response);
        return;
    }

    Element element = requests.get(Integer.valueOf(response
            .getMessageId()));
    if (element == null
            && batchedSearchRequests.contains(Integer.valueOf(response
                    .getMessageId()))) {
        element = batchedSearchRequests.get(Integer.valueOf(response
                .getMessageId()));
        // error occurs when read response
        if (ex != null) {
            ((SearchOp) response.getResponseOp()).getSearchResult()
                    .setException(ex);
            batchedSearchRequests.remove(Integer.valueOf(response
                    .getMessageId()));
            return;
        }

        // wait time out
        if (element.response.getMessageId() != response.getMessageId()) {
            // ldap.31=Read LDAP response message time out
            ((SearchOp) response.getResponseOp()).getSearchResult()
                    .setException(
                            new IOException(Messages
                                    .getString("ldap.31"))); //$NON-NLS-1$);
            batchedSearchRequests.remove(Integer.valueOf(response
                    .getMessageId()));
            return;
        }

    }
    if (element != null) {
        element.response = response;
        element.ex = ex;
        // persistent search response || search response
        if (element.lock == null) {
            notifyPersistenSearchListener(element);

        } else {
            if (element.response.getOperationIndex() == LdapASN1Constant.OP_EXTENDED_RESPONSE
                    && ((ExtendedOp) element.response.getResponseOp())
                            .getExtendedRequest().getID().equals(
                                    StartTlsRequest.OID)) {
                /*
                 * When establishing TLS by StartTls extended operation,
                 * no
                 */
                isStopped = true;
            }

            /*
             * notify the thread which send request and wait for
             * response
             */
            synchronized (element.lock) {
                element.lock.notify();
            }
        } // end of if (element.lock == null) else
    } // end of if (element != null)

    else if (ex != null) {
        /*
         * may asn1 decode error or socket problem, can get message id,
         * so couldn't know which thread should be notified
         */
        // FIXME: any better way?
        close();
    }
    // FIXME message id not found and no exception, what shoud we do?

}
项目:read-open-source-code    文件:LDAPConnection.java   
/**
 *  Connect to LDAP server
 *  @param username : username
 *  @param password : password
 *  @throws KettleException
 */
public void connect(String username, String password) throws KettleException {

  getEnv().put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
  getEnv().put("java.naming.ldap.derefAliases", getDerefAliases());
  getEnv().put(Context.REFERRAL, getReferral());

  if (getHostName().indexOf("ldap://") >= 0)
    getEnv().put(Context.PROVIDER_URL, getHostName() + ":" + getPort());
  else
    getEnv().put(Context.PROVIDER_URL, "ldap://" + getHostName() + ":" + getPort());

  if (getProtocol() == PROTOCOL_LDAP_SSL) {
    getEnv().put(javax.naming.Context.SECURITY_PROTOCOL, "ssl");

    // setup factory for SSL; for TLS, we specify this factory in the StartTlsResponse.negotiate(factory) call
    getEnv().put("java.naming.ldap.factory.socket",
        "org.pentaho.di.trans.steps.ldapinput.store.CustomdSocketFactory");
  }

  if (getProtocol() != PROTOCOL_LDAP) { // if SSL or TLS
      if (isTrustAllCertificates()) {
        CustomSocketFactory.configure();
      } else {
        CustomSocketFactory.configure(getTrustStorePath(), getTrustStorePassword());
      }
  }

  if (!Const.isEmpty(username)) {
    this.username = username;
    getEnv().put(Context.SECURITY_PRINCIPAL, username);
    getEnv().put(Context.SECURITY_CREDENTIALS, password);
    getEnv().put(Context.SECURITY_AUTHENTICATION, "simple");
  } else {
    getEnv().put(Context.SECURITY_AUTHENTICATION, "none");
  }

  try {
    /* Establish LDAP association */
    this.ctx = new InitialLdapContext(getEnv(), null);
    if (getInitialContext() == null) {
      throw new KettleException(BaseMessages.getString(PKG, "LDAPInput.Error.UnableToConnectToServer"));
    }

    if (getProtocol() == PROTOCOL_LDAP_TLS) {
      /* Requesting to start TLS on an LDAP association */
      StartTlsRequest tlsRequest = new StartTlsRequest();
      this.tls = (StartTlsResponse) getInitialContext().extendedOperation(tlsRequest);
      /* Starting TLS */
      this.tls.negotiate((SSLSocketFactory) CustomSocketFactory.getDefault());
    }

    if (log.isBasic())
      log.logBasic(BaseMessages.getString(PKG, "LDAPInput.Log.ConnectedToServer", getHostName(),
          Const.NVL(getUserName(), "")));
    if (log.isDetailed())
      log.logDetailed(BaseMessages.getString(PKG, "LDAPInput.ClassUsed.Message", getInitialContext().getClass()
          .getName()));

  } catch (Exception e) {
    throw new KettleException(BaseMessages.getString(PKG, "LDAPinput.Exception.ErrorConnecting", e.getMessage()), e);
  }
}
项目:nextop-client    文件:LdapClient.java   
private void processResponse(LdapMessage response, Exception ex) {
    // unsolicited notification
    if (response.getMessageId() == 0) {
        notifyUnls(response);
        return;
    }

    Element element = requests.get(Integer.valueOf(response
            .getMessageId()));
    if (element == null
            && batchedSearchRequests.contains(Integer.valueOf(response
                    .getMessageId()))) {
        element = batchedSearchRequests.get(Integer.valueOf(response
                .getMessageId()));
        // error occurs when read response
        if (ex != null) {
            ((SearchOp) response.getResponseOp()).getSearchResult()
                    .setException(ex);
            batchedSearchRequests.remove(Integer.valueOf(response
                    .getMessageId()));
            return;
        }

        // wait time out
        if (element.response.getMessageId() != response.getMessageId()) {
            // ldap.31=Read LDAP response message time out
            ((SearchOp) response.getResponseOp()).getSearchResult()
                    .setException(
                            new IOException(Messages
                                    .getString("ldap.31"))); //$NON-NLS-1$);
            batchedSearchRequests.remove(Integer.valueOf(response
                    .getMessageId()));
            return;
        }

    }
    if (element != null) {
        element.response = response;
        element.ex = ex;
        // persistent search response || search response
        if (element.lock == null) {
            notifyPersistenSearchListener(element);

        } else {
            if (element.response.getOperationIndex() == LdapASN1Constant.OP_EXTENDED_RESPONSE
                    && ((ExtendedOp) element.response.getResponseOp())
                            .getExtendedRequest().getID().equals(
                                    StartTlsRequest.OID)) {
                /*
                 * When establishing TLS by StartTls extended operation,
                 * no
                 */
                isStopped = true;
            }

            /*
             * notify the thread which send request and wait for
             * response
             */
            synchronized (element.lock) {
                element.lock.notify();
            }
        } // end of if (element.lock == null) else
    } // end of if (element != null)

    else if (ex != null) {
        /*
         * may asn1 decode error or socket problem, can get message id,
         * so couldn't know which thread should be notified
         */
        // FIXME: any better way?
        close();
    }
    // FIXME message id not found and no exception, what shoud we do?

}
项目:kettle-4.4.0-stable    文件:LDAPConnection.java   
/**
 *  Connect to LDAP server
 *  @param username : username
 *  @param password : password
 *  @throws KettleException
 */
public void connect(String username, String password) throws KettleException {

  getEnv().put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
  getEnv().put("java.naming.ldap.derefAliases", getDerefAliases());
  getEnv().put(Context.REFERRAL, getReferral());

  if (getHostName().indexOf("ldap://") >= 0)
    getEnv().put(Context.PROVIDER_URL, getHostName() + ":" + getPort());
  else
    getEnv().put(Context.PROVIDER_URL, "ldap://" + getHostName() + ":" + getPort());

  if (getProtocol() == PROTOCOL_LDAP_SSL) {
    getEnv().put(javax.naming.Context.SECURITY_PROTOCOL, "ssl");

    // setup factory for SSL; for TLS, we specify this factory in the StartTlsResponse.negotiate(factory) call
    getEnv().put("java.naming.ldap.factory.socket",
        "org.pentaho.di.trans.steps.ldapinput.store.CustomdSocketFactory");
  }

  if (getProtocol() != PROTOCOL_LDAP) { // if SSL or TLS
      if (isTrustAllCertificates()) {
        CustomSocketFactory.configure();
      } else {
        CustomSocketFactory.configure(getTrustStorePath(), getTrustStorePassword());
      }
  }

  if (!Const.isEmpty(username)) {
    this.username = username;
    getEnv().put(Context.SECURITY_PRINCIPAL, username);
    getEnv().put(Context.SECURITY_CREDENTIALS, password);
    getEnv().put(Context.SECURITY_AUTHENTICATION, "simple");
  } else {
    getEnv().put(Context.SECURITY_AUTHENTICATION, "none");
  }

  try {
    /* Establish LDAP association */
    this.ctx = new InitialLdapContext(getEnv(), null);
    if (getInitialContext() == null) {
      throw new KettleException(BaseMessages.getString(PKG, "LDAPInput.Error.UnableToConnectToServer"));
    }

    if (getProtocol() == PROTOCOL_LDAP_TLS) {
      /* Requesting to start TLS on an LDAP association */
      StartTlsRequest tlsRequest = new StartTlsRequest();
      this.tls = (StartTlsResponse) getInitialContext().extendedOperation(tlsRequest);
      /* Starting TLS */
      this.tls.negotiate((SSLSocketFactory) CustomSocketFactory.getDefault());
    }

    if (log.isBasic())
      log.logBasic(BaseMessages.getString(PKG, "LDAPInput.Log.ConnectedToServer", getHostName(),
          Const.NVL(getUserName(), "")));
    if (log.isDetailed())
      log.logDetailed(BaseMessages.getString(PKG, "LDAPInput.ClassUsed.Message", getInitialContext().getClass()
          .getName()));

  } catch (Exception e) {
    throw new KettleException(BaseMessages.getString(PKG, "LDAPinput.Exception.ErrorConnecting", e.getMessage()), e);
  }
}
项目:freeVM    文件:LdapClient.java   
private void processResponse(LdapMessage response, Exception ex) {
    // unsolicited notification
    if (response.getMessageId() == 0) {
        notifyUnls(response);
        return;
    }

    Element element = requests.get(Integer.valueOf(response
            .getMessageId()));
    if (element == null
            && batchedSearchRequests.contains(Integer.valueOf(response
                    .getMessageId()))) {
        element = batchedSearchRequests.get(Integer.valueOf(response
                .getMessageId()));
        // error occurs when read response
        if (ex != null) {
            ((SearchOp) response.getResponseOp()).getSearchResult()
                    .setException(ex);
            batchedSearchRequests.remove(Integer.valueOf(response
                    .getMessageId()));
            return;
        }

        // wait time out
        if (element.response.getMessageId() != response.getMessageId()) {
            // ldap.31=Read LDAP response message time out
            ((SearchOp) response.getResponseOp()).getSearchResult()
                    .setException(
                            new IOException(Messages
                                    .getString("ldap.31"))); //$NON-NLS-1$);
            batchedSearchRequests.remove(Integer.valueOf(response
                    .getMessageId()));
            return;
        }

    }
    if (element != null) {
        element.response = response;
        element.ex = ex;
        // persistent search response || search response
        if (element.lock == null) {
            notifyPersistenSearchListener(element);

        } else {
            if (element.response.getOperationIndex() == LdapASN1Constant.OP_EXTENDED_RESPONSE
                    && ((ExtendedOp) element.response.getResponseOp())
                            .getExtendedRequest().getID().equals(
                                    StartTlsRequest.OID)) {
                /*
                 * When establishing TLS by StartTls extended operation,
                 * no
                 */
                isStopped = true;
            }

            /*
             * notify the thread which send request and wait for
             * response
             */
            synchronized (element.lock) {
                element.lock.notify();
            }
        } // end of if (element.lock == null) else
    } // end of if (element != null)

    else if (ex != null) {
        /*
         * may asn1 decode error or socket problem, can get message id,
         * so couldn't know which thread should be notified
         */
        // FIXME: any better way?
        close();
    }
    // FIXME message id not found and no exception, what shoud we do?

}
项目:kettle-trunk    文件:LDAPConnection.java   
/**
 *  Connect to LDAP server
 *  @param username : username
 *  @param password : password
 *  @throws KettleException
 */
public void connect(String username, String password) throws KettleException {

  getEnv().put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
  getEnv().put("java.naming.ldap.derefAliases", getDerefAliases());
  getEnv().put(Context.REFERRAL, getReferral());

  if (getHostName().indexOf("ldap://") >= 0)
    getEnv().put(Context.PROVIDER_URL, getHostName() + ":" + getPort());
  else
    getEnv().put(Context.PROVIDER_URL, "ldap://" + getHostName() + ":" + getPort());

  if (getProtocol() == PROTOCOL_LDAP_SSL) {
    getEnv().put(javax.naming.Context.SECURITY_PROTOCOL, "ssl");

    // setup factory for SSL; for TLS, we specify this factory in the StartTlsResponse.negotiate(factory) call
    getEnv().put("java.naming.ldap.factory.socket",
        "org.pentaho.di.trans.steps.ldapinput.store.CustomdSocketFactory");
  }

  if (getProtocol() != PROTOCOL_LDAP) { // if SSL or TLS
      if (isTrustAllCertificates()) {
        CustomSocketFactory.configure();
      } else {
        CustomSocketFactory.configure(getTrustStorePath(), getTrustStorePassword());
      }
  }

  if (!Const.isEmpty(username)) {
    this.username = username;
    getEnv().put(Context.SECURITY_PRINCIPAL, username);
    getEnv().put(Context.SECURITY_CREDENTIALS, password);
    getEnv().put(Context.SECURITY_AUTHENTICATION, "simple");
  } else {
    getEnv().put(Context.SECURITY_AUTHENTICATION, "none");
  }

  try {
    /* Establish LDAP association */
    this.ctx = new InitialLdapContext(getEnv(), null);
    if (getInitialContext() == null) {
      throw new KettleException(BaseMessages.getString(PKG, "LDAPInput.Error.UnableToConnectToServer"));
    }

    if (getProtocol() == PROTOCOL_LDAP_TLS) {
      /* Requesting to start TLS on an LDAP association */
      StartTlsRequest tlsRequest = new StartTlsRequest();
      this.tls = (StartTlsResponse) getInitialContext().extendedOperation(tlsRequest);
      /* Starting TLS */
      this.tls.negotiate((SSLSocketFactory) CustomSocketFactory.getDefault());
    }

    if (log.isBasic())
      log.logBasic(BaseMessages.getString(PKG, "LDAPInput.Log.ConnectedToServer", getHostName(),
          Const.NVL(getUserName(), "")));
    if (log.isDetailed())
      log.logDetailed(BaseMessages.getString(PKG, "LDAPInput.ClassUsed.Message", getInitialContext().getClass()
          .getName()));

  } catch (Exception e) {
    throw new KettleException(BaseMessages.getString(PKG, "LDAPinput.Exception.ErrorConnecting", e.getMessage()), e);
  }
}
项目:cn1    文件:TestInitialLdapContext.java   
/**
 * <p>
 * Test method for
 * 'javax.naming.ldap.InitialLdapContext.extendedOperation(ExtendedRequest)'
 * </p>
 * <p>
 * Here we are testing if this method correctly executes the given
 * operation. Here we send a non-null ExtendedRequest.
 * </p>
 * <p>
 * The expected result is an ExtendedResponse.
 * </p>
 */
public void testExtendedOperation002() throws Exception {
    System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                    "org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
    InitialLdapContext x = new InitialLdapContext();
    StartTlsResponse f = (StartTlsResponse)x.extendedOperation(new StartTlsRequest());
    assertNotNull(f);
    x.close();
}
项目:freeVM    文件:TestInitialLdapContext.java   
/**
 * <p>
 * Test method for
 * 'javax.naming.ldap.InitialLdapContext.extendedOperation(ExtendedRequest)'
 * </p>
 * <p>
 * Here we are testing if this method performs an extended operation. Here
 * we send a not null extended operation.
 * </p>
 * <p>
 * The expected result is an Extended Response.
 * </p>
 */
public void testExtendedOperation002() throws Exception {
    System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                    "org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
    InitialLdapContext x = new InitialLdapContext();
    StartTlsResponse f = (StartTlsResponse)x.extendedOperation(new StartTlsRequest());
    assertNotNull(f);
    x.close();
}
项目:freeVM    文件:TestInitialLdapContext.java   
/**
 * <p>
 * Test method for
 * 'javax.naming.ldap.InitialLdapContext.extendedOperation(ExtendedRequest)'
 * </p>
 * <p>
 * Here we are testing if this method correctly executes the given
 * operation. Here we send a non-null ExtendedRequest.
 * </p>
 * <p>
 * The expected result is an ExtendedResponse.
 * </p>
 */
public void testExtendedOperation002() throws Exception {
    System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                    "org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
    InitialLdapContext x = new InitialLdapContext();
    StartTlsResponse f = (StartTlsResponse)x.extendedOperation(new StartTlsRequest());
    assertNotNull(f);
    x.close();
}
项目:cn1    文件:StartTlsRequestTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.StartTlsRequest.getID()'</p>
 * <p>Here we are testing if this method retrieves the StartTLS request's object identifier string.</p>
 * <p>The expected result is a string : "1.3.6.1.4.1.1466.20037".</p>
 */
public void testGetID() {
       assertEquals("1.3.6.1.4.1.1466.20037", StartTlsRequest.OID);
       assertSame(StartTlsRequest.OID, new StartTlsRequest().getID());
   }
项目:cn1    文件:StartTlsRequestTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.StartTlsRequest.getEncodedValue()'</p>
 * <p>Here we are testing if this method retrieves the StartTLS request's ASN.1 BER encoded value.</p>
 * <p>The expected result is a null value.</p>
 */
public void testGetEncodedValue() {
       assertNull(new StartTlsRequest().getEncodedValue());
   }
项目:freeVM    文件:StartTlsRequestTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.StartTlsRequest.getID()'</p>
 * <p>Here we are testing if this method retrieves the StartTLS request's object identifier string.</p>
 * <p>The expected result is a string : "1.3.6.1.4.1.1466.20037".</p>
 */
public void testGetID() {
       assertEquals("1.3.6.1.4.1.1466.20037", StartTlsRequest.OID);
       assertSame(StartTlsRequest.OID, new StartTlsRequest().getID());
   }
项目:freeVM    文件:StartTlsRequestTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.StartTlsRequest.getEncodedValue()'</p>
 * <p>Here we are testing if this method retrieves the StartTLS request's ASN.1 BER encoded value.</p>
 * <p>The expected result is a null value.</p>
 */
public void testGetEncodedValue() {
       assertNull(new StartTlsRequest().getEncodedValue());
   }
项目:freeVM    文件:StartTlsRequestTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.StartTlsRequest.getID()'</p>
 * <p>Here we are testing if this method retrieves the StartTLS request's object identifier string.</p>
 * <p>The expected result is a string : "1.3.6.1.4.1.1466.20037".</p>
 */
public void testGetID() {
       assertEquals("1.3.6.1.4.1.1466.20037", StartTlsRequest.OID);
       assertSame(StartTlsRequest.OID, new StartTlsRequest().getID());
   }
项目:freeVM    文件:StartTlsRequestTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.StartTlsRequest.getEncodedValue()'</p>
 * <p>Here we are testing if this method retrieves the StartTLS request's ASN.1 BER encoded value.</p>
 * <p>The expected result is a null value.</p>
 */
public void testGetEncodedValue() {
       assertNull(new StartTlsRequest().getEncodedValue());
   }