DUBBO-244 添加单元测试,测试使用 spring p namespace 配置自定义属性
git-svn-id: http://code.alibabatech.com/svn/dubbo/trunk@1223 1a56cb94-b969-4eaa-88fa-be21384802f2
This commit is contained in:
parent
3d6f585071
commit
07ae8667dc
|
|
@ -27,6 +27,7 @@ import java.util.List;
|
|||
|
||||
import com.alibaba.dubbo.common.Constants;
|
||||
import com.alibaba.dubbo.common.utils.ConfigUtils;
|
||||
import com.alibaba.dubbo.config.spring.ServiceBean;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
|
@ -652,6 +653,17 @@ public class ConfigTest {
|
|||
assertEquals(port, Integer.parseInt(ConfigUtils.getProperty("dubbo.protocol.port")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomizeParameter() throws Exception {
|
||||
ClassPathXmlApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("customize-parameter.xml");
|
||||
context.start();
|
||||
ServiceBean serviceBean = (ServiceBean) context.getBean("demoServiceExport");
|
||||
URL url = (URL) serviceBean.toUrls().get(0);
|
||||
assertEquals("protocol-paramA", url.getParameter("protocol-paramA"));
|
||||
assertEquals("service-paramA", url.getParameter("service-paramA"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPath() throws Exception {
|
||||
ServiceConfig<DemoService> service = new ServiceConfig<DemoService>();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
<!--
|
||||
- Copyright 1999-2012 Alibaba Group.
|
||||
-
|
||||
- Licensed 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.
|
||||
-->
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
|
||||
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd" default-autowire="byName">
|
||||
|
||||
<dubbo:application name="customize-parameter" />
|
||||
|
||||
<dubbo:registry address="N/A" id="naRegistry" />
|
||||
|
||||
<dubbo:protocol p:protocol-paramA="protocol-paramA" />
|
||||
|
||||
<bean id="demoService" class="com.alibaba.dubbo.config.provider.impl.DemoServiceImpl" />
|
||||
|
||||
<dubbo:service id="demoServiceExport" p:service-paramA="service-paramA" registry="naRegistry" ref="demoService" interface="com.alibaba.dubbo.config.api.DemoService" />
|
||||
|
||||
</beans>
|
||||
Loading…
Reference in New Issue