activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r944399 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/test: Makefile.am decaf/internal/net/ssl/ decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.cpp decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.h testRegistry.cpp
Date Fri, 14 May 2010 19:00:42 GMT
Author: tabish
Date: Fri May 14 19:00:42 2010
New Revision: 944399

URL: http://svn.apache.org/viewvc?rev=944399&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-140

Add a new unit test for the DefaultSSLSocketFactory

Added:
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/net/ssl/
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.cpp
  (with props)
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.h
  (with props)
Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/testRegistry.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am?rev=944399&r1=944398&r2=944399&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am Fri May 14 19:00:42 2010
@@ -69,6 +69,7 @@ cc_sources = \
     activemq/wireformat/openwire/utils/MessagePropertyInterceptorTest.cpp \
     decaf/internal/net/URIEncoderDecoderTest.cpp \
     decaf/internal/net/URIHelperTest.cpp \
+    decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.cpp \
     decaf/internal/nio/BufferFactoryTest.cpp \
     decaf/internal/nio/ByteArrayBufferTest.cpp \
     decaf/internal/nio/CharArrayBufferTest.cpp \
@@ -220,6 +221,7 @@ h_sources = \
     activemq/wireformat/openwire/utils/MessagePropertyInterceptorTest.h \
     decaf/internal/net/URIEncoderDecoderTest.h \
     decaf/internal/net/URIHelperTest.h \
+    decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.h \
     decaf/internal/nio/BufferFactoryTest.h \
     decaf/internal/nio/ByteArrayBufferTest.h \
     decaf/internal/nio/CharArrayBufferTest.h \

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.cpp?rev=944399&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.cpp
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.cpp
Fri May 14 19:00:42 2010
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+
+#include "DefaultSSLSocketFactoryTest.h"
+
+#include <decaf/internal/net/ssl/DefaultSSLSocketFactory.h>
+
+#include <decaf/io/IOException.h>
+
+using namespace std;
+using namespace decaf::lang;
+using namespace decaf::io;
+using namespace decaf::net;
+using namespace decaf::net::ssl;
+using namespace decaf::internal;
+using namespace decaf::internal::net;
+using namespace decaf::internal::net::ssl;
+
+////////////////////////////////////////////////////////////////////////////////
+DefaultSSLSocketFactoryTest::DefaultSSLSocketFactoryTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+DefaultSSLSocketFactoryTest::~DefaultSSLSocketFactoryTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DefaultSSLSocketFactoryTest::testConstructor() {
+
+    DefaultSSLSocketFactory factory( "Error Message" );
+
+    try{
+        factory.createSocket();
+        CPPUNIT_FAIL( "Should have thrown an Exception" );
+    } catch( Exception& ex ) {
+        CPPUNIT_ASSERT_EQUAL( std::string("Error Message"), ex.getMessage() );
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DefaultSSLSocketFactoryTest::testCreateSocket() {
+
+    std::auto_ptr<SocketFactory> factory( new DefaultSSLSocketFactory( "Test" ) );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an IOException",
+        factory->createSocket(),
+        IOException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an IOException",
+        factory->createSocket( "127.0.0.1", 61616 ),
+        IOException );
+
+    SSLSocketFactory* sslFactory = dynamic_cast<SSLSocketFactory*>( factory.get() );
+
+    CPPUNIT_ASSERT( sslFactory != NULL );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an IOException",
+        sslFactory->createSocket( NULL, "127.0.0.1", 61616, true ),
+        IOException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DefaultSSLSocketFactoryTest::testGetDefaultCipherSuites() {
+
+    DefaultSSLSocketFactory factory( "Error Message" );
+    CPPUNIT_ASSERT( factory.getDefaultCipherSuites().empty() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DefaultSSLSocketFactoryTest::testGetSupportedCipherSuites() {
+
+    DefaultSSLSocketFactory factory( "Error Message" );
+    CPPUNIT_ASSERT( factory.getSupportedCipherSuites().empty() );
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.h?rev=944399&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.h
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.h
Fri May 14 19:00:42 2010
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+#ifndef _DECAF_INTERNAL_NET_SSL_DEFAULTSSLSOCKETFACTORYTEST_H_
+#define _DECAF_INTERNAL_NET_SSL_DEFAULTSSLSOCKETFACTORYTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace decaf {
+namespace internal {
+namespace net {
+namespace ssl {
+
+    class DefaultSSLSocketFactoryTest : public CppUnit::TestFixture {
+
+        CPPUNIT_TEST_SUITE( DefaultSSLSocketFactoryTest );
+        CPPUNIT_TEST( testConstructor );
+        CPPUNIT_TEST( testCreateSocket );
+        CPPUNIT_TEST( testGetDefaultCipherSuites );
+        CPPUNIT_TEST( testGetSupportedCipherSuites );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        DefaultSSLSocketFactoryTest();
+        virtual ~DefaultSSLSocketFactoryTest();
+
+        void testConstructor();
+        void testCreateSocket();
+        void testGetDefaultCipherSuites();
+        void testGetSupportedCipherSuites();
+
+    };
+
+}}}}
+
+#endif /* _DECAF_INTERNAL_NET_SSL_DEFAULTSSLSOCKETFACTORYTEST_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/testRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/testRegistry.cpp?rev=944399&r1=944398&r2=944399&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/testRegistry.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/testRegistry.cpp Fri May 14 19:00:42
2010
@@ -141,6 +141,9 @@
 //#include <decaf/internal/util/TimerTaskHeapTest.h>
 //CPPUNIT_TEST_SUITE_REGISTRATION( decaf::internal::util::TimerTaskHeapTest );
 //
+#include <decaf/internal/net/ssl/DefaultSSLSocketFactoryTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::internal::net::ssl::DefaultSSLSocketFactoryTest );
+//
 //#include <decaf/internal/nio/ByteArrayBufferTest.h>
 //CPPUNIT_TEST_SUITE_REGISTRATION( decaf::internal::nio::ByteArrayBufferTest );
 //#include <decaf/internal/nio/BufferFactoryTest.h>



Mime
View raw message