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/03/15 13:10:33 UTC

[incubator-servicecomb-java-chassis] branch master updated (683ecdc -> ec3b710)

This is an automated email from the ASF dual-hosted git repository.

liubao pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git.


    from 683ecdc  SCB-373 bugfix: if locateOperation error, invocation will be null, if response, will cause NullPointException
     new 5577377  [SCB-396] java-sdk needs to distinguish the instance belongs to the devops stage(environment)
     new ec3b710  yaml use service_description.environment

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../foundation/common/base/ServiceCombConstants.java           |  3 +++
 foundations/foundation-config/src/main/resources/mapping.yaml  |  3 +++
 .../servicecomb/serviceregistry/api/registry/Microservice.java | 10 ++++++++++
 .../serviceregistry/api/registry/MicroserviceFactory.java      |  3 +++
 .../serviceregistry/api/registry/TestMicroService.java         |  3 +++
 5 files changed, 22 insertions(+)

-- 
To stop receiving notification emails like this one, please contact
liubao@apache.org.

[incubator-servicecomb-java-chassis] 02/02: yaml use service_description.environment

Posted by li...@apache.org.
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 ec3b710e21ab16b7dd73485cefa7a6ef29a21f76
Author: weichao666 <we...@huawei.com>
AuthorDate: Tue Mar 13 17:19:06 2018 +0800

    yaml use service_description.environment
---
 foundations/foundation-config/src/main/resources/mapping.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/foundations/foundation-config/src/main/resources/mapping.yaml b/foundations/foundation-config/src/main/resources/mapping.yaml
index baac846..0346b78 100644
--- a/foundations/foundation-config/src/main/resources/mapping.yaml
+++ b/foundations/foundation-config/src/main/resources/mapping.yaml
@@ -19,3 +19,6 @@ eureka:
   client:
     serviceUrl:
       defaultZone: registry.client.serviceUrl.defaultZone
+
+service_description:
+  environment: SERVICECOMB_ENV
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
liubao@apache.org.

[incubator-servicecomb-java-chassis] 01/02: [SCB-396] java-sdk needs to distinguish the instance belongs to the devops stage(environment)

Posted by li...@apache.org.
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 557737782c3ff8a7ea72bdd8d01845d28c4e5870
Author: weichao666 <we...@huawei.com>
AuthorDate: Tue Mar 13 14:30:48 2018 +0800

    [SCB-396] java-sdk needs to distinguish the instance belongs to the devops stage(environment)
---
 .../foundation/common/base/ServiceCombConstants.java           |  3 +++
 .../servicecomb/serviceregistry/api/registry/Microservice.java | 10 ++++++++++
 .../serviceregistry/api/registry/MicroserviceFactory.java      |  3 +++
 .../serviceregistry/api/registry/TestMicroService.java         |  3 +++
 4 files changed, 19 insertions(+)

diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/base/ServiceCombConstants.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/base/ServiceCombConstants.java
index e6613fa..22e4709 100644
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/base/ServiceCombConstants.java
+++ b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/base/ServiceCombConstants.java
@@ -61,4 +61,7 @@ public interface ServiceCombConstants {
 
   String CONFIG_DEFAULT_REGISTER_BY = "SDK";
 
+  String SERVICECOMB_ENV = "SERVICECOMB_ENV";
+
+  String DEFAULT_SERVICECOMB_ENV = "";
 }
diff --git a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/Microservice.java b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/Microservice.java
index 1694ef0..6e90072 100644
--- a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/Microservice.java
+++ b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/Microservice.java
@@ -38,6 +38,8 @@ public class Microservice {
 
   private String registerBy;
 
+  private String environment;
+
   private String appId;
 
   private String serviceName;
@@ -209,4 +211,12 @@ public class Microservice {
   public void setRegisterBy(String registerBy) {
     this.registerBy = registerBy;
   }
+
+  public String getEnvironment() {
+    return environment;
+  }
+
+  public void setEnvironment(String environment) {
+    this.environment = environment;
+  }
 }
diff --git a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/MicroserviceFactory.java b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/MicroserviceFactory.java
index 5c0c973..4e40aa1 100644
--- a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/MicroserviceFactory.java
+++ b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/MicroserviceFactory.java
@@ -24,6 +24,8 @@ import static org.apache.servicecomb.foundation.common.base.ServiceCombConstants
 import static org.apache.servicecomb.foundation.common.base.ServiceCombConstants.CONFIG_QUALIFIED_MICROSERVICE_ROLE_KEY;
 import static org.apache.servicecomb.foundation.common.base.ServiceCombConstants.CONFIG_QUALIFIED_MICROSERVICE_VERSION_KEY;
 import static org.apache.servicecomb.foundation.common.base.ServiceCombConstants.DEFAULT_MICROSERVICE_NAME;
+import static org.apache.servicecomb.foundation.common.base.ServiceCombConstants.SERVICECOMB_ENV;
+import static org.apache.servicecomb.foundation.common.base.ServiceCombConstants.DEFAULT_SERVICECOMB_ENV;
 import static org.apache.servicecomb.serviceregistry.definition.DefinitionConst.CONFIG_ALLOW_CROSS_APP_KEY;
 import static org.apache.servicecomb.serviceregistry.definition.DefinitionConst.DEFAULT_APPLICATION_ID;
 import static org.apache.servicecomb.serviceregistry.definition.DefinitionConst.DEFAULT_MICROSERVICE_VERSION;
@@ -60,6 +62,7 @@ public class MicroserviceFactory {
     microservice.setPaths(ConfigurePropertyUtils.getMicroservicePaths(configuration));
     Map<String, String> propertiesMap = MicroservicePropertiesLoader.INSTANCE.loadProperties(configuration);
     microservice.setProperties(propertiesMap);
+    microservice.setEnvironment(configuration.getString(SERVICECOMB_ENV, DEFAULT_SERVICECOMB_ENV));
 
     // set alias name when allow cross app
     if (allowCrossApp(propertiesMap)) {
diff --git a/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/api/registry/TestMicroService.java b/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/api/registry/TestMicroService.java
index 9db34da..c1ef3f5 100644
--- a/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/api/registry/TestMicroService.java
+++ b/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/api/registry/TestMicroService.java
@@ -62,6 +62,7 @@ public class TestMicroService {
     Assert.assertNull(oMicroservice.getVersion());
     Assert.assertEquals(0, oMicroservice.getPaths().size());
     Assert.assertNull(oMicroservice.getFramework());
+    Assert.assertNull(oMicroservice.getEnvironment());
   }
 
   @Test
@@ -80,6 +81,7 @@ public class TestMicroService {
     Assert.assertEquals("JAVA-CHASSIS", oMicroservice.getFramework().getName());
     Assert.assertEquals("x.x.x", oMicroservice.getFramework().getVersion());
     Assert.assertEquals("SDK", oMicroservice.getRegisterBy());
+    Assert.assertEquals("development", oMicroservice.getEnvironment());
   }
 
   private void initMicroservice() {
@@ -100,5 +102,6 @@ public class TestMicroService {
     framework.setVersion("x.x.x");
     oMicroservice.setFramework(framework);
     oMicroservice.setRegisterBy("SDK");
+    oMicroservice.setEnvironment("development");
   }
 }

-- 
To stop receiving notification emails like this one, please contact
liubao@apache.org.