camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r722079 - in /activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test: ./ Cheese.java JavaConfigWithPostProcessorTest.java MyConfig.java MyPostProcessor.java
Date Mon, 01 Dec 2008 14:23:25 GMT
Author: jstrachan
Date: Mon Dec  1 06:23:24 2008
New Revision: 722079

URL: http://svn.apache.org/viewvc?rev=722079&view=rev
Log:
added test case showing JavaConfig not working correctly with SpringTest and BeanPostProcessors

Added:
    activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/
    activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/Cheese.java
  (with props)
    activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/JavaConfigWithPostProcessorTest.java
  (with props)
    activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyConfig.java
  (with props)
    activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyPostProcessor.java
  (with props)

Added: activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/Cheese.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/Cheese.java?rev=722079&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/Cheese.java
(added)
+++ activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/Cheese.java
Mon Dec  1 06:23:24 2008
@@ -0,0 +1,25 @@
+/**
+ *
+ * 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.spring.javaconfig.test;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public interface Cheese {
+    void doCheese();
+}

Propchange: activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/Cheese.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/JavaConfigWithPostProcessorTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/JavaConfigWithPostProcessorTest.java?rev=722079&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/JavaConfigWithPostProcessorTest.java
(added)
+++ activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/JavaConfigWithPostProcessorTest.java
Mon Dec  1 06:23:24 2008
@@ -0,0 +1,42 @@
+/**
+ *
+ * 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.spring.javaconfig.test;
+
+import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.config.java.test.JavaConfigContextLoader;
+import org.springframework.config.java.plugin.context.AnnotationDrivenConfig;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+@ContextConfiguration(locations = "org.apache.camel.spring.javaconfig.test.MyConfig", loader
= JavaConfigContextLoader.class)
+@AnnotationDrivenConfig
+public class JavaConfigWithPostProcessorTest extends AbstractJUnit38SpringContextTests implements
Cheese {
+    private boolean doCheeseCalled;
+
+    public void testPostProcessorInjectsMe() throws Exception {
+        assertEquals("doCheese() should be called", true, doCheeseCalled);
+
+    }
+
+    public void doCheese() {
+        System.out.println("doCheese called!");
+        doCheeseCalled = true;
+    }
+}

Propchange: activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/JavaConfigWithPostProcessorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyConfig.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyConfig.java?rev=722079&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyConfig.java
(added)
+++ activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyConfig.java
Mon Dec  1 06:23:24 2008
@@ -0,0 +1,32 @@
+/**
+ *
+ * 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.spring.javaconfig.test;
+
+import org.springframework.config.java.annotation.Configuration;
+import org.springframework.config.java.annotation.Bean;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+@Configuration
+public class MyConfig {
+    @Bean
+    public MyPostProcessor myPostProcessor() {
+        return new MyPostProcessor();
+    }
+}

Propchange: activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyPostProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyPostProcessor.java?rev=722079&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyPostProcessor.java
(added)
+++ activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyPostProcessor.java
Mon Dec  1 06:23:24 2008
@@ -0,0 +1,49 @@
+/**
+ *
+ * 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.spring.javaconfig.test;
+
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.beans.BeansException;
+
+/**
+ * A simple post processor
+ *
+ * @version $Revision: 1.1 $
+ */
+public class MyPostProcessor implements BeanPostProcessor {
+    
+    public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException
{
+        System.out.println("Invoked before Initialization on " + bean + " name " + name);
+        if (bean instanceof Cheese) {
+            Cheese cheese = (Cheese) bean;
+            System.out.println("Before Initialization Invoking Cheese");
+            cheese.doCheese();
+        }
+        return bean;
+    }
+
+    public Object postProcessAfterInitialization(Object bean, String name) throws BeansException
{
+        System.out.println("Invoked after Initialization on " + bean + " name " + name);
+        if (bean instanceof Cheese) {
+            Cheese cheese = (Cheese) bean;
+            System.out.println("After Initialization Invoking Cheese");
+            cheese.doCheese();
+        }
+        return bean;
+    }
+}

Propchange: activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyPostProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message