/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2014 Red Hat, Inc., and individual contributors
 * as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.wildfly.security.ssl;

import org.junit.Assert;
import org.junit.Test;

public class MechanismDatabaseTest {

    @Test
    public void testBasicLoad() {
        final MechanismDatabase instance = MechanismDatabase.getInstance();
        final MechanismDatabase.Entry entry = instance.getCipherSuiteOpenSSLName("NULL-MD5");
        Assert.assertNotNull(entry);
    }

    @Test
    public void testEdhDheMapping() {
        final MechanismDatabase instance = MechanismDatabase.getInstance();
        MechanismDatabase.Entry entry;
        entry = instance.getCipherSuiteOpenSSLName("EXP-DHE-RSA-DES-CBC-SHA");
        Assert.assertNotNull(entry);
        entry = instance.getCipherSuiteOpenSSLName("DHE-DSS-CBC-SHA");
        Assert.assertNotNull(entry);
        entry = instance.getCipherSuiteOpenSSLName("EDH-DSS-DES-CBC-SHA");
        Assert.assertNotNull(entry);
        System.out.println(entry);
    }

}

@@ -785,16 +785,146 @@
 .Test;%0A%0A
+import javax.net.ssl.SSLServerSocketFactory;%0Aimport java.util.Arrays;%0Aimport java.util.List;%0Aimport java.util.stream.Collectors;%0A%0A
 public c
@@ -1752,10 +1752,1253 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void testAllJdkCipherSuitesMapping() %7B%0A        final MechanismDatabase mechanismDatabase = MechanismDatabase.getInstance();%0A%0A        SSLServerSocketFactory ssf = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();%0A        String%5B%5D supportedCipherSuites = ssf.getSupportedCipherSuites();%0A        List%3CString%3E TLS1_3CipherSuites = Arrays.asList(%22TLS_AES_128_GCM_SHA256%22, %22TLS_AES_256_GCM_SHA384%22, %22TLS_CHACHA20_POLY1305_SHA256%22, %22TLS_AES_128_CCM_SHA256%22, %22TLS_AES_128_CCM_8_SHA256%22);%0A%0A        // New TLS 1.3 cipher suites are excluded until TLS 1.3 support is added.%0A        // TLS_EMPTY_RENEGOTIATION_INFO_SCSV is being excluded because it is not a true cipher suite, see: https://tools.ietf.org/html/rfc5746#section-3.3%0A        String unknownCipherSuites = Arrays.stream(supportedCipherSuites)%0A                .filter(cipherSuite -%3E !TLS1_3CipherSuites.contains(cipherSuite) && !cipherSuite.equals(%22TLS_EMPTY_RENEGOTIATION_INFO_SCSV%22) && mechanismDatabase.getCipherSuite(cipherSuite) == null)%0A                .collect(Collectors.joining(%22, %22));%0A%0A        Assert.assertTrue(%22There are JDK cipher suites which are unknown to Elytron MechanismDatabase: %22 + unknownCipherSuites, unknownCipherSuites.isEmpty());%0A    %7D%0A
 %7D%0A

Add test if Mechansim Database cover cipher suites from JDK