cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r981804 - in /cxf/trunk/rt/transports/jms/src: main/java/org/apache/cxf/transport/jms/JMSConfiguration.java test/java/org/apache/cxf/transport/jms/JMSConfigurationTest.java
Date Tue, 03 Aug 2010 10:08:04 GMT
Author: sergeyb
Date: Tue Aug  3 10:08:04 2010
New Revision: 981804

URL: http://svn.apache.org/viewvc?rev=981804&view=rev
Log:
[CXF-2925] Updating JMSConfiguration for it not to implement InitializingBean

Added:
    cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConfigurationTest.java
  (with props)
Modified:
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java?rev=981804&r1=981803&r2=981804&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
Tue Aug  3 10:08:04 2010
@@ -24,7 +24,6 @@ import javax.jms.XAConnectionFactory;
 
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.configuration.ConfigurationException;
-import org.springframework.beans.factory.InitializingBean;
 import org.springframework.beans.factory.annotation.Required;
 import org.springframework.core.task.TaskExecutor;
 import org.springframework.jms.connection.SingleConnectionFactory;
@@ -36,7 +35,7 @@ import org.springframework.jndi.JndiTemp
 import org.springframework.transaction.PlatformTransactionManager;
 
 @NoJSR250Annotations
-public class JMSConfiguration implements InitializingBean {
+public class JMSConfiguration {
     /**
      * The use of -1 is to make easier to determine 
      * if the setCacheLevel has been called.
@@ -251,12 +250,6 @@ public class JMSConfiguration implements
         this.durableSubscriptionName = durableSubscriptionName;
     }
 
-    public void afterPropertiesSet() throws Exception {
-        if (connectionFactory == null) {
-            throw new RuntimeException("Required property connectionfactory was not set");
-        }
-    }
-
     @Required
     public void setConnectionFactory(ConnectionFactory connectionFactory) {
         this.connectionFactory = connectionFactory;
@@ -433,6 +426,9 @@ public class JMSConfiguration implements
             if (connectionFactory == null) {
                 connectionFactory = JMSFactory.getConnectionFactoryFromJndi(this);
             }
+            if (connectionFactory == null) {
+                throw new RuntimeException("connectionFactory has not been initialized");
+            }
             if (wrapInSingleConnectionFactory && !(connectionFactory instanceof SingleConnectionFactory))
{
                 SingleConnectionFactory scf;
                 if (useJms11) {

Added: cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConfigurationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConfigurationTest.java?rev=981804&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConfigurationTest.java
(added)
+++ cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConfigurationTest.java
Tue Aug  3 10:08:04 2010
@@ -0,0 +1,38 @@
+/**
+ * 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.cxf.transport.jms;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class JMSConfigurationTest extends Assert {
+
+    @Test
+    public void testUninitializedConnectionFactory() {
+        JMSConfiguration config = new JMSConfiguration();
+        try {
+            config.getOrCreateWrappedConnectionFactory();
+            fail("Exception expected");
+        } catch (RuntimeException ex) {
+            assertEquals("connectionFactory has not been initialized",
+                         ex.getMessage());
+        }
+    }
+    
+}

Propchange: cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConfigurationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConfigurationTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message