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/02/08 08:27:05 UTC

[incubator-servicecomb-java-chassis] branch master updated (bbe18e4 -> 7b99da6)

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 bbe18e4  SCB-320 remove custom metrics service and we will provider new mechanism later
     new d2654a4  [SCB-325] report sdk version when register to SC
     new 2f571d4  add "ServiceComb:" in front of version
     new 7b99da6  use SPI to read version,so can read version from cse or spring cloud too.

The 3 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:
 .../demo/springmvc/client/SpringmvcClient.java     |  3 --
 .../common/base/ServiceCombConstants.java          |  2 -
 pom.xml                                            | 12 +++++
 .../api/{PropertyExtended.java => Versions.java}   |  5 +-
 .../api/registry/FrameworkVersions.java}           | 61 ++++++++--------------
 .../api/registry/MicroserviceFactory.java          |  3 +-
 ...ealthCheckMode.java => ServiceCombVersion.java} | 25 ++++-----
 ...apache.servicecomb.serviceregistry.api.Versions |  2 +-
 .../api/registry/TestFrameworkVersions.java        |  8 +--
 .../api/registry/TestServiceCombVersion.java       |  9 ++--
 10 files changed, 56 insertions(+), 74 deletions(-)
 copy service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/{PropertyExtended.java => Versions.java} (91%)
 copy service-registry/src/{test/java/org/apache/servicecomb/serviceregistry/api/registry/TestBasePath.java => main/java/org/apache/servicecomb/serviceregistry/api/registry/FrameworkVersions.java} (51%)
 copy service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/{HealthCheckMode.java => ServiceCombVersion.java} (70%)
 copy demo/demo-edge/edge-service/src/main/resources/META-INF/services/org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher => service-registry/src/main/resources/META-INF/services/org.apache.servicecomb.serviceregistry.api.Versions (91%)
 copy providers/provider-springmvc/src/test/java/org/apache/servicecomb/provider/springmvc/reference/TestCseRestTemplate.java => service-registry/src/test/java/org/apache/servicecomb/serviceregistry/api/registry/TestFrameworkVersions.java (80%)
 copy providers/provider-springmvc/src/test/java/org/apache/servicecomb/provider/springmvc/reference/TestCseRestTemplate.java => service-registry/src/test/java/org/apache/servicecomb/serviceregistry/api/registry/TestServiceCombVersion.java (75%)

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

[incubator-servicecomb-java-chassis] 01/03: [SCB-325] report sdk version when register to SC

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 d2654a42c577d0e18ada1c476f373c43b4254938
Author: laijianbin <la...@huawei.com>
AuthorDate: Fri Feb 2 09:48:10 2018 +0800

    [SCB-325] report sdk version when register to SC
---
 .../servicecomb/demo/springmvc/client/SpringmvcClient.java   |  3 ---
 .../foundation/common/base/ServiceCombConstants.java         |  2 --
 pom.xml                                                      | 12 ++++++++++++
 .../serviceregistry/api/registry/MicroserviceFactory.java    |  3 +--
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/SpringmvcClient.java b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/SpringmvcClient.java
index 71f885f..f2fc0d7 100644
--- a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/SpringmvcClient.java
+++ b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/SpringmvcClient.java
@@ -19,15 +19,12 @@ package org.apache.servicecomb.demo.springmvc.client;
 
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Map.Entry;
-
 import org.apache.servicecomb.core.CseContext;
 import org.apache.servicecomb.demo.DemoConst;
 import org.apache.servicecomb.demo.TestMgr;
 import org.apache.servicecomb.demo.controller.Controller;
 import org.apache.servicecomb.demo.controller.Person;
 import org.apache.servicecomb.foundation.common.utils.BeanUtils;
-import org.apache.servicecomb.foundation.common.utils.JsonUtils;
 import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
 import org.apache.servicecomb.metrics.common.MetricsDimension;
 import org.apache.servicecomb.metrics.common.MetricsPublisher;
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 547c172..e6613fa 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
@@ -59,8 +59,6 @@ public interface ServiceCombConstants {
 
   String CONFIG_FRAMEWORK_DEFAULT_NAME = "servicecomb-java-chassis";
 
-  String CONFIG_FRAMEWORK_DEFAULT_VERSION = "";
-
   String CONFIG_DEFAULT_REGISTER_BY = "SDK";
 
 }
diff --git a/pom.xml b/pom.xml
index 51412e5..51090e5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -266,6 +266,18 @@
             </jacocoReports>
           </configuration>
         </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-jar-plugin</artifactId>
+          <configuration>
+            <archive>
+              <manifest>
+                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+              </manifest>
+            </archive>
+          </configuration>
+        </plugin>
       </plugins>
     </pluginManagement>
   </build>
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 fad8bf9..fc33e6f 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
@@ -19,7 +19,6 @@ package org.apache.servicecomb.serviceregistry.api.registry;
 import static org.apache.servicecomb.foundation.common.base.ServiceCombConstants.CONFIG_APPLICATION_ID_KEY;
 import static org.apache.servicecomb.foundation.common.base.ServiceCombConstants.CONFIG_DEFAULT_REGISTER_BY;
 import static org.apache.servicecomb.foundation.common.base.ServiceCombConstants.CONFIG_FRAMEWORK_DEFAULT_NAME;
-import static org.apache.servicecomb.foundation.common.base.ServiceCombConstants.CONFIG_FRAMEWORK_DEFAULT_VERSION;
 import static org.apache.servicecomb.foundation.common.base.ServiceCombConstants.CONFIG_QUALIFIED_MICROSERVICE_DESCRIPTION_KEY;
 import static org.apache.servicecomb.foundation.common.base.ServiceCombConstants.CONFIG_QUALIFIED_MICROSERVICE_NAME_KEY;
 import static org.apache.servicecomb.foundation.common.base.ServiceCombConstants.CONFIG_QUALIFIED_MICROSERVICE_ROLE_KEY;
@@ -71,7 +70,7 @@ public class MicroserviceFactory {
     // use default values, we can add configure item in future.
     Framework framework = new Framework();
     framework.setName(CONFIG_FRAMEWORK_DEFAULT_NAME);
-    framework.setVersion(CONFIG_FRAMEWORK_DEFAULT_VERSION);
+    framework.setVersion(MicroserviceFactory.class.getPackage().getImplementationVersion());
     microservice.setFramework(framework);
     microservice.setRegisterBy(CONFIG_DEFAULT_REGISTER_BY);
 

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

[incubator-servicecomb-java-chassis] 02/03: add "ServiceComb:" in front of version

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 2f571d49cda668f4f76aa4afac06f01e6097e62e
Author: laijianbin <la...@huawei.com>
AuthorDate: Sat Feb 3 17:51:05 2018 +0800

    add "ServiceComb:" in front of version
---
 .../servicecomb/serviceregistry/api/registry/MicroserviceFactory.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 fc33e6f..82a8f09 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
@@ -70,7 +70,7 @@ public class MicroserviceFactory {
     // use default values, we can add configure item in future.
     Framework framework = new Framework();
     framework.setName(CONFIG_FRAMEWORK_DEFAULT_NAME);
-    framework.setVersion(MicroserviceFactory.class.getPackage().getImplementationVersion());
+    framework.setVersion("ServiceComb:" + MicroserviceFactory.class.getPackage().getImplementationVersion());
     microservice.setFramework(framework);
     microservice.setRegisterBy(CONFIG_DEFAULT_REGISTER_BY);
 

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

[incubator-servicecomb-java-chassis] 03/03: use SPI to read version, so can read version from cse or spring cloud too.

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 7b99da6f3cf6fd08d42866ac149371488cc1d3d2
Author: laijianbin <la...@huawei.com>
AuthorDate: Wed Feb 7 22:11:31 2018 +0800

    use SPI to read version,so can read version from cse or spring cloud too.
---
 pom.xml                                            | 24 ++++++------
 .../servicecomb/serviceregistry/api/Versions.java  | 23 ++++++++++++
 .../api/registry/FrameworkVersions.java            | 43 ++++++++++++++++++++++
 .../api/registry/MicroserviceFactory.java          |  2 +-
 .../api/registry/ServiceCombVersion.java           | 33 +++++++++++++++++
 ...apache.servicecomb.serviceregistry.api.Versions | 18 +++++++++
 .../api/registry/TestFrameworkVersions.java        | 29 +++++++++++++++
 .../api/registry/TestServiceCombVersion.java       | 30 +++++++++++++++
 8 files changed, 189 insertions(+), 13 deletions(-)

diff --git a/pom.xml b/pom.xml
index 51090e5..f0e1171 100644
--- a/pom.xml
+++ b/pom.xml
@@ -253,6 +253,18 @@
           <excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifest>
+              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+              <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+            </manifest>
+          </archive>
+        </configuration>
+      </plugin>
     </plugins>
     <pluginManagement>
       <plugins>
@@ -266,18 +278,6 @@
             </jacocoReports>
           </configuration>
         </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-jar-plugin</artifactId>
-          <configuration>
-            <archive>
-              <manifest>
-                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
-                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
-              </manifest>
-            </archive>
-          </configuration>
-        </plugin>
       </plugins>
     </pluginManagement>
   </build>
diff --git a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/Versions.java b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/Versions.java
new file mode 100644
index 0000000..5e4adfb
--- /dev/null
+++ b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/Versions.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.servicecomb.serviceregistry.api;
+
+import java.util.Map;
+
+public interface Versions {
+  public Map<String, String> loadVersion();
+}
diff --git a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/FrameworkVersions.java b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/FrameworkVersions.java
new file mode 100644
index 0000000..5c87855
--- /dev/null
+++ b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/FrameworkVersions.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.servicecomb.serviceregistry.api.registry;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.ServiceLoader;
+
+import org.apache.servicecomb.serviceregistry.api.Versions;
+
+public class FrameworkVersions {
+  private static final ServiceLoader<Versions> frameworkVersions = ServiceLoader.load(Versions.class);
+
+  public static String allVersions() {
+    Map<String, String> versions = new HashMap<>();
+    Entry<String, String> entry;
+    StringBuffer sb = new StringBuffer();
+
+    frameworkVersions.forEach(version -> versions.putAll(version.loadVersion()));
+    for (Iterator<Entry<String, String>> iterator = versions.entrySet().iterator(); iterator.hasNext();) {
+      entry = (Entry<String, String>) iterator.next();
+      sb.append(entry.getKey()).append(":").append(entry.getValue())
+        .append(iterator.hasNext() ? ";" : "");
+    }
+    return sb.toString();
+  }
+}
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 82a8f09..5c0c973 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
@@ -70,7 +70,7 @@ public class MicroserviceFactory {
     // use default values, we can add configure item in future.
     Framework framework = new Framework();
     framework.setName(CONFIG_FRAMEWORK_DEFAULT_NAME);
-    framework.setVersion("ServiceComb:" + MicroserviceFactory.class.getPackage().getImplementationVersion());
+    framework.setVersion(FrameworkVersions.allVersions());
     microservice.setFramework(framework);
     microservice.setRegisterBy(CONFIG_DEFAULT_REGISTER_BY);
 
diff --git a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/ServiceCombVersion.java b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/ServiceCombVersion.java
new file mode 100644
index 0000000..1e6aa43
--- /dev/null
+++ b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/ServiceCombVersion.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.servicecomb.serviceregistry.api.registry;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.servicecomb.serviceregistry.api.Versions;
+
+public class ServiceCombVersion implements Versions {
+
+  @Override
+  public Map<String, String> loadVersion() {
+    Map<String, String> map = new HashMap<>();
+    map.put("ServiceComb", this.getClass().getPackage().getImplementationVersion());
+
+    return map;
+  }
+}
diff --git a/service-registry/src/main/resources/META-INF/services/org.apache.servicecomb.serviceregistry.api.Versions b/service-registry/src/main/resources/META-INF/services/org.apache.servicecomb.serviceregistry.api.Versions
new file mode 100644
index 0000000..006f229
--- /dev/null
+++ b/service-registry/src/main/resources/META-INF/services/org.apache.servicecomb.serviceregistry.api.Versions
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+org.apache.servicecomb.serviceregistry.api.registry.ServiceCombVersion
diff --git a/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/api/registry/TestFrameworkVersions.java b/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/api/registry/TestFrameworkVersions.java
new file mode 100644
index 0000000..d02bd55
--- /dev/null
+++ b/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/api/registry/TestFrameworkVersions.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.servicecomb.serviceregistry.api.registry;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestFrameworkVersions {
+
+  @Test
+  public void testFrameworkVersions() {
+    Assert.assertEquals("ServiceComb:null", FrameworkVersions.allVersions());
+  }
+}
diff --git a/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/api/registry/TestServiceCombVersion.java b/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/api/registry/TestServiceCombVersion.java
new file mode 100644
index 0000000..62e722c
--- /dev/null
+++ b/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/api/registry/TestServiceCombVersion.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.servicecomb.serviceregistry.api.registry;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestServiceCombVersion {
+
+  @Test
+  public void testServiceCombVersion() {
+    ServiceCombVersion version = new ServiceCombVersion();
+    Assert.assertEquals("{ServiceComb=null}", version.loadVersion().toString());
+  }
+}

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