java.security.cert.LDAPCertStoreParameters Java Examples

The following examples show how to use java.security.cert.LDAPCertStoreParameters. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NoLDAP.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        Class.forName("javax.naming.ldap.LdapName");
        System.out.println("LDAP is present, test skipped");
        return;
    } catch (ClassNotFoundException ignore) { }

    try {
        CertStore.getInstance("LDAP", new LDAPCertStoreParameters());
        throw new RuntimeException("NoSuchAlgorithmException expected");
    } catch (NoSuchAlgorithmException x) {
        System.out.println("NoSuchAlgorithmException thrown as expected");
    }
}
 
Example #2
Source File: LDAPCertStoreParametersTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Test for <code>toString()</code> method<br>
 * Assertion: returns the formatted string describing parameters
 */
public final void testToString() {
    LDAPCertStoreParameters cp1 =
        new LDAPCertStoreParameters("myhost", 1101);

    assertNotNull(cp1.toString());
}
 
Example #3
Source File: LDAPCertStoreParametersTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Test for <code>clone()</code> method<br>
 * Assertion: Returns a copy of this object
 */
public final void testClone() {
    LDAPCertStoreParameters cp1 =
        new LDAPCertStoreParameters("myhost", 1100);
    LDAPCertStoreParameters cp2 = (LDAPCertStoreParameters)cp1.clone();
    // check that that we have new object
    assertTrue("newObject", cp1 != cp2);
    assertTrue("hostsTheSame",
            cp1.getServerName().equals(cp2.getServerName()));
    assertTrue("portsTheSame", cp1.getPort() == cp2.getPort());
}
 
Example #4
Source File: LDAPCertStoreParametersTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Test #2 for <code>LDAPCertStoreParameters(String, int)</code> constructor<br>
 * Assertion: Creates an instance of <code>LDAPCertStoreParameters</code>
 * with the specified parameter values
 */
public final void testLDAPCertStoreParametersStringint02() {
    String serverName = "myhost";
    int portNumber = 1099;
    LDAPCertStoreParameters cp =
        new LDAPCertStoreParameters(serverName, portNumber);
    assertTrue("host", serverName.equals(cp.getServerName()));
    assertTrue("port", cp.getPort() == portNumber);
}
 
Example #5
Source File: LDAPCertStoreParametersTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Test for <code>toString()</code> method<br>
 * Assertion: returns the port number
 */
public final void testGetPort() {
    int portNumber = -1099;
    LDAPCertStoreParameters cp =
        new LDAPCertStoreParameters("serverName", portNumber);
    assertTrue(cp.getPort() == portNumber);
}
 
Example #6
Source File: LDAPCertStoreParametersTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Test #3 for <code>LDAPCertStoreParameters(String)</code> constructor<br>
 * Assertion: throws <code>NullPointerException</code> -
 * if <code>serverName</code> is <code>null</code>
 */
public final void testLDAPCertStoreParametersString03() {
    try {
        new LDAPCertStoreParameters(null);
        fail("NPE expected");
    } catch (NullPointerException e) {
    }
}
 
Example #7
Source File: LDAPCertStoreParametersTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Test #2 for <code>LDAPCertStoreParameters(String)</code> constructor<br>
 * Assertion: Creates an instance of <code>LDAPCertStoreParameters</code>
 * with the specified server name and a default port of 389
 */
public final void testLDAPCertStoreParametersString02() {
    String serverName = "myhost";
    LDAPCertStoreParameters cp = new LDAPCertStoreParameters(serverName);
    assertTrue("host", serverName.equals(cp.getServerName()));
    assertEquals("port", 389, cp.getPort());
}
 
Example #8
Source File: NoLDAP.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        Class.forName("javax.naming.ldap.LdapName");
        System.out.println("LDAP is present, test skipped");
        return;
    } catch (ClassNotFoundException ignore) { }

    try {
        CertStore.getInstance("LDAP", new LDAPCertStoreParameters());
        throw new RuntimeException("NoSuchAlgorithmException expected");
    } catch (NoSuchAlgorithmException x) {
        System.out.println("NoSuchAlgorithmException thrown as expected");
    }
}
 
Example #9
Source File: NoLDAP.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        Class.forName("javax.naming.ldap.LdapName");
        System.out.println("LDAP is present, test skipped");
        return;
    } catch (ClassNotFoundException ignore) { }

    try {
        CertStore.getInstance("LDAP", new LDAPCertStoreParameters());
        throw new RuntimeException("NoSuchAlgorithmException expected");
    } catch (NoSuchAlgorithmException x) {
        System.out.println("NoSuchAlgorithmException thrown as expected");
    }
}
 
Example #10
Source File: NoLDAP.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        Class.forName("javax.naming.ldap.LdapName");
        System.out.println("LDAP is present, test skipped");
        return;
    } catch (ClassNotFoundException ignore) { }

    try {
        CertStore.getInstance("LDAP", new LDAPCertStoreParameters());
        throw new RuntimeException("NoSuchAlgorithmException expected");
    } catch (NoSuchAlgorithmException x) {
        System.out.println("NoSuchAlgorithmException thrown as expected");
    }
}
 
Example #11
Source File: NoLDAP.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        Class.forName("javax.naming.ldap.LdapName");
        System.out.println("LDAP is present, test skipped");
        return;
    } catch (ClassNotFoundException ignore) { }

    try {
        CertStore.getInstance("LDAP", new LDAPCertStoreParameters());
        throw new RuntimeException("NoSuchAlgorithmException expected");
    } catch (NoSuchAlgorithmException x) {
        System.out.println("NoSuchAlgorithmException thrown as expected");
    }
}
 
Example #12
Source File: NoLDAP.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        Class.forName("javax.naming.ldap.LdapName");
        System.out.println("LDAP is present, test skipped");
        return;
    } catch (ClassNotFoundException ignore) { }

    try {
        CertStore.getInstance("LDAP", new LDAPCertStoreParameters());
        throw new RuntimeException("NoSuchAlgorithmException expected");
    } catch (NoSuchAlgorithmException x) {
        System.out.println("NoSuchAlgorithmException thrown as expected");
    }
}
 
Example #13
Source File: NoLDAP.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        Class.forName("javax.naming.ldap.LdapName");
        System.out.println("LDAP is present, test skipped");
        return;
    } catch (ClassNotFoundException ignore) { }

    try {
        CertStore.getInstance("LDAP", new LDAPCertStoreParameters());
        throw new RuntimeException("NoSuchAlgorithmException expected");
    } catch (NoSuchAlgorithmException x) {
        System.out.println("NoSuchAlgorithmException thrown as expected");
    }
}
 
Example #14
Source File: NoLDAP.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        Class.forName("javax.naming.ldap.LdapName");
        System.out.println("LDAP is present, test skipped");
        return;
    } catch (ClassNotFoundException ignore) { }

    try {
        CertStore.getInstance("LDAP", new LDAPCertStoreParameters());
        throw new RuntimeException("NoSuchAlgorithmException expected");
    } catch (NoSuchAlgorithmException x) {
        System.out.println("NoSuchAlgorithmException thrown as expected");
    }
}
 
Example #15
Source File: NoLDAP.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        Class.forName("javax.naming.ldap.LdapName");
        System.out.println("LDAP is present, test skipped");
        return;
    } catch (ClassNotFoundException ignore) { }

    try {
        CertStore.getInstance("LDAP", new LDAPCertStoreParameters());
        throw new RuntimeException("NoSuchAlgorithmException expected");
    } catch (NoSuchAlgorithmException x) {
        System.out.println("NoSuchAlgorithmException thrown as expected");
    }
}
 
Example #16
Source File: NoLDAP.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        Class.forName("javax.naming.ldap.LdapName");
        System.out.println("LDAP is present, test skipped");
        return;
    } catch (ClassNotFoundException ignore) { }

    try {
        CertStore.getInstance("LDAP", new LDAPCertStoreParameters());
        throw new RuntimeException("NoSuchAlgorithmException expected");
    } catch (NoSuchAlgorithmException x) {
        System.out.println("NoSuchAlgorithmException thrown as expected");
    }
}
 
Example #17
Source File: NoLDAP.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        Class.forName("javax.naming.ldap.LdapName");
        System.out.println("LDAP is present, test skipped");
        return;
    } catch (ClassNotFoundException ignore) { }

    try {
        CertStore.getInstance("LDAP", new LDAPCertStoreParameters());
        throw new RuntimeException("NoSuchAlgorithmException expected");
    } catch (NoSuchAlgorithmException x) {
        System.out.println("NoSuchAlgorithmException thrown as expected");
    }
}
 
Example #18
Source File: NoLDAP.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        Class.forName("javax.naming.ldap.LdapName");
        System.out.println("LDAP is present, test skipped");
        return;
    } catch (ClassNotFoundException ignore) { }

    try {
        CertStore.getInstance("LDAP", new LDAPCertStoreParameters());
        throw new RuntimeException("NoSuchAlgorithmException expected");
    } catch (NoSuchAlgorithmException x) {
        System.out.println("NoSuchAlgorithmException thrown as expected");
    }
}
 
Example #19
Source File: NoLDAP.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        Class.forName("javax.naming.ldap.LdapName");
        System.out.println("LDAP is present, test skipped");
        return;
    } catch (ClassNotFoundException ignore) { }

    try {
        CertStore.getInstance("LDAP", new LDAPCertStoreParameters());
        throw new RuntimeException("NoSuchAlgorithmException expected");
    } catch (NoSuchAlgorithmException x) {
        System.out.println("NoSuchAlgorithmException thrown as expected");
    }
}
 
Example #20
Source File: X509LDAPCertStoreParameters.java    From ripple-lib-java with ISC License 4 votes vote down vote up
public static X509LDAPCertStoreParameters getInstance(LDAPCertStoreParameters params)
{
    String server = "ldap://" + params.getServerName() + ":" + params.getPort();
    X509LDAPCertStoreParameters _params = new Builder(server, "").build();
    return _params;
}
 
Example #21
Source File: X509LDAPCertStoreParameters.java    From RipplePower with Apache License 2.0 4 votes vote down vote up
public static X509LDAPCertStoreParameters getInstance(LDAPCertStoreParameters params)
{
    String server = "ldap://" + params.getServerName() + ":" + params.getPort();
    X509LDAPCertStoreParameters _params = new Builder(server, "").build();
    return _params;
}
 
Example #22
Source File: LDAPCertStoreParametersTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * Test for <code>toString()</code> method<br>
 * Assertion: returns the server name (never <code>null</code>)
 */
public final void testGetServerName() {
    LDAPCertStoreParameters cp =
        new LDAPCertStoreParameters("serverName");
    assertNotNull(cp.getServerName());
}
 
Example #23
Source File: LDAPCertStoreParametersTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * Test #1 for <code>LDAPCertStoreParameters(String, int)</code> constructor<br>
 * Assertion: Creates an instance of <code>LDAPCertStoreParameters</code>
 * with the specified parameter values
 */
public final void testLDAPCertStoreParametersStringint01() {
    CertStoreParameters cp = new LDAPCertStoreParameters("myhost", 1098);
    assertTrue("isLDAPCertStoreParameters",
            cp instanceof LDAPCertStoreParameters);
}
 
Example #24
Source File: LDAPCertStoreParametersTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * Test #1 for <code>LDAPCertStoreParameters(String)</code> constructor<br>
 * Assertion: Creates an instance of <code>LDAPCertStoreParameters</code>
 * with the specified server name and a default port of 389
 */
public final void testLDAPCertStoreParametersString01() {
    CertStoreParameters cp = new LDAPCertStoreParameters("myhost");
    assertTrue("isLDAPCertStoreParameters",
            cp instanceof LDAPCertStoreParameters);
}
 
Example #25
Source File: LDAPCertStoreParametersTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * Test #2 for <code>LDAPCertStoreParameters()</code> constructor<br>
 * Assertion: Creates an instance of <code>LDAPCertStoreParameters</code>
 * with the default parameter values (server name "localhost", port 389)
 */
public final void testLDAPCertStoreParameters02() {
    LDAPCertStoreParameters cp = new LDAPCertStoreParameters();
    assertEquals("host", "localhost", cp.getServerName());
    assertEquals("port", 389, cp.getPort());
}
 
Example #26
Source File: LDAPCertStoreParametersTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * Test #1 for <code>LDAPCertStoreParameters()</code> constructor<br>
 * Assertion: Creates an instance of <code>LDAPCertStoreParameters</code>
 * with the default parameter values (server name "localhost", port 389)
 */
public final void testLDAPCertStoreParameters01() {
    CertStoreParameters cp = new LDAPCertStoreParameters();
    assertTrue("isLDAPCertStoreParameters",
            cp instanceof LDAPCertStoreParameters);
}