001/** 002 * Logback: the reliable, generic, fast and flexible logging framework. 003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved. 004 * 005 * This program and the accompanying materials are dual-licensed under 006 * either the terms of the Eclipse Public License v1.0 as published by 007 * the Eclipse Foundation 008 * 009 * or (per the licensee's choosing) 010 * 011 * under the terms of the GNU Lesser General Public License version 2.1 012 * as published by the Free Software Foundation. 013 */ 014package ch.qos.logback.core.net; 015 016import static org.junit.Assert.assertNotNull; 017 018import org.junit.Before; 019import org.junit.Test; 020 021import ch.qos.logback.core.net.mock.MockContext; 022import ch.qos.logback.core.spi.PreSerializationTransformer; 023 024/** 025 * Unit tests for {@link AbstractSSLSocketAppender}. 026 * 027 * @author Carl Harris 028 */ 029public class AbstractSSLSocketAppenderTest { 030 031 private MockContext context = new MockContext(); 032 033 private InstrumentedSSLSocketAppenderBase appender = new InstrumentedSSLSocketAppenderBase(); 034 035 @Before 036 public void setUp() throws Exception { 037 appender.setContext(context); 038 } 039 040 @Test 041 public void testUsingDefaultConfig() throws Exception { 042 // should be able to start and stop successfully with no SSL 043 // configuration at all 044 appender.start(); 045 assertNotNull(appender.getSocketFactory()); 046 appender.stop(); 047 } 048 049 private static class InstrumentedSSLSocketAppenderBase extends AbstractSSLSocketAppender<Object> { 050 051 @Override 052 protected void postProcessEvent(Object event) { 053 throw new UnsupportedOperationException(); 054 } 055 056 @Override 057 protected PreSerializationTransformer<Object> getPST() { 058 throw new UnsupportedOperationException(); 059 } 060 061 } 062}