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/servicecomb-java-chassis.git
The following commit(s) were added to refs/heads/master by this push:
new a5355e7 [SCB-1841]minor fixes: package name refactor and delete
unused code
a5355e7 is described below
commit a5355e71219a09e6f4a0bc68bf877fea6a4e94b9
Author: liubao <[email protected]>
AuthorDate: Tue Mar 31 18:53:30 2020 +0800
[SCB-1841]minor fixes: package name refactor and delete unused code
---
LICENSE | 2 +-
.../common/rest/definition/RestOperationMeta.java | 2 +-
distribution/src/release/LICENSE | 2 +-
.../servicecomb/edge/core/TestEdgeInvocation.java | 209 ---------------------
.../foundation/common/utils}/MimeTypesUtils.java | 2 +-
.../common/utils}/TestMimeTypesUtils.java | 2 +-
.../java/io/vertx/core/net/impl/VertxHelper.java | 29 ---
.../foundation/vertx/tcp/TcpConnection.java | 3 +-
.../ext/web/impl/TestHttpServerRequestUtils.java | 3 +-
.../it-producer-deploy-springboot2-servlet/pom.xml | 30 ---
.../pom.xml | 30 ---
pom.xml | 3 +-
.../rest/vertx/TestVertxRestDispatcher.java | 1 -
13 files changed, 9 insertions(+), 309 deletions(-)
diff --git a/LICENSE b/LICENSE
index c6dded8..521832a 100644
--- a/LICENSE
+++ b/LICENSE
@@ -210,7 +210,7 @@ following licenses.
================================================================
-For
foundations/foundation-vertx/src/main/java/io/vertx/ext/web/impl/MimeTypesUtils.java
+For
foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/MimeTypesUtils.java
transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestBodyHandler.java
================================================================
This product bundles files from vertx which is licensed under the Apache
License v2.
diff --git
a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/definition/RestOperationMeta.java
b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/definition/RestOperationMeta.java
index 55995ae..b042691 100644
---
a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/definition/RestOperationMeta.java
+++
b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/definition/RestOperationMeta.java
@@ -35,6 +35,7 @@ import
org.apache.servicecomb.common.rest.codec.produce.ProduceProcessorManager;
import org.apache.servicecomb.common.rest.definition.path.PathRegExp;
import org.apache.servicecomb.common.rest.definition.path.URLPathBuilder;
import org.apache.servicecomb.core.definition.OperationMeta;
+import org.apache.servicecomb.foundation.common.utils.MimeTypesUtils;
import org.apache.servicecomb.foundation.vertx.http.HttpServletRequestEx;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,7 +50,6 @@ import io.swagger.models.parameters.Parameter;
import io.swagger.models.properties.FileProperty;
import io.swagger.models.properties.Property;
import io.swagger.models.properties.StringProperty;
-import io.vertx.ext.web.impl.MimeTypesUtils;
public class RestOperationMeta {
private static final Logger LOGGER =
LoggerFactory.getLogger(RestOperationMeta.class);
diff --git a/distribution/src/release/LICENSE b/distribution/src/release/LICENSE
index 5a80d06..924d70d 100644
--- a/distribution/src/release/LICENSE
+++ b/distribution/src/release/LICENSE
@@ -209,7 +209,7 @@ subcomponents is subject to the terms and conditions of the
following licenses.
================================================================
-For
foundations/foundation-vertx/src/main/java/io/vertx/ext/web/impl/MimeTypesUtils.java
+For
foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/common/utils/MimeTypesUtils.java
transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestBodyHandler.java
================================================================
This product bundles files from vertx which is licensed under the Apache
License v2.
diff --git
a/edge/edge-core/src/test/java/org/apache/servicecomb/edge/core/TestEdgeInvocation.java
b/edge/edge-core/src/test/java/org/apache/servicecomb/edge/core/TestEdgeInvocation.java
deleted file mode 100644
index c8a4a63..0000000
---
a/edge/edge-core/src/test/java/org/apache/servicecomb/edge/core/TestEdgeInvocation.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * 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.edge.core;
-
-public class TestEdgeInvocation {
-// String microserviceName = "ms";
-//
-// @Mocked
-// RoutingContext routingContext;
-//
-// @Mocked
-// Context context;
-//
-// List<HttpServerFilter> httpServerFilters = Collections.emptyList();
-//
-// MicroserviceMeta microserviceMeta = new MicroserviceMeta("app:ms");
-//
-// MicroserviceVersionRule microserviceVersionRule = new
MicroserviceVersionRule(microserviceMeta.getAppId(),
-// microserviceMeta.getName(), DefinitionConst.VERSION_RULE_LATEST);
-//
-// ReferenceConfig referenceConfig = new ReferenceConfig();
-//
-// EdgeInvocation edgeInvocation = new EdgeInvocation();
-//
-// HttpServletRequestEx requestEx;
-//
-// HttpServletResponseEx responseEx;
-//
-// @Rule
-// public ExpectedException expectedException = ExpectedException.none();
-//
-// @Before
-// public void setup() {
-// new Expectations(VertxImpl.class) {
-// {
-// VertxImpl.context();
-// result = context;
-// }
-// };
-//
-// referenceConfig.setMicroserviceVersionRule(microserviceVersionRule);
-// referenceConfig.setTransport("rest");
-//
-// edgeInvocation.init(microserviceName, routingContext, "/base",
httpServerFilters);
-//
-// requestEx = Deencapsulation.getField(edgeInvocation, "requestEx");
-// responseEx = Deencapsulation.getField(edgeInvocation, "responseEx");
-// }
-//
-// @Test
-// public void edgeInvoke(@Mocked MicroserviceVersionMeta
microserviceVersionMeta) {
-// new Expectations() {
-// {
-// microserviceVersionRule.getLatestMicroserviceVersion();
-// result = microserviceVersionMeta;
-// microserviceVersionMeta.getMicroserviceMeta();
-// result = microserviceMeta;
-// }
-// };
-//
-// Map<String, Boolean> result = new LinkedHashMap<>();
-// edgeInvocation = new EdgeInvocation() {
-// @Override
-// protected void findMicroserviceVersionMeta() {
-// result.put("findMicroserviceVersionMeta", true);
-// }
-//
-// @Override
-// protected void findRestOperation(MicroserviceMeta microserviceMeta) {
-// result.put("findRestOperation", true);
-// }
-//
-// @Override
-// protected void scheduleInvocation() {
-// result.put("scheduleInvocation", true);
-// }
-// };
-// edgeInvocation.latestMicroserviceVersionMeta = microserviceVersionMeta;
-//
-// edgeInvocation.edgeInvoke();
-//
-// Assert.assertTrue(result.get("findMicroserviceVersionMeta"));
-// Assert.assertTrue(result.get("findRestOperation"));
-// Assert.assertTrue(result.get("scheduleInvocation"));
-// }
-//
-// @Test
-// public void findMicroserviceVersionMetaNullLatestVersion(@Mocked
AppManager appManager,
-// @Mocked MicroserviceVersionRule microserviceVersionRule, @Mocked
ServiceRegistry serviceRegistry) {
-// String versionRule = DefinitionConst.VERSION_RULE_ALL;
-// new Expectations(RegistryUtils.class) {
-// {
-// RegistryUtils.getServiceRegistry();
-// result = serviceRegistry;
-// serviceRegistry.getAppManager();
-// result = appManager;
-// RegistryUtils.getAppId();
-// result = "app";
-// appManager.getOrCreateMicroserviceVersionRule("app",
microserviceName, versionRule);
-// result = microserviceVersionRule;
-// microserviceVersionRule.getLatestMicroserviceVersion();
-// result = null;
-// }
-// };
-//
-// expectedException.expect(ServiceCombException.class);
-// expectedException.expectMessage(Matchers
-// .is("Failed to find latest MicroserviceVersionMeta, appId=app,
microserviceName=ms, versionRule=0.0.0+."));
-//
-// edgeInvocation.findMicroserviceVersionMeta();
-// }
-//
-// @Test
-// public void findMicroserviceVersionMetaNormal(@Mocked AppManager
appManager,
-// @Mocked MicroserviceVersionRule microserviceVersionRule,
-// @Mocked MicroserviceVersionMeta latestMicroserviceVersionMeta,
-// @Mocked ServiceRegistry serviceRegistry) {
-// String versionRule = DefinitionConst.VERSION_RULE_ALL;
-// microserviceName = "app:ms";
-// edgeInvocation.microserviceName = microserviceName;
-// new Expectations(RegistryUtils.class) {
-// {
-// RegistryUtils.getServiceRegistry();
-// result = serviceRegistry;
-// serviceRegistry.getAppManager();
-// result = appManager;
-// RegistryUtils.getAppId();
-// result = "app";
-// appManager.getOrCreateMicroserviceVersionRule("app",
microserviceName, versionRule);
-// result = microserviceVersionRule;
-// microserviceVersionRule.getLatestMicroserviceVersion();
-// result = latestMicroserviceVersionMeta;
-// }
-// };
-//
-// edgeInvocation.findMicroserviceVersionMeta();
-//
-// Assert.assertSame(latestMicroserviceVersionMeta,
edgeInvocation.latestMicroserviceVersionMeta);
-// }
-//
-// @Test
-// public void chooseVersionRule_default() {
-// Assert.assertEquals(DefinitionConst.VERSION_RULE_ALL,
edgeInvocation.chooseVersionRule());
-// }
-//
-// @Test
-// public void chooseVersionRule_set() {
-// String versionRule = "1.0.0";
-// edgeInvocation.setVersionRule(versionRule);
-//
-// Assert.assertEquals(versionRule, edgeInvocation.chooseVersionRule());
-// }
-//
-// @Test
-// public void locateOperation(@Mocked ServicePathManager servicePathManager,
-// @Mocked OperationLocator operationLocator) {
-// new Expectations() {
-// {
-// servicePathManager.consumerLocateOperation(anyString, anyString);
-// result = operationLocator;
-// }
-// };
-//
-// Assert.assertSame(operationLocator,
edgeInvocation.locateOperation(servicePathManager));
-// }
-//
-// @Test
-// public void createInvocation(@Mocked MicroserviceVersionMeta
microserviceVersionMeta,
-// @Mocked MicroserviceVersionRule microserviceVersionRule, @Mocked
RestOperationMeta restOperationMeta,
-// @Mocked Microservice microservice) {
-// edgeInvocation.latestMicroserviceVersionMeta = microserviceVersionMeta;
-// edgeInvocation.microserviceVersionRule = microserviceVersionRule;
-// Deencapsulation.setField(edgeInvocation, "restOperationMeta",
restOperationMeta);
-//
-// new Expectations(RegistryUtils.class) {
-// {
-// RegistryUtils.getMicroservice();
-// result = microservice;
-// }
-// };
-//
-// edgeInvocation.createInvocation();
-// Invocation invocation = Deencapsulation.getField(edgeInvocation,
"invocation");
-// Assert.assertThat(invocation.getResponseExecutor(),
Matchers.instanceOf(ReactiveResponseExecutor.class));
-// Assert.assertFalse(invocation.isSync());
-// Assert.assertTrue(invocation.isEdge());
-// Assert.assertSame(context,
invocation.getHandlerContext().get(EdgeInvocation.EDGE_INVOCATION_CONTEXT));
-// }
-//
-// @Test
-// public void testSetRoutingContext() {
-// Assert.assertSame(this.routingContext, edgeInvocation.routingContext);
-// }
-}
diff --git
a/foundations/foundation-vertx/src/main/java/io/vertx/ext/web/impl/MimeTypesUtils.java
b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/MimeTypesUtils.java
similarity index 97%
rename from
foundations/foundation-vertx/src/main/java/io/vertx/ext/web/impl/MimeTypesUtils.java
rename to
foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/MimeTypesUtils.java
index c184726..f96851a 100644
---
a/foundations/foundation-vertx/src/main/java/io/vertx/ext/web/impl/MimeTypesUtils.java
+++
b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/MimeTypesUtils.java
@@ -20,7 +20,7 @@
* Because we uses getSortedAcceptableMimeTypes method which is removed by
vertx.
*/
-package io.vertx.ext.web.impl;
+package org.apache.servicecomb.foundation.common.utils;
import java.util.ArrayList;
import java.util.Arrays;
diff --git
a/foundations/foundation-vertx/src/test/java/io/vertx/ext/web/impl/TestMimeTypesUtils.java
b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestMimeTypesUtils.java
similarity index 98%
rename from
foundations/foundation-vertx/src/test/java/io/vertx/ext/web/impl/TestMimeTypesUtils.java
rename to
foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestMimeTypesUtils.java
index 6c79eb9..2b5efe2 100644
---
a/foundations/foundation-vertx/src/test/java/io/vertx/ext/web/impl/TestMimeTypesUtils.java
+++
b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestMimeTypesUtils.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package io.vertx.ext.web.impl;
+package org.apache.servicecomb.foundation.common.utils;
import static org.junit.Assert.assertEquals;
diff --git
a/foundations/foundation-vertx/src/main/java/io/vertx/core/net/impl/VertxHelper.java
b/foundations/foundation-vertx/src/main/java/io/vertx/core/net/impl/VertxHelper.java
deleted file mode 100644
index 31873d1..0000000
---
a/foundations/foundation-vertx/src/main/java/io/vertx/core/net/impl/VertxHelper.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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 io.vertx.core.net.impl;
-
-import io.vertx.core.Context;
-
-public final class VertxHelper {
- private VertxHelper() {
- }
-
- public static Context getConnectionContext(ConnectionBase connection) {
- return connection.getContext();
- }
-}
diff --git
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/tcp/TcpConnection.java
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/tcp/TcpConnection.java
index e8428ed..02d86e2 100644
---
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/tcp/TcpConnection.java
+++
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/tcp/TcpConnection.java
@@ -27,7 +27,6 @@ import io.vertx.core.Context;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.net.NetSocket;
import io.vertx.core.net.impl.NetSocketImpl;
-import io.vertx.core.net.impl.VertxHelper;
public class TcpConnection {
protected String protocol;
@@ -81,7 +80,7 @@ public class TcpConnection {
public void initNetSocket(NetSocketImpl netSocket) {
this.netSocket = netSocket;
- this.context = VertxHelper.getConnectionContext(netSocket);
+ this.context = netSocket.getContext();
}
public void write(ByteBuf buf) {
diff --git
a/foundations/foundation-vertx/src/test/java/io/vertx/ext/web/impl/TestHttpServerRequestUtils.java
b/foundations/foundation-vertx/src/test/java/io/vertx/ext/web/impl/TestHttpServerRequestUtils.java
index 0b4fdbc..7835565 100644
---
a/foundations/foundation-vertx/src/test/java/io/vertx/ext/web/impl/TestHttpServerRequestUtils.java
+++
b/foundations/foundation-vertx/src/test/java/io/vertx/ext/web/impl/TestHttpServerRequestUtils.java
@@ -26,9 +26,10 @@ import io.vertx.ext.web.RoutingContext;
import mockit.Expectations;
import mockit.Mocked;
+// HttpServerRequestWrapper is a package visible class, so put this test in
package io.vertx.ext.web.impl
public class TestHttpServerRequestUtils {
@Test
- public void VertxServerRequestToHttpServletRequest(@Mocked RoutingContext
context,
+ public void testVertxServerRequestToHttpServletRequest(@Mocked
RoutingContext context,
@Mocked HttpServerRequest request) {
HttpServerRequestWrapper wrapper = new HttpServerRequestWrapper(request);
new Expectations() {
diff --git a/integration-tests/it-producer-deploy-springboot2-servlet/pom.xml
b/integration-tests/it-producer-deploy-springboot2-servlet/pom.xml
index c42a999..14263dc 100644
--- a/integration-tests/it-producer-deploy-springboot2-servlet/pom.xml
+++ b/integration-tests/it-producer-deploy-springboot2-servlet/pom.xml
@@ -71,36 +71,6 @@
<target>1.8</target>
</configuration>
</plugin>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>DISCLAIMER</exclude>
- <exclude>.travis.yml</exclude>
- <exclude>**/*.md</exclude>
- <excldue>**/*.MD</excldue>
- <exclude>**/target/*</exclude>
- <!-- Skip the code style configuration file -->
- <exclude>**/etc/eclipse-java-google-style.xml</exclude>
- <exclude>**/etc/intellij-java-google-style.xml</exclude>
- <!-- Skip the ssl configuration files -->
- <exculde>**/resources/ssl/**</exculde>
- <!-- SKip the licenses files -->
- <exclude>**/src/release/licenses/**</exclude>
- <!-- Skip the demo log files -->
- <exclude>**/logs/**.log</exclude>
- <exclude>**/**.log</exclude>
- <!-- Skip the target files -->
- <exclude>**/target/**</exclude>
- <!-- Skip the source files which are forked from vertx -->
- <exclude>**/io/vertx/ext/web/impl/MimeTypesUtils.java</exclude>
-
<exclude>**/java/org/apache/servicecomb/transport/rest/vertx/RestBodyHandler.java</exclude>
- <!--Skip protobuf generated file-->
-
<exclude>**/java/org/apache/servicecomb/foundation/protobuf/internal/model/ProtobufRoot.java</exclude>
- </excludes>
- </configuration>
- </plugin>
</plugins>
</pluginManagement>
</build>
diff --git
a/integration-tests/it-producer-deploy-springboot2-standalone/pom.xml
b/integration-tests/it-producer-deploy-springboot2-standalone/pom.xml
index f32faef..9cd91a0 100644
--- a/integration-tests/it-producer-deploy-springboot2-standalone/pom.xml
+++ b/integration-tests/it-producer-deploy-springboot2-standalone/pom.xml
@@ -72,36 +72,6 @@
<target>1.8</target>
</configuration>
</plugin>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>DISCLAIMER</exclude>
- <exclude>.travis.yml</exclude>
- <exclude>**/*.md</exclude>
- <excldue>**/*.MD</excldue>
- <exclude>**/target/*</exclude>
- <!-- Skip the code style configuration file -->
- <exclude>**/etc/eclipse-java-google-style.xml</exclude>
- <exclude>**/etc/intellij-java-google-style.xml</exclude>
- <!-- Skip the ssl configuration files -->
- <exculde>**/resources/ssl/**</exculde>
- <!-- SKip the licenses files -->
- <exclude>**/src/release/licenses/**</exclude>
- <!-- Skip the demo log files -->
- <exclude>**/logs/**.log</exclude>
- <exclude>**/**.log</exclude>
- <!-- Skip the target files -->
- <exclude>**/target/**</exclude>
- <!-- Skip the source files which are forked from vertx -->
- <exclude>**/io/vertx/ext/web/impl/MimeTypesUtils.java</exclude>
-
<exclude>**/java/org/apache/servicecomb/transport/rest/vertx/RestBodyHandler.java</exclude>
- <!--Skip protobuf generated file-->
-
<exclude>**/java/org/apache/servicecomb/foundation/protobuf/internal/model/ProtobufRoot.java</exclude>
- </excludes>
- </configuration>
- </plugin>
</plugins>
</pluginManagement>
</build>
diff --git a/pom.xml b/pom.xml
index f77a7f7..2579f06 100755
--- a/pom.xml
+++ b/pom.xml
@@ -228,8 +228,7 @@
<exclude>**/resources/webroot/images/*.png</exclude>
<exclude>**/resources/webroot/images/*.jpg</exclude>
<!-- Skip the source files which are forked from vertx -->
- <exclude>**/io/vertx/ext/web/impl/MimeTypesUtils.java</exclude>
- <exclude>**/io/vertx/core/impl/VertxImpl.java</exclude>
+
<exclude>**/org/apache/servicecomb/foundation/common/utils/MimeTypesUtils.java</exclude>
<exclude>**/java/org/apache/servicecomb/transport/rest/vertx/RestBodyHandler.java</exclude>
<!--Skip protobuf generated file-->
<exclude>**/java/org/apache/servicecomb/foundation/protobuf/internal/model/ProtobufRoot.java</exclude>
diff --git
a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestVertxRestDispatcher.java
b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestVertxRestDispatcher.java
index a072b13..1bd00f1 100644
---
a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestVertxRestDispatcher.java
+++
b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestVertxRestDispatcher.java
@@ -54,7 +54,6 @@ import io.vertx.core.http.Cookie;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.core.http.HttpServerResponse;
-import io.vertx.core.impl.VertxImpl;
import io.vertx.core.json.JsonObject;
import io.vertx.core.net.SocketAddress;
import io.vertx.ext.web.Router;