Package org.apache.camel.component.irc

Source Code of org.apache.camel.component.irc.IrcsWithSslContextParamsRouteTest

/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements.  See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.apache.camel.component.irc;

import org.apache.camel.impl.JndiRegistry;
import org.apache.camel.util.jsse.KeyStoreParameters;
import org.apache.camel.util.jsse.SSLContextParameters;
import org.apache.camel.util.jsse.TrustManagersParameters;
import org.junit.Ignore;

@Ignore
public class IrcsWithSslContextParamsRouteTest extends IrcRouteTest {

    // TODO This test is disabled until we can find a public SSL enabled IRC
    // server to test against. To use this test, follow the following procedures:
    // 1) Download and install UnrealIRCd 3.2.9 from http://www.unrealircd.com/
    // 2) Copy the contents of the src/test/unrealircd folder into the installation
    //    folder of UnrealIRCd.
    // 3) Start UnrealIRCd and execute this test.  Often the test executes quicker than
    //    the IRC server responds and the assertion will fail.  In order to get the test to
    //    pass reliably, you may need to set a break point in IrcEndpoint#joinChanel in order
    //    to slow the route creation down enough for the event listener to be in place
    //    when camel-con joins the room.
   
    @Override
    protected JndiRegistry createRegistry() throws Exception {
        KeyStoreParameters ksp = new KeyStoreParameters();
        ksp.setResource("localhost.ks");
        ksp.setPassword("changeit");
       
        TrustManagersParameters tmp = new TrustManagersParameters();
        tmp.setKeyStore(ksp);
       
        SSLContextParameters sslContextParameters = new SSLContextParameters();
        sslContextParameters.setTrustManagers(tmp);
       
       
        JndiRegistry registry = super.createRegistry();
        registry.bind("sslContextParameters", sslContextParameters);

        return registry;
    }

    @Override
    protected String sendUri() {
        return "ircs://camel-prd-user@localhost:6669/#camel-test?nickname=camel-prd&password=password&sslContextParameters=#sslContextParameters";
    }

    @Override   
    protected String fromUri() {
        return "ircs://camel-con-user@localhost:6669/#camel-test?nickname=camel-con&password=password&sslContextParameters=#sslContextParameters";
    }   

}
TOP

Related Classes of org.apache.camel.component.irc.IrcsWithSslContextParamsRouteTest

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.