You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2018/09/28 02:58:47 UTC
[incubator-servicecomb-java-chassis] 10/10: [SCB-926] modify method
signature
This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git
commit f3045987b2f37d7ccdf500a32d1562c81eb9f30c
Author: yaohaishi <ya...@huawei.com>
AuthorDate: Wed Sep 26 22:23:26 2018 +0800
[SCB-926] modify method signature
---
.../it/testcase/thirdparty/Test3rdPartyInvocation.java | 10 ++++++----
.../apache/servicecomb/serviceregistry/ServiceRegistry.java | 12 ++++++------
.../serviceregistry/registry/AbstractServiceRegistry.java | 8 ++++----
.../registry/TestAbstractServiceRegistry.java | 8 ++++----
4 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/thirdparty/Test3rdPartyInvocation.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/thirdparty/Test3rdPartyInvocation.java
index 4f4dfaa..3709106 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/thirdparty/Test3rdPartyInvocation.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/thirdparty/Test3rdPartyInvocation.java
@@ -67,15 +67,17 @@ public class Test3rdPartyInvocation {
String endpoint = "rest:" + urlPrefix.substring(beginIndex, endIndex);
RegistryUtils.getServiceRegistry()
.registerMicroserviceMappingByEndpoints(
- THIRD_PARTY_MICROSERVICE_NAME, "1.2.1", DataTypeJaxrsSchemaIntf.class,
- Collections.singletonList(endpoint));
+ THIRD_PARTY_MICROSERVICE_NAME, "1.2.1",
+ Collections.singletonList(endpoint),
+ DataTypeJaxrsSchemaIntf.class);
MicroserviceInstance instance = new MicroserviceInstance();
instance.setEndpoints(Collections.singletonList(endpoint));
RegistryUtils.getServiceRegistry()
.registerMicroserviceMapping(
- ASYNC_THIRD_PARTY_MICROSERVICE_NAME, "1.1.1", DataTypeJaxrsSchemaAsyncIntf.class,
- Collections.singletonList(instance)
+ ASYNC_THIRD_PARTY_MICROSERVICE_NAME, "1.1.1",
+ Collections.singletonList(instance),
+ DataTypeJaxrsSchemaAsyncIntf.class
);
dataTypeJaxrsSchema = Invoker.createProxy(
diff --git a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/ServiceRegistry.java b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/ServiceRegistry.java
index 2b46e74..ead2ccc 100644
--- a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/ServiceRegistry.java
+++ b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/ServiceRegistry.java
@@ -77,20 +77,20 @@ public interface ServiceRegistry {
*
* @param microserviceName name of the 3rd party service, and this param also specifies the schemaId
* @param version version of this 3rd party service
- * @param schemaIntfCls the producer interface of the service. This interface is used to generate swagger schema and
- * can also be used for the proxy interface of RPC style invocation.
* @param instances the instances of this 3rd party service. Users only need to specify the endpoint information, other
* necessary information will be generate and set in the implementation of this method.
+ * @param schemaIntfCls the producer interface of the service. This interface is used to generate swagger schema and
+ * can also be used for the proxy interface of RPC style invocation.
*/
- void registerMicroserviceMapping(String microserviceName, String version, Class<?> schemaIntfCls,
- List<MicroserviceInstance> instances);
+ void registerMicroserviceMapping(String microserviceName, String version, List<MicroserviceInstance> instances,
+ Class<?> schemaIntfCls);
/**
- * @see #registerMicroserviceMapping(String, String, Class, List)
+ * @see #registerMicroserviceMapping(String, String, List, Class)
* @param endpoints the endpoints of 3rd party service. Each of endpoints will be treated as a separated instance.
* Format of the endpoints is the same as the endpoints that ServiceComb microservices register in service-center,
* like {@code rest://127.0.0.1:8080}
*/
void registerMicroserviceMappingByEndpoints(String microserviceName, String version,
- Class<?> schemaIntfCls, List<String> endpoints);
+ List<String> endpoints, Class<?> schemaIntfCls);
}
diff --git a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/registry/AbstractServiceRegistry.java b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/registry/AbstractServiceRegistry.java
index bae8815..d266b71 100644
--- a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/registry/AbstractServiceRegistry.java
+++ b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/registry/AbstractServiceRegistry.java
@@ -309,8 +309,8 @@ public abstract class AbstractServiceRegistry implements ServiceRegistry {
}
@Override
- public void registerMicroserviceMapping(String microserviceName, String version, Class<?> schemaIntfCls,
- List<MicroserviceInstance> instances) {
+ public void registerMicroserviceMapping(String microserviceName, String version,
+ List<MicroserviceInstance> instances, Class<?> schemaIntfCls) {
String app = RegistryUtils.getAppId();
MicroserviceManager microserviceManager = appManager.getOrCreateMicroserviceManager(app);
microserviceManager.getVersionsByName()
@@ -325,7 +325,7 @@ public abstract class AbstractServiceRegistry implements ServiceRegistry {
@Override
public void registerMicroserviceMappingByEndpoints(String microserviceName, String version,
- Class<?> schemaIntfCls, List<String> endpoints) {
+ List<String> endpoints, Class<?> schemaIntfCls) {
ArrayList<MicroserviceInstance> microserviceInstances = new ArrayList<>();
for (String endpoint : endpoints) {
MicroserviceInstance instance = new MicroserviceInstance();
@@ -333,6 +333,6 @@ public abstract class AbstractServiceRegistry implements ServiceRegistry {
microserviceInstances.add(instance);
}
- registerMicroserviceMapping(microserviceName, version, schemaIntfCls, microserviceInstances);
+ registerMicroserviceMapping(microserviceName, version, microserviceInstances, schemaIntfCls);
}
}
diff --git a/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/registry/TestAbstractServiceRegistry.java b/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/registry/TestAbstractServiceRegistry.java
index 4fabb6d..e11a058 100644
--- a/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/registry/TestAbstractServiceRegistry.java
+++ b/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/registry/TestAbstractServiceRegistry.java
@@ -145,7 +145,7 @@ public class TestAbstractServiceRegistry {
ArrayList<MicroserviceInstance> instancesParam = new ArrayList<>();
instancesParam.add(new MicroserviceInstance());
- registry.registerMicroserviceMapping(testServiceName, testVersion, Test3rdPartyServiceIntf.class, instancesParam);
+ registry.registerMicroserviceMapping(testServiceName, testVersion, instancesParam, Test3rdPartyServiceIntf.class);
MicroserviceVersions microserviceVersions = versionsByName.get(testServiceName);
List<MicroserviceInstance> instances = Deencapsulation.getField(microserviceVersions, "instances");
@@ -156,7 +156,7 @@ public class TestAbstractServiceRegistry {
List<MicroserviceInstance> newInstancesParam = new ArrayList<>();
newInstancesParam.add(new MicroserviceInstance());
registry.registerMicroserviceMapping(
- testServiceName, testVersion, Test3rdPartyServiceIntf.class, newInstancesParam);
+ testServiceName, testVersion, newInstancesParam, Test3rdPartyServiceIntf.class);
microserviceVersions = versionsByName.get(testServiceName);
instances = Deencapsulation.getField(microserviceVersions, "instances");
@@ -171,8 +171,8 @@ public class TestAbstractServiceRegistry {
HashMap<String, MicroserviceVersions> versionByName = prepareForMicroserviceMappingRegistry();
- registry.registerMicroserviceMappingByEndpoints(testServiceName, testVersion, Test3rdPartyServiceIntf.class,
- Arrays.asList("cse://127.0.0.1:8080", "cse://127.0.0.1:8081"));
+ registry.registerMicroserviceMappingByEndpoints(testServiceName, testVersion,
+ Arrays.asList("cse://127.0.0.1:8080", "cse://127.0.0.1:8081"), Test3rdPartyServiceIntf.class);
MicroserviceVersions microserviceVersions = versionByName.get(testServiceName);
List<MicroserviceInstance> instances = Deencapsulation.getField(microserviceVersions, "instances");