Author: ningjiang
Date: Thu Sep 29 07:42:32 2011
New Revision: 1177193
URL: http://svn.apache.org/viewvc?rev=1177193&view=rev
Log:
Added an unit test to show how to use the bean name with the place holder
Added:
cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/bean.properties
(with props)
Modified:
cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/ConfigurerImplTest.java
cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/test-beans.xml
Modified:
cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/ConfigurerImplTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/ConfigurerImplTest.java?rev=1177193&r1=1177192&r2=1177193&view=diff
==============================================================================
---
cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/ConfigurerImplTest.java
(original)
+++
cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/ConfigurerImplTest.java
Thu Sep 29 07:42:32 2011
@@ -117,7 +117,16 @@ public class ConfigurerImplTest extends
@Test
public void testConfigureSimple() {
- SimpleBean sb = new SimpleBean("simple");
+ // Try to configure the bean with id
+ verifyConfigureSimple("simple");
+ // Try to configure the bean with an alias name
+ verifyConfigureSimple("simpleValueBean");
+ }
+
+
+ public void verifyConfigureSimple(String beanName) {
+
+ SimpleBean sb = new SimpleBean(beanName);
BusApplicationContext ac =
new
BusApplicationContext("/org/apache/cxf/configuration/spring/test-beans.xml",
false);
@@ -146,30 +155,6 @@ public class ConfigurerImplTest extends
new Double(17D), sb.getDoubleAttr());
assertEquals("Unexpected value for attribute byteAttr",
new Byte((byte)18), sb.getByteAttr());
-
- /*
- QName qn = sb.getQnameAttr();
- assertEquals("Unexpected value for attribute qnameAttrNoDefault",
- "string", qn.getLocalPart());
- assertEquals("Unexpected value for attribute qnameAttrNoDefault",
- "http://www.w3.org/2001/XMLSchema", qn.getNamespaceURI());
- */
-
- /*
- byte[] expected = DatatypeConverter.parseBase64Binary("wxyz");
- byte[] val = sb.getBase64BinaryAttr();
- assertEquals("Unexpected value for attribute
base64BinaryAttrNoDefault", expected.length, val.length);
- for (int i = 0; i < expected.length; i++) {
- assertEquals("Unexpected value for attribute
base64BinaryAttrNoDefault", expected[i], val[i]);
- }
-
- expected = new HexBinaryAdapter().unmarshal("bbbb");
- val = sb.getHexBinaryAttr();
- assertEquals("Unexpected value for attribute hexBinaryAttrNoDefault",
expected.length, val.length);
- for (int i = 0; i < expected.length; i++) {
- assertEquals("Unexpected value for attribute
hexBinaryAttrNoDefault", expected[i], val[i]);
- }
- */
assertEquals("Unexpected value for attribute
unsignedIntAttrNoDefault",
new Long(19L), sb.getUnsignedIntAttr());
Added:
cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/bean.properties
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/bean.properties?rev=1177193&view=auto
==============================================================================
---
cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/bean.properties
(added)
+++
cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/bean.properties
Thu Sep 29 07:42:32 2011
@@ -0,0 +1,17 @@
+# 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.
+simple.name=simpleValueBean
Propchange:
cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/bean.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/bean.properties
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/bean.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified:
cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/test-beans.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/test-beans.xml?rev=1177193&r1=1177192&r2=1177193&view=diff
==============================================================================
---
cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/test-beans.xml
(original)
+++
cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/test-beans.xml
Thu Sep 29 07:42:32 2011
@@ -22,6 +22,11 @@
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
+ <bean id="placeholderConfig"
+
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="location"
value="org/apache/cxf/configuration/spring/bean.properties"/>
+ </bean>
+
<bean name="*2" abstract="true"
class="org.apache.cxf.configuration.spring.ConfigurerImplTest$SimpleBean">
<property name="stringAttr" value="StarHallo"/>
</bean>
@@ -42,7 +47,7 @@ http://www.springframework.org/schema/be
<property name="integerAttr" value="10"/>
</bean>
- <bean id="simple" lazy-init="true">
+ <bean id="simple" name="${simple.name}" lazy-init="true">
<property name="stringAttr" value="hallo"/>
<property name="booleanAttr" value="false"/>
<property name="integerAttr" value="10"/>