Skip to content

Commit

Permalink
DUBBO-358 增加星号版本测试
Browse files Browse the repository at this point in the history
git-svn-id: http://code.alibabatech.com/svn/dubbo/trunk@1632 1a56cb94-b969-4eaa-88fa-be21384802f2
  • Loading branch information
william.liangf committed May 4, 2012
1 parent 01da35e commit d807425
Show file tree
Hide file tree
Showing 9 changed files with 288 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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.
*/
package com.alibaba.dubbo.examples.version;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.alibaba.dubbo.examples.version.api.VersionService;

/**
* VersionConsumer
*
* @author william.liangf
*/
public class VersionConsumer {

public static void main(String[] args) throws Exception {
String config = VersionConsumer.class.getPackage().getName().replace('.', '/') + "/version-consumer.xml";
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config);
context.start();
VersionService versionService = (VersionService) context.getBean("versionService");
for (int i = 0; i < 10000; i ++) {
String hello = versionService.sayHello("world");
System.out.println(hello);
Thread.sleep(2000);
}
System.in.read();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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.
*/
package com.alibaba.dubbo.examples.version;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
* VersionProvider
*
* @author william.liangf
*/
public class VersionProvider {

public static void main(String[] args) throws Exception {
String config = VersionProvider.class.getPackage().getName().replace('.', '/') + "/version-provider.xml";
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config);
context.start();
System.in.read();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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.
*/
package com.alibaba.dubbo.examples.version;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
* VersionProvider2
*
* @author william.liangf
*/
public class VersionProvider2 {

public static void main(String[] args) throws Exception {
String config = VersionProvider2.class.getPackage().getName().replace('.', '/') + "/version-provider2.xml";
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config);
context.start();
System.in.read();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Project: dubbo-examples
*
* File Created at 2012-2-17
* $Id$
*
* Copyright 1999-2100 Alibaba.com Corporation Limited.
* All rights reserved.
*
* This software is the confidential and proprietary information of
* Alibaba Company. ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with Alibaba.com.
*/
package com.alibaba.dubbo.examples.version.api;

/**
* @author william.liangf
*/
public interface VersionService {

String sayHello(String name);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Project: dubbo-examples
*
* File Created at 2012-2-17
* $Id$
*
* Copyright 1999-2100 Alibaba.com Corporation Limited.
* All rights reserved.
*
* This software is the confidential and proprietary information of
* Alibaba Company. ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with Alibaba.com.
*/
package com.alibaba.dubbo.examples.version.impl;

import com.alibaba.dubbo.examples.version.api.VersionService;

/**
* @author william.liangf
*/
public class VersionServiceImpl implements VersionService {

public String sayHello(String name) {
return "hello, " + name;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Project: dubbo-examples
*
* File Created at 2012-2-17
* $Id$
*
* Copyright 1999-2100 Alibaba.com Corporation Limited.
* All rights reserved.
*
* This software is the confidential and proprietary information of
* Alibaba Company. ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with Alibaba.com.
*/
package com.alibaba.dubbo.examples.version.impl;

import com.alibaba.dubbo.examples.version.api.VersionService;

/**
* @author william.liangf
*/
public class VersionServiceImpl2 implements VersionService {

public String sayHello(String name) {
return "hello2, " + name;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 1999-2011 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:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">

<dubbo:application name="version-consumer" />

<dubbo:registry address="multicast://224.5.6.7:1234" />

<dubbo:reference id="versionService" interface="com.alibaba.dubbo.examples.version.api.VersionService" version="*" />

</beans>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 1999-2011 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:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">

<dubbo:application name="version-provider" />

<dubbo:registry address="multicast://224.5.6.7:1234" />

<dubbo:protocol name="dubbo" port="20880" />

<bean id="versionService" class="com.alibaba.dubbo.examples.version.impl.VersionServiceImpl" />

<dubbo:service interface="com.alibaba.dubbo.examples.version.api.VersionService" version="1.0.0" ref="versionService" />

</beans>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 1999-2011 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:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">

<dubbo:application name="version-provider2" />

<dubbo:registry address="multicast://224.5.6.7:1234" />

<dubbo:protocol name="dubbo" port="20882" />

<bean id="versionService" class="com.alibaba.dubbo.examples.version.impl.VersionServiceImpl2" />

<dubbo:service interface="com.alibaba.dubbo.examples.version.api.VersionService" version="2.0.0" ref="versionService" />

</beans>

0 comments on commit d807425

Please sign in to comment.