forked from apache/dubbo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
9 changed files
with
288 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/version/VersionConsumer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
...dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/version/VersionProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
...ubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/version/VersionProvider2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
...bo-test-examples/src/main/java/com/alibaba/dubbo/examples/version/api/VersionService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
...st-examples/src/main/java/com/alibaba/dubbo/examples/version/impl/VersionServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
...t-examples/src/main/java/com/alibaba/dubbo/examples/version/impl/VersionServiceImpl2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
...dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/version/version-consumer.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
33 changes: 33 additions & 0 deletions
33
...dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/version/version-provider.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
33 changes: 33 additions & 0 deletions
33
...ubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/version/version-provider2.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |