activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1033936 - in /activemq/activemq-apollo/trunk: apollo-stomp/src/test/resources/ apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/ apollo-util/src/test/scala/org/apache/activemq/apollo/util/
Date Thu, 11 Nov 2010 13:31:19 GMT
Author: chirino
Date: Thu Nov 11 13:31:19 2010
New Revision: 1033936

URL: http://svn.apache.org/viewvc?rev=1033936&view=rev
Log:
Added a test case that uses stomp over ssl.

Added:
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl.xml
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo.ks   (with props)
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/client.ks   (with props)
Modified:
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompClient.scala
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompTest.scala
    activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/FunSuiteSupport.scala

Added: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl.xml?rev=1033936&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl.xml (added)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl.xml Thu
Nov 11 13:31:19 2010
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+    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.
+-->
+<broker basedir="./activemq-data/default" rev="1" enabled="true" id="default" xmlns="http://activemq.apache.org/schema/activemq/apollo">
+
+    <notes>The config for the ssl stomp tests.</notes>
+    <virtual-host purge-on-startup="false" auto-create-queues="true" enabled="true" id="default">
+        <host-name>localhost</host-name>
+    </virtual-host>
+
+    <key-storage file="${basedir}/src/test/resources/apollo.ks" password="password" key-password="password"/>
+    <connectors protocol="stomp" bind="ssl://0.0.0.0:0" enabled="true" id="default"/>
+
+</broker>
\ No newline at end of file

Added: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo.ks
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo.ks?rev=1033936&view=auto
==============================================================================
Files activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo.ks (added) and
activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo.ks Thu Nov 11 13:31:19
2010 differ

Propchange: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo.ks
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/client.ks
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/client.ks?rev=1033936&view=auto
==============================================================================
Files activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/client.ks (added) and
activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/client.ks Thu Nov 11 13:31:19
2010 differ

Propchange: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/client.ks
------------------------------------------------------------------------------
    svn:executable = *

Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompClient.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompClient.scala?rev=1033936&r1=1033935&r2=1033936&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompClient.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompClient.scala
Thu Nov 11 13:31:19 2010
@@ -18,10 +18,11 @@
 package org.apache.activemq.apollo.stomp
 
 import java.net.{Socket, InetSocketAddress}
-import org.apache.activemq.apollo.broker.ProtocolException
 import org.fusesource.hawtbuf.AsciiBuffer
 import _root_.org.fusesource.hawtbuf.{ByteArrayOutputStream => BAOS}
 import java.io._
+import org.apache.activemq.apollo.broker.{KeyStorage, ProtocolException}
+import javax.net.ssl.{SSLSocket, SSLContext}
 
 /**
  * A simple Stomp client used for testing purposes
@@ -32,9 +33,19 @@ import java.io._
     var out:OutputStream = null
     var in:InputStream = null
     val bufferSize = 64*1204
+    var key_storeage:KeyStorage=null
 
     def open(host: String, port: Int) = {
-      socket = new Socket
+
+      socket = if( key_storeage!=null ) {
+        val context = SSLContext.getInstance("TLS")
+        context.init(null, key_storeage.create_trust_managers, null)
+        context.getSocketFactory().createSocket()
+        // socket.asInstanceOf[SSLSocket].setEnabledCipherSuites(Array("SSL_RSA_WITH_RC4_128_MD5"))
+        // socket
+      } else {
+        new Socket
+      }
       socket.connect(new InetSocketAddress(host, port))
       socket.setSoLinger(true, 0)
       out = new BufferedOutputStream(socket.getOutputStream, bufferSize)

Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompTest.scala?rev=1033936&r1=1033935&r2=1033936&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompTest.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompTest.scala
Thu Nov 11 13:31:19 2010
@@ -17,18 +17,21 @@
 package org.apache.activemq.apollo.stomp
 
 import org.scalatest.matchers.ShouldMatchers
-import org.apache.activemq.apollo.broker.{Broker, BrokerFactory}
 import org.scalatest.BeforeAndAfterEach
-import org.apache.activemq.apollo.util.{Logging, FunSuiteSupport, ServiceControl}
+import java.lang.String
+import org.apache.activemq.apollo.broker.{KeyStorage, Broker, BrokerFactory}
+import org.apache.activemq.apollo.util.{FileSupport, Logging, FunSuiteSupport, ServiceControl}
+import FileSupport._
 
 class StompTestSupport extends FunSuiteSupport with ShouldMatchers with BeforeAndAfterEach
with Logging {
   var broker: Broker = null
   var port = 0
-  
+
+  val broker_config_uri = "xml:classpath:activemq-stomp.xml"
+
   override protected def beforeAll() = {
-    val uri = "xml:classpath:activemq-stomp.xml"
-    info("Loading broker configuration from the classpath with URI: " + uri)
-    broker = BrokerFactory.createBroker(uri)
+    info("Loading broker configuration from the classpath with URI: " + broker_config_uri)
+    broker = BrokerFactory.createBroker(broker_config_uri)
     ServiceControl.start(broker, "Starting broker")
     port = broker.connectors.head.transportServer.getSocketAddress.getPort
   }
@@ -402,6 +405,15 @@ class StompDestinationTest extends Stomp
   }
 }
 
+class StompSslDestinationTest extends StompDestinationTest {
+  override val broker_config_uri: String = "xml:classpath:apollo-stomp-ssl.xml"
+
+  client.key_storeage = new KeyStorage
+  client.key_storeage.config.file = baseDir/"src"/"test"/"resources"/"client.ks"
+  client.key_storeage.config.password = "password"
+
+}
+
 class StompReceiptTest extends StompTestSupport {
 
   test("Receipts on SEND to unconsummed topic") {

Modified: activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/FunSuiteSupport.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/FunSuiteSupport.scala?rev=1033936&r1=1033935&r2=1033936&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/FunSuiteSupport.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/FunSuiteSupport.scala
Thu Nov 11 13:31:19 2010
@@ -51,6 +51,7 @@ abstract class FunSuiteSupport extends F
       case Some(basedir) => basedir.toString
       case _ => System.getProperty("basedir", ".")
     }
+    System.setProperty("basedir", _basedir)
     debug("using basedir: " + _basedir)
     super.beforeAll(map)
   }



Mime
View raw message