You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2018/01/13 08:31:56 UTC
[incubator-servicecomb-java-chassis] 02/06: SCB-230 change package
name from io.servicecomb to org.apache.servicecomb
This is an automated email from the ASF dual-hosted git repository.
ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git
commit 4265e0cc9480ede4020c4ecfe2321ec9d9d4bbf8
Author: wujimin <wu...@huawei.com>
AuthorDate: Sat Jan 13 10:50:05 2018 +0800
SCB-230 change package name from io.servicecomb to org.apache.servicecomb
---
common/common-javassist/pom.xml | 60 +-
.../servicecomb/common/javassist/ClassConfig.java | 104 ---
.../servicecomb/common/javassist/FieldConfig.java | 80 ---
.../common/javassist/JavassistUtils.java | 352 ----------
.../servicecomb/common/javassist/MethodConfig.java | 121 ----
.../servicecomb/common/javassist/MultiWrapper.java | 24 -
.../common/javassist/ParameterConfig.java | 41 --
.../common/javassist/SingleWrapper.java | 24 -
.../servicecomb/common/javassist/ClassConfig.java | 104 +++
.../servicecomb/common/javassist/FieldConfig.java | 80 +++
.../common/javassist/JavassistUtils.java | 352 ++++++++++
.../servicecomb/common/javassist/MethodConfig.java | 121 ++++
.../servicecomb/common/javassist/MultiWrapper.java | 24 +
.../common/javassist/ParameterConfig.java | 41 ++
.../common/javassist/SingleWrapper.java | 24 +
.../common/javassist/TestJavassistUtils.java | 206 ------
.../common/javassist/TestJavassistUtils.java | 206 ++++++
common/common-protobuf/pom.xml | 96 +--
.../runtime/ProtobufCompatibleUtils.java | 3 +-
.../codec/protobuf/codec/AbstractCodec.java | 40 --
.../codec/protobuf/codec/AbstractFieldCodec.java | 82 ---
.../codec/protobuf/codec/ParamFieldCodec.java | 39 --
.../codec/protobuf/codec/ResultFieldCodec.java | 39 --
.../codec/protobuf/codec/StandardParamCodec.java | 43 --
.../codec/protobuf/codec/StandardResultCodec.java | 41 --
.../protobuf/definition/OperationProtobuf.java | 66 --
.../codec/protobuf/definition/ProtobufManager.java | 78 ---
.../protobuf/jackson/AbstractDeserializer.java | 67 --
.../codec/protobuf/jackson/CseObjectReader.java | 35 -
.../codec/protobuf/jackson/CseObjectWriter.java | 57 --
.../codec/protobuf/jackson/ParamDeserializer.java | 40 --
.../codec/protobuf/jackson/ParamSerializer.java | 45 --
.../codec/protobuf/jackson/ResultDeserializer.java | 39 --
.../codec/protobuf/jackson/ResultSerializer.java | 41 --
.../protobuf/jackson/StandardObjectReader.java | 39 --
.../protobuf/jackson/StandardObjectWriter.java | 40 --
.../codec/protobuf/utils/ProtobufSchemaUtils.java | 160 -----
.../codec/protobuf/utils/WrapClassConfig.java | 32 -
.../codec/protobuf/utils/WrapSchema.java | 63 --
.../servicecomb/codec/protobuf/utils/WrapType.java | 25 -
.../protobuf/utils/schema/AbstractWrapSchema.java | 25 -
.../protobuf/utils/schema/ArgsNotWrapSchema.java | 53 --
.../protobuf/utils/schema/ArgsWrapSchema.java | 53 --
.../protobuf/utils/schema/NormalWrapSchema.java | 57 --
.../codec/protobuf/utils/schema/NotWrapSchema.java | 52 --
.../protobuf/utils/schema/WrapSchemaFactory.java | 42 --
.../codec/protobuf/codec/AbstractCodec.java | 40 ++
.../codec/protobuf/codec/AbstractFieldCodec.java | 82 +++
.../codec/protobuf/codec/ParamFieldCodec.java | 39 ++
.../codec/protobuf/codec/ResultFieldCodec.java | 39 ++
.../codec/protobuf/codec/StandardParamCodec.java | 43 ++
.../codec/protobuf/codec/StandardResultCodec.java | 41 ++
.../protobuf/definition/OperationProtobuf.java | 66 ++
.../codec/protobuf/definition/ProtobufManager.java | 78 +++
.../protobuf/jackson/AbstractDeserializer.java | 67 ++
.../codec/protobuf/jackson/CseObjectReader.java | 35 +
.../codec/protobuf/jackson/CseObjectWriter.java | 57 ++
.../codec/protobuf/jackson/ParamDeserializer.java | 40 ++
.../codec/protobuf/jackson/ParamSerializer.java | 45 ++
.../codec/protobuf/jackson/ResultDeserializer.java | 39 ++
.../codec/protobuf/jackson/ResultSerializer.java | 41 ++
.../protobuf/jackson/StandardObjectReader.java | 39 ++
.../protobuf/jackson/StandardObjectWriter.java | 40 ++
.../codec/protobuf/utils/ProtobufSchemaUtils.java | 160 +++++
.../codec/protobuf/utils/WrapClassConfig.java | 32 +
.../codec/protobuf/utils/WrapSchema.java | 63 ++
.../servicecomb/codec/protobuf/utils/WrapType.java | 25 +
.../protobuf/utils/schema/AbstractWrapSchema.java | 26 +
.../protobuf/utils/schema/ArgsNotWrapSchema.java | 53 ++
.../protobuf/utils/schema/ArgsWrapSchema.java | 54 ++
.../protobuf/utils/schema/NormalWrapSchema.java | 58 ++
.../codec/protobuf/utils/schema/NotWrapSchema.java | 52 ++
.../protobuf/utils/schema/WrapSchemaFactory.java | 43 ++
.../codec/protobuf/codec/TestAbstractCodec.java | 57 --
.../protobuf/codec/TestAbstractFieldCodec.java | 111 ---
.../codec/protobuf/codec/TestParamFieldCodec.java | 74 --
.../codec/protobuf/codec/TestResultFieldCodec.java | 73 --
.../protobuf/codec/TestStandardParamCodec.java | 75 --
.../protobuf/codec/TestStandardResultCodec.java | 77 ---
.../protobuf/definition/TestOperationProtobuf.java | 57 --
.../protobuf/jackson/TestAbstractDeserializer.java | 105 ---
.../protobuf/jackson/TestParamDeserializer.java | 62 --
.../protobuf/jackson/TestParamSerializer.java | 130 ----
.../protobuf/jackson/TestResultSerializer.java | 130 ----
.../protobuf/jackson/TestStandardObjectWriter.java | 77 ---
.../protobuf/utils/TestProtobufSchemaUtils.java | 120 ----
.../utils/schema/TestArgsNotWrapSchema.java | 95 ---
.../protobuf/utils/schema/TestArgsWrapSchema.java | 97 ---
.../codec/protobuf/codec/TestAbstractCodec.java | 57 ++
.../protobuf/codec/TestAbstractFieldCodec.java | 110 +++
.../codec/protobuf/codec/TestParamFieldCodec.java | 74 ++
.../codec/protobuf/codec/TestResultFieldCodec.java | 73 ++
.../protobuf/codec/TestStandardParamCodec.java | 75 ++
.../protobuf/codec/TestStandardResultCodec.java | 77 +++
.../protobuf/definition/TestOperationProtobuf.java | 57 ++
.../protobuf/jackson/TestAbstractDeserializer.java | 104 +++
.../protobuf/jackson/TestParamDeserializer.java | 61 ++
.../protobuf/jackson/TestParamSerializer.java | 130 ++++
.../protobuf/jackson/TestResultSerializer.java | 130 ++++
.../protobuf/jackson/TestStandardObjectWriter.java | 77 +++
.../protobuf/utils/TestProtobufSchemaUtils.java | 120 ++++
.../utils/schema/TestArgsNotWrapSchema.java | 95 +++
.../protobuf/utils/schema/TestArgsWrapSchema.java | 97 +++
common/common-rest/pom.xml | 70 +-
.../common/rest/AbstractRestInvocation.java | 296 --------
.../java/io/servicecomb/common/rest/RestConst.java | 48 --
.../common/rest/RestEngineSchemaListener.java | 92 ---
.../common/rest/RestProducerInvocation.java | 78 ---
.../common/rest/codec/RestClientRequest.java | 42 --
.../servicecomb/common/rest/codec/RestCodec.java | 74 --
.../common/rest/codec/RestObjectMapper.java | 44 --
.../rest/codec/param/AbstractParamProcessor.java | 35 -
.../rest/codec/param/BodyProcessorCreator.java | 138 ----
.../rest/codec/param/CookieProcessorCreator.java | 77 ---
.../rest/codec/param/FormProcessorCreator.java | 107 ---
.../rest/codec/param/HeaderProcessorCreator.java | 88 ---
.../rest/codec/param/ParamValueProcessor.java | 39 --
.../codec/param/ParamValueProcessorCreator.java | 26 -
.../param/ParamValueProcessorCreatorManager.java | 39 --
.../rest/codec/param/PathProcessorCreator.java | 76 --
.../rest/codec/param/QueryProcessorCreator.java | 70 --
.../rest/codec/param/RestClientRequestImpl.java | 285 --------
.../codec/produce/AbstractProduceProcessor.java | 24 -
.../rest/codec/produce/ProduceJsonProcessor.java | 45 --
.../rest/codec/produce/ProduceProcessor.java | 72 --
.../codec/produce/ProduceProcessorManager.java | 40 --
.../codec/produce/ProduceTextPlainProcessor.java | 62 --
.../rest/definition/RestOperationComparator.java | 59 --
.../common/rest/definition/RestOperationMeta.java | 238 -------
.../common/rest/definition/RestParam.java | 85 ---
.../definition/path/AbstractUrlParamWriter.java | 32 -
.../common/rest/definition/path/PathRegExp.java | 231 -------
.../rest/definition/path/PathVarParamWriter.java | 34 -
.../rest/definition/path/QueryVarParamWriter.java | 105 ---
.../rest/definition/path/StaticUrlParamWriter.java | 32 -
.../rest/definition/path/URLPathBuilder.java | 120 ----
.../rest/definition/path/UrlParamWriter.java | 22 -
.../common/rest/filter/HttpClientFilter.java | 33 -
.../common/rest/filter/HttpServerFilter.java | 39 --
.../common/rest/filter/tracing/TracingFilter.java | 76 --
.../common/rest/locator/MicroservicePaths.java | 111 ---
.../common/rest/locator/OperationGroup.java | 32 -
.../common/rest/locator/OperationLocator.java | 119 ----
.../common/rest/locator/ServicePathManager.java | 157 -----
.../common/rest/AbstractRestInvocation.java | 296 ++++++++
.../apache/servicecomb/common/rest/RestConst.java | 48 ++
.../common/rest/RestEngineSchemaListener.java | 91 +++
.../common/rest/RestProducerInvocation.java | 78 +++
.../common/rest/codec/RestClientRequest.java | 42 ++
.../servicecomb/common/rest/codec/RestCodec.java | 73 ++
.../common/rest/codec/RestObjectMapper.java | 44 ++
.../rest/codec/param/AbstractParamProcessor.java | 35 +
.../rest/codec/param/BodyProcessorCreator.java | 138 ++++
.../rest/codec/param/CookieProcessorCreator.java | 78 +++
.../rest/codec/param/FormProcessorCreator.java | 108 +++
.../rest/codec/param/HeaderProcessorCreator.java | 88 +++
.../rest/codec/param/ParamValueProcessor.java | 39 ++
.../codec/param/ParamValueProcessorCreator.java | 26 +
.../param/ParamValueProcessorCreatorManager.java | 39 ++
.../rest/codec/param/PathProcessorCreator.java | 77 +++
.../rest/codec/param/QueryProcessorCreator.java | 71 ++
.../rest/codec/param/RestClientRequestImpl.java | 285 ++++++++
.../codec/produce/AbstractProduceProcessor.java | 24 +
.../rest/codec/produce/ProduceJsonProcessor.java | 45 ++
.../rest/codec/produce/ProduceProcessor.java | 73 ++
.../codec/produce/ProduceProcessorManager.java | 40 ++
.../codec/produce/ProduceTextPlainProcessor.java | 62 ++
.../rest/definition/RestOperationComparator.java | 59 ++
.../common/rest/definition/RestOperationMeta.java | 238 +++++++
.../common/rest/definition/RestParam.java | 86 +++
.../definition/path/AbstractUrlParamWriter.java | 32 +
.../common/rest/definition/path/PathRegExp.java | 231 +++++++
.../rest/definition/path/PathVarParamWriter.java | 34 +
.../rest/definition/path/QueryVarParamWriter.java | 105 +++
.../rest/definition/path/StaticUrlParamWriter.java | 32 +
.../rest/definition/path/URLPathBuilder.java | 120 ++++
.../rest/definition/path/UrlParamWriter.java | 22 +
.../common/rest/filter/HttpClientFilter.java | 33 +
.../common/rest/filter/HttpServerFilter.java | 39 ++
.../common/rest/filter/tracing/TracingFilter.java | 75 ++
.../common/rest/locator/MicroservicePaths.java | 110 +++
.../common/rest/locator/OperationGroup.java | 32 +
.../common/rest/locator/OperationLocator.java | 118 ++++
.../common/rest/locator/ServicePathManager.java | 156 +++++
...servicecomb.common.rest.filter.HttpServerFilter | 18 -
...servicecomb.common.rest.filter.HttpServerFilter | 18 +
.../common/rest/TestAbstractRestInvocation.java | 761 ---------------------
.../io/servicecomb/common/rest/TestDefPath.java | 39 --
.../common/rest/TestRestEngineSchemaListener.java | 72 --
.../common/rest/TestRestProducerInvocation.java | 212 ------
.../common/rest/codec/TestRestCodec.java | 170 -----
.../common/rest/codec/TestRestObjectMapper.java | 36 -
.../common/rest/codec/param/TestBodyProcessor.java | 235 -------
.../rest/codec/param/TestBodyProcessorCreator.java | 64 --
.../rest/codec/param/TestCookieProcessor.java | 148 ----
.../codec/param/TestCookieProcessorCreator.java | 38 -
.../common/rest/codec/param/TestFormProcessor.java | 196 ------
.../rest/codec/param/TestFormProcessorCreator.java | 38 -
.../rest/codec/param/TestHeaderProcessor.java | 190 -----
.../codec/param/TestHeaderProcessorCreator.java | 38 -
.../common/rest/codec/param/TestPathProcessor.java | 94 ---
.../rest/codec/param/TestPathProcessorCreator.java | 39 --
.../rest/codec/param/TestQueryProcessor.java | 73 --
.../codec/param/TestQueryProcessorCreator.java | 39 --
.../codec/param/TestRestClientRequestImpl.java | 116 ----
.../codec/produce/TestProduceJsonProcessor.java | 83 ---
.../codec/produce/TestProduceProcessorManager.java | 28 -
.../produce/TestProduceTextPlainProcessor.java | 83 ---
.../common/rest/definition/TestPath.java | 150 ----
.../definition/TestRestOperationComparator.java | 76 --
.../rest/definition/TestRestOperationMeta.java | 262 -------
.../common/rest/definition/UnitTestRestUtils.java | 38 -
.../rest/filter/tracing/TracingFilterTest.java | 80 ---
.../common/rest/locator/TestMicroservicePaths.java | 140 ----
.../common/rest/locator/TestOperationLocator.java | 100 ---
.../rest/locator/TestServicePathManager.java | 113 ---
.../common/rest/TestAbstractRestInvocation.java | 761 +++++++++++++++++++++
.../servicecomb/common/rest/TestDefPath.java | 38 +
.../common/rest/TestRestEngineSchemaListener.java | 72 ++
.../common/rest/TestRestProducerInvocation.java | 212 ++++++
.../common/rest/codec/TestRestCodec.java | 170 +++++
.../common/rest/codec/TestRestObjectMapper.java | 37 +
.../common/rest/codec/param/TestBodyProcessor.java | 235 +++++++
.../rest/codec/param/TestBodyProcessorCreator.java | 64 ++
.../rest/codec/param/TestCookieProcessor.java | 148 ++++
.../codec/param/TestCookieProcessorCreator.java | 38 +
.../common/rest/codec/param/TestFormProcessor.java | 196 ++++++
.../rest/codec/param/TestFormProcessorCreator.java | 38 +
.../rest/codec/param/TestHeaderProcessor.java | 190 +++++
.../codec/param/TestHeaderProcessorCreator.java | 38 +
.../common/rest/codec/param/TestPathProcessor.java | 94 +++
.../rest/codec/param/TestPathProcessorCreator.java | 39 ++
.../rest/codec/param/TestQueryProcessor.java | 73 ++
.../codec/param/TestQueryProcessorCreator.java | 39 ++
.../codec/param/TestRestClientRequestImpl.java | 116 ++++
.../codec/produce/TestProduceJsonProcessor.java | 83 +++
.../codec/produce/TestProduceProcessorManager.java | 28 +
.../produce/TestProduceTextPlainProcessor.java | 83 +++
.../common/rest/definition/TestPath.java | 150 ++++
.../definition/TestRestOperationComparator.java | 75 ++
.../rest/definition/TestRestOperationMeta.java | 262 +++++++
.../common/rest/definition/UnitTestRestUtils.java | 39 ++
.../rest/filter/tracing/TracingFilterTest.java | 79 +++
.../common/rest/locator/TestMicroservicePaths.java | 139 ++++
.../common/rest/locator/TestOperationLocator.java | 99 +++
.../rest/locator/TestServicePathManager.java | 113 +++
common/pom.xml | 9 +-
.../java/io/servicecomb/core/BootListener.java | 47 --
core/src/main/java/io/servicecomb/core/Const.java | 47 --
.../java/io/servicecomb/core/ConsumerProvider.java | 28 -
.../servicecomb/core/CseApplicationListener.java | 181 -----
.../main/java/io/servicecomb/core/CseContext.java | 125 ----
.../main/java/io/servicecomb/core/Endpoint.java | 68 --
.../src/main/java/io/servicecomb/core/Handler.java | 29 -
.../main/java/io/servicecomb/core/Invocation.java | 220 ------
.../java/io/servicecomb/core/ProducerProvider.java | 24 -
.../main/java/io/servicecomb/core/Transport.java | 52 --
.../config/ConfigurationSpringInitializer.java | 29 -
.../servicecomb/core/definition/CommonService.java | 56 --
.../core/definition/MicroserviceMeta.java | 159 -----
.../core/definition/MicroserviceMetaManager.java | 77 ---
.../core/definition/MicroserviceVersionMeta.java | 47 --
.../definition/MicroserviceVersionMetaFactory.java | 40 --
.../servicecomb/core/definition/OperationMeta.java | 146 ----
.../PrivateMicroserviceVersionMetaFactory.java | 26 -
.../io/servicecomb/core/definition/SchemaMeta.java | 156 -----
.../servicecomb/core/definition/SchemaUtils.java | 49 --
.../DefaultMicroserviceClassLoaderFactory.java | 27 -
.../classloader/MicroserviceClassLoader.java | 66 --
.../MicroserviceClassLoaderFactory.java | 22 -
.../PrivateMicroserviceClassLoaderFactory.java | 30 -
.../definition/loader/DynamicSchemaLoader.java | 81 ---
.../core/definition/loader/SchemaListener.java | 25 -
.../definition/loader/SchemaListenerManager.java | 86 ---
.../core/definition/loader/SchemaLoader.java | 134 ----
.../definition/schema/AbstractSchemaFactory.java | 114 ---
.../definition/schema/ConsumerSchemaContext.java | 32 -
.../definition/schema/ConsumerSchemaFactory.java | 160 -----
.../definition/schema/ProducerSchemaContext.java | 30 -
.../definition/schema/ProducerSchemaFactory.java | 124 ----
.../core/definition/schema/SchemaContext.java | 68 --
.../core/endpoint/AbstractEndpointsCache.java | 120 ----
.../servicecomb/core/endpoint/EndpointsCache.java | 35 -
.../servicecomb/core/exception/CseException.java | 44 --
.../servicecomb/core/exception/ExceptionUtils.java | 94 ---
.../servicecomb/core/executor/ExecutorManager.java | 78 ---
.../core/executor/FixedThreadExecutor.java | 74 --
.../core/executor/ReactiveExecutor.java | 31 -
.../core/filter/EndpointDiscoveryFilter.java | 50 --
.../core/handler/AbstractHandlerManager.java | 117 ----
.../core/handler/ConsumerHandlerManager.java | 40 --
.../core/handler/HandlerConfigUtils.java | 50 --
.../core/handler/ProducerHandlerManager.java | 40 --
.../core/handler/ShutdownHookHandler.java | 98 ---
.../io/servicecomb/core/handler/config/Config.java | 50 --
.../core/handler/config/HandlerConfig.java | 51 --
.../core/handler/impl/AbstractHandler.java | 30 -
.../handler/impl/ProducerOperationHandler.java | 42 --
.../handler/impl/SimpleLoadBalanceHandler.java | 88 ---
.../core/handler/impl/TransportClientHandler.java | 45 --
.../core/invocation/InvocationFactory.java | 75 --
.../core/metrics/InvocationFinishedEvent.java | 56 --
.../metrics/InvocationStartProcessingEvent.java | 48 --
.../core/metrics/InvocationStartedEvent.java | 47 --
.../consumer/AbstractConsumerProvider.java | 32 -
.../provider/consumer/ConsumerProviderManager.java | 99 ---
.../core/provider/consumer/InvokerUtils.java | 115 ----
.../consumer/ReactiveResponseExecutor.java | 30 -
.../core/provider/consumer/ReferenceConfig.java | 66 --
.../provider/consumer/ReferenceConfigUtils.java | 54 --
.../provider/consumer/SyncResponseExecutor.java | 72 --
.../producer/AbstractProducerProvider.java | 23 -
.../core/provider/producer/ProducerMeta.java | 60 --
.../provider/producer/ProducerProviderManager.java | 56 --
.../core/tracing/BraveTraceIdGenerator.java | 32 -
.../servicecomb/core/tracing/TraceIdGenerator.java | 22 -
.../core/transport/AbstractTransport.java | 162 -----
.../core/transport/TransportManager.java | 118 ----
.../io/servicecomb/core/unittest/UnitTestMeta.java | 137 ----
.../org/apache/servicecomb/core/BootListener.java | 47 ++
.../java/org/apache/servicecomb/core/Const.java | 47 ++
.../apache/servicecomb/core/ConsumerProvider.java | 28 +
.../servicecomb/core/CseApplicationListener.java | 180 +++++
.../org/apache/servicecomb/core/CseContext.java | 125 ++++
.../java/org/apache/servicecomb/core/Endpoint.java | 68 ++
.../java/org/apache/servicecomb/core/Handler.java | 30 +
.../org/apache/servicecomb/core/Invocation.java | 220 ++++++
.../apache/servicecomb/core/ProducerProvider.java | 24 +
.../org/apache/servicecomb/core/Transport.java | 52 ++
.../config/ConfigurationSpringInitializer.java | 29 +
.../servicecomb/core/definition/CommonService.java | 56 ++
.../core/definition/MicroserviceMeta.java | 159 +++++
.../core/definition/MicroserviceMetaManager.java | 76 ++
.../core/definition/MicroserviceVersionMeta.java | 47 ++
.../definition/MicroserviceVersionMetaFactory.java | 40 ++
.../servicecomb/core/definition/OperationMeta.java | 147 ++++
.../PrivateMicroserviceVersionMetaFactory.java | 26 +
.../servicecomb/core/definition/SchemaMeta.java | 156 +++++
.../servicecomb/core/definition/SchemaUtils.java | 50 ++
.../DefaultMicroserviceClassLoaderFactory.java | 27 +
.../classloader/MicroserviceClassLoader.java | 66 ++
.../MicroserviceClassLoaderFactory.java | 22 +
.../PrivateMicroserviceClassLoaderFactory.java | 31 +
.../definition/loader/DynamicSchemaLoader.java | 81 +++
.../core/definition/loader/SchemaListener.java | 25 +
.../definition/loader/SchemaListenerManager.java | 85 +++
.../core/definition/loader/SchemaLoader.java | 134 ++++
.../definition/schema/AbstractSchemaFactory.java | 115 ++++
.../definition/schema/ConsumerSchemaContext.java | 32 +
.../definition/schema/ConsumerSchemaFactory.java | 162 +++++
.../definition/schema/ProducerSchemaContext.java | 30 +
.../definition/schema/ProducerSchemaFactory.java | 124 ++++
.../core/definition/schema/SchemaContext.java | 68 ++
.../core/endpoint/AbstractEndpointsCache.java | 119 ++++
.../servicecomb/core/endpoint/EndpointsCache.java | 35 +
.../servicecomb/core/exception/CseException.java | 44 ++
.../servicecomb/core/exception/ExceptionUtils.java | 93 +++
.../servicecomb/core/executor/ExecutorManager.java | 78 +++
.../core/executor/FixedThreadExecutor.java | 73 ++
.../core/executor/ReactiveExecutor.java | 31 +
.../core/filter/EndpointDiscoveryFilter.java | 50 ++
.../core/handler/AbstractHandlerManager.java | 116 ++++
.../core/handler/ConsumerHandlerManager.java | 40 ++
.../core/handler/HandlerConfigUtils.java | 49 ++
.../core/handler/ProducerHandlerManager.java | 40 ++
.../core/handler/ShutdownHookHandler.java | 97 +++
.../servicecomb/core/handler/config/Config.java | 50 ++
.../core/handler/config/HandlerConfig.java | 51 ++
.../core/handler/impl/AbstractHandler.java | 30 +
.../handler/impl/ProducerOperationHandler.java | 42 ++
.../handler/impl/SimpleLoadBalanceHandler.java | 87 +++
.../core/handler/impl/TransportClientHandler.java | 44 ++
.../core/invocation/InvocationFactory.java | 75 ++
.../core/metrics/InvocationFinishedEvent.java | 56 ++
.../metrics/InvocationStartProcessingEvent.java | 48 ++
.../core/metrics/InvocationStartedEvent.java | 47 ++
.../consumer/AbstractConsumerProvider.java | 32 +
.../provider/consumer/ConsumerProviderManager.java | 98 +++
.../core/provider/consumer/InvokerUtils.java | 114 +++
.../consumer/ReactiveResponseExecutor.java | 30 +
.../core/provider/consumer/ReferenceConfig.java | 66 ++
.../provider/consumer/ReferenceConfigUtils.java | 54 ++
.../provider/consumer/SyncResponseExecutor.java | 72 ++
.../producer/AbstractProducerProvider.java | 23 +
.../core/provider/producer/ProducerMeta.java | 60 ++
.../provider/producer/ProducerProviderManager.java | 55 ++
.../core/tracing/BraveTraceIdGenerator.java | 32 +
.../servicecomb/core/tracing/TraceIdGenerator.java | 22 +
.../core/transport/AbstractTransport.java | 163 +++++
.../core/transport/TransportManager.java | 121 ++++
.../servicecomb/core/unittest/UnitTestMeta.java | 137 ++++
.../main/resources/META-INF/spring/cse.bean.xml | 12 +-
core/src/main/resources/config/cse.handler.xml | 2 +-
core/src/test/java/io/servicecomb/core/Config.java | 50 --
.../test/java/io/servicecomb/core/TestConfig.java | 145 ----
.../java/io/servicecomb/core/TestConsumer.java | 125 ----
.../core/TestCseApplicationListener.java | 214 ------
.../java/io/servicecomb/core/TestDefinition.java | 89 ---
.../java/io/servicecomb/core/TestEndpoint.java | 41 --
.../java/io/servicecomb/core/TestException.java | 59 --
.../java/io/servicecomb/core/TestExecutors.java | 61 --
.../test/java/io/servicecomb/core/TestHandler.java | 33 -
.../io/servicecomb/core/TestInvocationFactory.java | 71 --
.../java/io/servicecomb/core/TestTransport.java | 112 ---
core/src/test/java/io/servicecomb/core/Utils.java | 37 -
.../consumer/TestReactiveResponseExecutor.java | 39 --
.../core/consumer/TestSyncResponseExecutor.java | 43 --
.../MicroServicePropertyExtendedStub.java | 29 -
.../core/definition/TestMicroserviceMeta.java | 93 ---
.../definition/TestMicroserviceMetaManager.java | 33 -
.../definition/TestMicroserviceVersionMeta.java | 82 ---
.../TestMicroserviceVersionMetaFactory.java | 80 ---
.../core/definition/TestOperationMeta.java | 77 ---
.../TestPrivateMicroserviceVersionMetaFactory.java | 33 -
.../core/definition/TestSchemaMeta.java | 48 --
.../core/definition/TestSchemaUtils.java | 29 -
.../TestDefaultMicroserviceClassLoaderFactory.java | 30 -
.../TestPrivateMicroserviceClassLoaderFactory.java | 40 --
.../definition/loader/TestDynamicSchemaLoader.java | 122 ----
.../loader/TestSchemaListenerManager.java | 55 --
.../schema/TestConsumerSchemaFactory.java | 118 ----
.../schema/TestProducerSchemaFactory.java | 167 -----
.../core/executor/TestExecutorManager.java | 136 ----
.../core/filter/TestEndpointDiscoveryFilter.java | 107 ---
.../core/handler/TestShutdownHookHandler.java | 141 ----
.../handler/impl/TestServiceProviderHandler.java | 68 --
.../handler/impl/TestSimpleLoadBalanceHandler.java | 127 ----
.../handler/impl/TestTransportClientHandler.java | 58 --
.../java/io/servicecomb/core/provider/Person.java | 30 -
.../consumer/TestConsumerProviderManager.java | 37 -
.../core/provider/consumer/TestInvokerUtils.java | 140 ----
.../provider/consumer/TestReferenceConfig.java | 64 --
.../consumer/TestReferenceConfigUtils.java | 56 --
.../core/provider/producer/TestProducerMeta.java | 44 --
.../producer/TestProducerProviderManager.java | 37 -
.../core/tracing/BraveTraceIdGeneratorTest.java | 39 --
.../core/transport/TestAbstractTransport.java | 137 ----
.../core/transport/TestTransportManager.java | 225 ------
.../java/org/apache/servicecomb/core/Config.java | 50 ++
.../org/apache/servicecomb/core/TestConfig.java | 144 ++++
.../org/apache/servicecomb/core/TestConsumer.java | 124 ++++
.../core/TestCseApplicationListener.java | 214 ++++++
.../apache/servicecomb/core/TestDefinition.java | 89 +++
.../org/apache/servicecomb/core/TestEndpoint.java | 41 ++
.../org/apache/servicecomb/core/TestException.java | 58 ++
.../org/apache/servicecomb/core/TestExecutors.java | 61 ++
.../org/apache/servicecomb/core/TestHandler.java | 32 +
.../servicecomb/core/TestInvocationFactory.java | 71 ++
.../org/apache/servicecomb/core/TestTransport.java | 112 +++
.../java/org/apache/servicecomb/core/Utils.java | 37 +
.../consumer/TestReactiveResponseExecutor.java | 38 +
.../core/consumer/TestSyncResponseExecutor.java | 42 ++
.../MicroServicePropertyExtendedStub.java | 29 +
.../core/definition/TestMicroserviceMeta.java | 93 +++
.../definition/TestMicroserviceMetaManager.java | 33 +
.../definition/TestMicroserviceVersionMeta.java | 82 +++
.../TestMicroserviceVersionMetaFactory.java | 80 +++
.../core/definition/TestOperationMeta.java | 77 +++
.../TestPrivateMicroserviceVersionMetaFactory.java | 33 +
.../core/definition/TestSchemaMeta.java | 48 ++
.../core/definition/TestSchemaUtils.java | 29 +
.../TestDefaultMicroserviceClassLoaderFactory.java | 30 +
.../TestPrivateMicroserviceClassLoaderFactory.java | 40 ++
.../definition/loader/TestDynamicSchemaLoader.java | 121 ++++
.../loader/TestSchemaListenerManager.java | 54 ++
.../schema/TestConsumerSchemaFactory.java | 118 ++++
.../schema/TestProducerSchemaFactory.java | 167 +++++
.../core/executor/TestExecutorManager.java | 136 ++++
.../core/filter/TestEndpointDiscoveryFilter.java | 107 +++
.../core/handler/TestShutdownHookHandler.java | 141 ++++
.../handler/impl/TestServiceProviderHandler.java | 67 ++
.../handler/impl/TestSimpleLoadBalanceHandler.java | 127 ++++
.../handler/impl/TestTransportClientHandler.java | 57 ++
.../apache/servicecomb/core/provider/Person.java | 30 +
.../consumer/TestConsumerProviderManager.java | 37 +
.../core/provider/consumer/TestInvokerUtils.java | 141 ++++
.../provider/consumer/TestReferenceConfig.java | 64 ++
.../consumer/TestReferenceConfigUtils.java | 57 ++
.../core/provider/producer/TestProducerMeta.java | 44 ++
.../producer/TestProducerProviderManager.java | 37 +
.../core/tracing/BraveTraceIdGeneratorTest.java | 39 ++
.../core/transport/TestAbstractTransport.java | 137 ++++
.../core/transport/TestTransportManager.java | 225 ++++++
.../test/resources/META-INF/spring/cse.bean.xml | 8 +-
core/src/test/resources/config/cse.handler.xml | 2 +-
.../src/test/resources/test/test/microservice.yaml | 2 +-
core/src/test/resources/test/test/schema.yaml | 2 +-
coverage-reports/pom.xml | 3 +-
demo/demo-crossapp/crossapp-client/pom.xml | 130 ++--
.../demo/crossapp/CrossappBootListener.java | 35 -
.../servicecomb/demo/crossapp/CrossappClient.java | 55 --
.../io/servicecomb/demo/crossapp/HelloWorld.java | 22 -
.../demo/crossapp/CrossappBootListener.java | 34 +
.../servicecomb/demo/crossapp/CrossappClient.java | 54 ++
.../servicecomb/demo/crossapp/HelloWorld.java | 22 +
.../src/main/resources/microservice.yaml | 2 +-
.../src/main/resources/schemas/helloworld.yaml | 2 +-
.../io/servicecomb/demo/crossapp/CrossAppIT.java | 41 --
.../servicecomb/demo/crossapp/CrossAppIT.java | 40 ++
demo/demo-crossapp/crossapp-server/pom.xml | 122 ++--
.../demo/crossapp/CrossappBootListener.java | 35 -
.../servicecomb/demo/crossapp/CrossappServer.java | 29 -
.../io/servicecomb/demo/crossapp/HelloWorld.java | 22 -
.../servicecomb/demo/crossapp/HelloWorldImpl.java | 29 -
.../demo/crossapp/CrossappBootListener.java | 34 +
.../servicecomb/demo/crossapp/CrossappServer.java | 29 +
.../servicecomb/demo/crossapp/HelloWorld.java | 22 +
.../servicecomb/demo/crossapp/HelloWorldImpl.java | 29 +
.../src/main/resources/schemas/helloworld.yaml | 2 +-
demo/demo-crossapp/pom.xml | 28 +-
demo/demo-edge/authentication/pom.xml | 3 +-
.../demo/edge/authentication/AuthImpl.java | 33 -
.../demo/edge/authentication/AuthMain.java | 28 -
.../demo/edge/authentication/AuthImpl.java | 32 +
.../demo/edge/authentication/AuthMain.java | 28 +
demo/demo-edge/edge-service/pom.xml | 2 +-
.../demo/edge/service/EdgeDispatcher.java | 57 --
.../io/servicecomb/demo/edge/service/EdgeMain.java | 28 -
.../demo/edge/service/handler/Auth.java | 22 -
.../demo/edge/service/handler/AuthHandler.java | 56 --
.../demo/edge/service/EdgeDispatcher.java | 58 ++
.../servicecomb/demo/edge/service/EdgeMain.java | 28 +
.../demo/edge/service/handler/Auth.java | 22 +
.../demo/edge/service/handler/AuthHandler.java | 55 ++
...cecomb.transport.rest.vertx.VertxHttpDispatcher | 18 -
...cecomb.transport.rest.vertx.VertxHttpDispatcher | 18 +
.../src/main/resources/config/cse.handler.xml | 2 +-
demo/demo-edge/hiboard-business-1-1-0/pom.xml | 2 +-
.../demo/edge/business/BusinessMain_V1_1_0.java | 28 -
.../io/servicecomb/demo/edge/business/Impl.java | 50 --
.../demo/edge/business/BusinessMain_V1_1_0.java | 28 +
.../servicecomb/demo/edge/business/Impl.java | 49 ++
demo/demo-edge/hiboard-business-1.0.0/pom.xml | 2 +-
.../demo/edge/business/BusinessMain_V1_0_0.java | 28 -
.../io/servicecomb/demo/edge/business/Impl.java | 45 --
.../demo/edge/business/BusinessMain_V1_0_0.java | 28 +
.../servicecomb/demo/edge/business/Impl.java | 44 ++
demo/demo-edge/hiboard-business-2.0.0/pom.xml | 2 +-
.../demo/edge/business/BusinessMain_V2_0_0.java | 28 -
.../io/servicecomb/demo/edge/business/Impl.java | 50 --
.../demo/edge/business/BusinessMain_V2_0_0.java | 28 +
.../servicecomb/demo/edge/business/Impl.java | 49 ++
demo/demo-edge/hiboard-consumer/pom.xml | 2 +-
.../servicecomb/demo/edge/consumer/Consumer.java | 155 -----
.../demo/edge/consumer/ConsumerMain.java | 30 -
.../servicecomb/demo/edge/consumer/Consumer.java | 154 +++++
.../demo/edge/consumer/ConsumerMain.java | 30 +
.../demo/edge/model/AppClientDataRsp.java | 35 -
.../demo/edge/model/ChannelRequestBase.java | 168 -----
.../demo/edge/model/ResultWithInstance.java | 78 ---
.../demo/edge/model/AppClientDataRsp.java | 35 +
.../demo/edge/model/ChannelRequestBase.java | 168 +++++
.../demo/edge/model/ResultWithInstance.java | 78 +++
demo/demo-edge/pom.xml | 4 +-
demo/demo-jaxrs/jaxrs-client/pom.xml | 2 +-
.../jaxrs/client/CodeFirstRestTemplateJaxrs.java | 38 -
.../client/CustomLoadbalanceExtensionsFactory.java | 58 --
.../servicecomb/demo/jaxrs/client/JaxrsClient.java | 151 ----
.../jaxrs/client/CodeFirstRestTemplateJaxrs.java | 37 +
.../client/CustomLoadbalanceExtensionsFactory.java | 58 ++
.../servicecomb/demo/jaxrs/client/JaxrsClient.java | 150 ++++
demo/demo-jaxrs/jaxrs-server/pom.xml | 2 +-
.../demo/jaxrs/server/CodeFirstJaxrs.java | 212 ------
.../servicecomb/demo/jaxrs/server/ComputeImpl.java | 126 ----
.../servicecomb/demo/jaxrs/server/JaxrsServer.java | 28 -
.../demo/jaxrs/server/CodeFirstJaxrs.java | 213 ++++++
.../servicecomb/demo/jaxrs/server/ComputeImpl.java | 125 ++++
.../servicecomb/demo/jaxrs/server/JaxrsServer.java | 28 +
demo/demo-local/pom.xml | 2 +-
.../java/io/servicecomb/demo/local/DemoLocal.java | 31 -
.../apache/servicecomb/demo/local/DemoLocal.java | 31 +
demo/demo-multiple/a-client/pom.xml | 24 +-
.../demo/multiple/a/client/AClient.java | 34 -
.../demo/multiple/a/client/AClientMain.java | 34 -
.../servicecomb/demo/multiple/a/client/AIntf.java | 22 -
.../demo/multiple/a/client/AClient.java | 33 +
.../demo/multiple/a/client/AClientMain.java | 34 +
.../servicecomb/demo/multiple/a/client/AIntf.java | 22 +
demo/demo-multiple/a-server/pom.xml | 24 +-
.../servicecomb/demo/multiple/a/server/AImpl.java | 27 -
.../demo/multiple/a/server/AServerMain.java | 28 -
.../servicecomb/demo/multiple/a/server/AImpl.java | 27 +
.../demo/multiple/a/server/AServerMain.java | 28 +
demo/demo-multiple/b-client/pom.xml | 24 +-
.../demo/multiple/b/client/BClient.java | 34 -
.../demo/multiple/b/client/BClientMain.java | 34 -
.../servicecomb/demo/multiple/b/client/BIntf.java | 22 -
.../demo/multiple/b/client/BClient.java | 33 +
.../demo/multiple/b/client/BClientMain.java | 34 +
.../servicecomb/demo/multiple/b/client/BIntf.java | 22 +
demo/demo-multiple/b-server/pom.xml | 24 +-
.../servicecomb/demo/multiple/b/server/BImpl.java | 27 -
.../demo/multiple/b/server/BServerMain.java | 28 -
.../servicecomb/demo/multiple/b/server/BImpl.java | 27 +
.../demo/multiple/b/server/BServerMain.java | 28 +
demo/demo-multiple/multiple-client/pom.xml | 2 +-
.../demo/multiple/client/MultipleClient.java | 38 -
.../demo/multiple/client/MultipleClient.java | 38 +
demo/demo-multiple/multiple-server/pom.xml | 2 +-
.../demo/multiple/server/MultipleServer.java | 27 -
.../demo/multiple/server/MultipleServer.java | 27 +
demo/demo-pojo/pojo-client/pom.xml | 2 +-
.../servicecomb/demo/pojo/client/BeanRpcTest.java | 54 --
.../demo/pojo/client/CodeFirstPojoClient.java | 189 -----
.../demo/pojo/client/CodeFirstPojoClientIntf.java | 29 -
.../servicecomb/demo/pojo/client/PojoClient.java | 251 -------
.../servicecomb/demo/pojo/client/BeanRpcTest.java | 54 ++
.../demo/pojo/client/CodeFirstPojoClient.java | 189 +++++
.../demo/pojo/client/CodeFirstPojoClientIntf.java | 30 +
.../servicecomb/demo/pojo/client/PojoClient.java | 250 +++++++
.../resources/META-INF/spring/pojo.client.bean.xml | 12 +-
.../test/java/io/servicecomb/demo/pojo/PojoIT.java | 42 --
.../org/apache/servicecomb/demo/pojo/PojoIT.java | 41 ++
demo/demo-pojo/pojo-server/pom.xml | 2 +-
.../demo/pojo/server/CodeFirstPojo.java | 108 ---
.../io/servicecomb/demo/pojo/server/HelloImpl.java | 38 -
.../servicecomb/demo/pojo/server/PojoServer.java | 28 -
.../demo/pojo/server/SmartCareImpl.java | 57 --
.../io/servicecomb/demo/pojo/server/TestImpl.java | 108 ---
.../demo/pojo/server/CodeFirstPojo.java | 109 +++
.../servicecomb/demo/pojo/server/HelloImpl.java | 38 +
.../servicecomb/demo/pojo/server/PojoServer.java | 28 +
.../demo/pojo/server/SmartCareImpl.java | 56 ++
.../servicecomb/demo/pojo/server/TestImpl.java | 108 +++
.../resources/META-INF/spring/pojo.server.bean.xml | 4 +-
.../integration/PojoReferenceIntegrationTest.java | 41 --
.../demo/integration/SomePojoService.java | 37 -
.../demo/integration/SomePojoTestMain.java | 41 --
.../integration/PojoReferenceIntegrationTest.java | 41 ++
.../demo/integration/SomePojoService.java | 36 +
.../demo/integration/SomePojoTestMain.java | 40 ++
.../io/servicecomb/demo/CodeFirstPojoIntf.java | 49 --
.../io/servicecomb/demo/CodeFirstRestTemplate.java | 274 --------
.../main/java/io/servicecomb/demo/DemoConst.java | 24 -
.../java/io/servicecomb/demo/DemoSSLCustom.java | 39 --
.../src/main/java/io/servicecomb/demo/TestMgr.java | 81 ---
.../java/io/servicecomb/demo/compute/Compute.java | 41 --
.../java/io/servicecomb/demo/compute/Person.java | 42 --
.../io/servicecomb/demo/controller/Controller.java | 30 -
.../io/servicecomb/demo/controller/Person.java | 35 -
.../servicecomb/demo/helloworld/greeter/Hello.java | 24 -
.../servicecomb/demo/ignore/IgnoreInterface.java | 22 -
.../demo/ignore/InputModelForTestIgnore.java | 87 ---
.../demo/ignore/OutputModelForTestIgnore.java | 132 ----
.../main/java/io/servicecomb/demo/server/Test.java | 38 -
.../io/servicecomb/demo/server/TestRequest.java | 63 --
.../io/servicecomb/demo/server/TestResponse.java | 35 -
.../main/java/io/servicecomb/demo/server/User.java | 65 --
.../io/servicecomb/demo/smartcare/Application.java | 98 ---
.../java/io/servicecomb/demo/smartcare/Group.java | 50 --
.../io/servicecomb/demo/smartcare/Response.java | 45 --
.../io/servicecomb/demo/smartcare/SmartCare.java | 25 -
.../io/servicecomb/demo/tccserver/TestTcc.java | 27 -
.../apache/servicecomb/demo/CodeFirstPojoIntf.java | 49 ++
.../servicecomb/demo/CodeFirstRestTemplate.java | 274 ++++++++
.../org/apache/servicecomb/demo/DemoConst.java | 24 +
.../org/apache/servicecomb/demo/DemoSSLCustom.java | 39 ++
.../java/org/apache/servicecomb/demo/TestMgr.java | 81 +++
.../apache/servicecomb/demo/compute/Compute.java | 41 ++
.../apache/servicecomb/demo/compute/Person.java | 42 ++
.../servicecomb/demo/controller/Controller.java | 30 +
.../apache/servicecomb/demo/controller/Person.java | 35 +
.../servicecomb/demo/helloworld/greeter/Hello.java | 24 +
.../servicecomb/demo/ignore/IgnoreInterface.java | 22 +
.../demo/ignore/InputModelForTestIgnore.java | 87 +++
.../demo/ignore/OutputModelForTestIgnore.java | 132 ++++
.../org/apache/servicecomb/demo/server/Test.java | 38 +
.../servicecomb/demo/server/TestRequest.java | 63 ++
.../servicecomb/demo/server/TestResponse.java | 35 +
.../org/apache/servicecomb/demo/server/User.java | 65 ++
.../servicecomb/demo/smartcare/Application.java | 98 +++
.../apache/servicecomb/demo/smartcare/Group.java | 50 ++
.../servicecomb/demo/smartcare/Response.java | 45 ++
.../servicecomb/demo/smartcare/SmartCare.java | 25 +
.../apache/servicecomb/demo/tccserver/TestTcc.java | 27 +
.../resources/microservices/jaxrs/compute.yaml | 2 +-
.../microservices/pojo/helloworld.Greeter.yaml | 2 +-
.../main/resources/microservices/pojo/server.yaml | 4 +-
.../resources/microservices/pojo/smartcare.yaml | 4 +-
.../resources/microservices/pojo/tcc-server.yaml | 4 +-
.../microservices/springmvc/controller.yaml | 2 +-
.../src/main/webapp/WEB-INF/web.xml | 22 +-
.../demo/signature/ClientSignature.java | 59 --
.../demo/signature/ServerSignature.java | 66 --
.../servicecomb/demo/signature/SignatureUtils.java | 74 --
.../demo/signature/ClientSignature.java | 58 ++
.../demo/signature/ServerSignature.java | 65 ++
.../servicecomb/demo/signature/SignatureUtils.java | 74 ++
...servicecomb.common.rest.filter.HttpClientFilter | 18 -
...servicecomb.common.rest.filter.HttpServerFilter | 18 -
...servicecomb.common.rest.filter.HttpClientFilter | 18 +
...servicecomb.common.rest.filter.HttpServerFilter | 18 +
.../demo/discovery/client/DiscoveryClientIT.java | 73 --
.../demo/discovery/client/DiscoveryClientIT.java | 72 ++
.../demo-spring-boot-discovery-server/pom.xml | 2 +-
.../demo/discovery/server/DiscoveryServer.java | 31 -
.../demo/discovery/server/GreetingController.java | 38 -
.../demo/discovery/server/DiscoveryServer.java | 30 +
.../demo/discovery/server/GreetingController.java | 37 +
.../src/main/resources/log4j.properties | 2 +-
.../demo-spring-boot-zuul-proxy/pom.xml | 2 +-
.../demo/discovery/zuul/DiscoveryZuulProxyIT.java | 63 --
.../demo/discovery/zuul/DiscoveryZuulProxyIT.java | 62 ++
.../springboot/jaxrs/client/JaxrsClient.java | 38 -
.../springboot/jaxrs/client/JaxrsClient.java | 37 +
.../springboot/jaxrs/SpringBootJaxrsIT.java | 42 --
.../springboot/jaxrs/SpringBootJaxrsIT.java | 41 ++
.../demo-spring-boot-jaxrs-server/pom.xml | 2 +-
.../springboot/jaxrs/server/JaxrsServer.java | 33 -
.../springboot/jaxrs/server/JaxrsServer.java | 32 +
.../springmvc/client/SpringmvcClient.java | 44 --
.../springmvc/client/SpringmvcClient.java | 43 ++
.../springmvc/server/SpringmvcServer.java | 34 -
.../springmvc/server/SpringmvcServer.java | 33 +
.../demo-spring-boot-pojo-client/pom.xml | 2 +-
.../main/java/io/servicecomb/demo/DemoConst.java | 24 -
.../src/main/java/io/servicecomb/demo/TestMgr.java | 65 --
.../demo/pojo/client/PojoClientTest.java | 150 ----
.../main/java/io/servicecomb/demo/server/Test.java | 34 -
.../io/servicecomb/demo/server/TestRequest.java | 63 --
.../io/servicecomb/demo/server/TestResponse.java | 35 -
.../main/java/io/servicecomb/demo/server/User.java | 65 --
.../springboot/pojo/client/PojoClient.java | 41 --
.../org/apache/servicecomb/demo/DemoConst.java | 24 +
.../java/org/apache/servicecomb/demo/TestMgr.java | 65 ++
.../demo/pojo/client/PojoClientTest.java | 149 ++++
.../org/apache/servicecomb/demo/server/Test.java | 34 +
.../servicecomb/demo/server/TestRequest.java | 63 ++
.../servicecomb/demo/server/TestResponse.java | 35 +
.../org/apache/servicecomb/demo/server/User.java | 65 ++
.../springboot/pojo/client/PojoClient.java | 40 ++
.../resources/META-INF/spring/pojo.client.bean.xml | 4 +-
.../springboot/pojo/client/PojoClientIT.java | 42 --
.../springboot/pojo/client/PojoClientIT.java | 41 ++
.../demo-spring-boot-pojo-server/pom.xml | 2 +-
.../servicecomb/demo/helloworld/greeter/Hello.java | 24 -
.../io/servicecomb/demo/pojo/server/HelloImpl.java | 40 --
.../io/servicecomb/demo/pojo/server/TestImpl.java | 96 ---
.../main/java/io/servicecomb/demo/server/Test.java | 34 -
.../io/servicecomb/demo/server/TestRequest.java | 63 --
.../io/servicecomb/demo/server/TestResponse.java | 35 -
.../main/java/io/servicecomb/demo/server/User.java | 65 --
.../java/io/servicecomb/handler/MyHandler.java | 48 --
.../springboot/pojo/server/PojoServer.java | 34 -
.../servicecomb/demo/helloworld/greeter/Hello.java | 24 +
.../servicecomb/demo/pojo/server/HelloImpl.java | 40 ++
.../servicecomb/demo/pojo/server/TestImpl.java | 96 +++
.../org/apache/servicecomb/demo/server/Test.java | 34 +
.../servicecomb/demo/server/TestRequest.java | 63 ++
.../servicecomb/demo/server/TestResponse.java | 35 +
.../org/apache/servicecomb/demo/server/User.java | 65 ++
.../org/apache/servicecomb/handler/MyHandler.java | 47 ++
.../springboot/pojo/server/PojoServer.java | 33 +
.../src/main/resources/config/cse.handler.xml | 2 +-
.../microservices/pojo/helloworld.Greeter.yaml | 2 +-
.../main/resources/microservices/pojo/server.yaml | 4 +-
.../resources/microservices/pojo/smartcare.yaml | 4 +-
.../resources/microservices/pojo/tcc-server.yaml | 4 +-
demo/demo-springmvc/springmvc-client/pom.xml | 2 +-
.../client/CodeFirstRestTemplateSpringmvc.java | 226 ------
.../springmvc/client/CodeFirstSprigmvcIntf.java | 29 -
.../demo/springmvc/client/MicroserviceArray.java | 34 -
.../springmvc/client/MockedFallbackExample.java | 38 -
.../springmvc/client/ServiceCenterExample.java | 55 --
.../demo/springmvc/client/SpringmvcClient.java | 226 ------
.../client/CodeFirstRestTemplateSpringmvc.java | 225 ++++++
.../springmvc/client/CodeFirstSprigmvcIntf.java | 28 +
.../demo/springmvc/client/MicroserviceArray.java | 34 +
.../springmvc/client/MockedFallbackExample.java | 37 +
.../springmvc/client/ServiceCenterExample.java | 55 ++
.../demo/springmvc/client/SpringmvcClient.java | 225 ++++++
.../META-INF/spring/springmvc.client.bean.xml | 6 +-
.../src/main/resources/microservice.yaml | 4 +-
.../io/servicecomb/demo/springmvc/SpringMvcIT.java | 42 --
.../servicecomb/demo/springmvc/SpringMvcIT.java | 41 ++
demo/demo-springmvc/springmvc-server/pom.xml | 2 +-
.../demo/springmvc/server/CodeFirstSpringmvc.java | 367 ----------
.../demo/springmvc/server/ControllerImpl.java | 72 --
.../demo/springmvc/server/SpringmvcServer.java | 28 -
.../demo/springmvc/server/TemplateResponse.java | 31 -
.../demo/springmvc/server/CodeFirstSpringmvc.java | 367 ++++++++++
.../demo/springmvc/server/ControllerImpl.java | 71 ++
.../demo/springmvc/server/SpringmvcServer.java | 28 +
.../demo/springmvc/server/TemplateResponse.java | 31 +
.../src/main/resources/microservice.yaml | 4 +-
demo/perf/pom.xml | 2 +-
.../main/java/io/servicecomb/demo/perf/Impl.java | 74 --
.../main/java/io/servicecomb/demo/perf/Intf.java | 26 -
.../servicecomb/demo/perf/PerfConfiguration.java | 134 ----
.../io/servicecomb/demo/perf/PerfConsumer.java | 102 ---
.../java/io/servicecomb/demo/perf/PerfMain.java | 49 --
.../demo/perf/PerfMetricsFilePublisher.java | 82 ---
.../io/servicecomb/demo/perf/RedisClientUtils.java | 73 --
.../io/servicecomb/demo/perf/RedisSession.java | 73 --
.../org/apache/servicecomb/demo/perf/Impl.java | 73 ++
.../org/apache/servicecomb/demo/perf/Intf.java | 26 +
.../servicecomb/demo/perf/PerfConfiguration.java | 134 ++++
.../apache/servicecomb/demo/perf/PerfConsumer.java | 101 +++
.../org/apache/servicecomb/demo/perf/PerfMain.java | 49 ++
.../demo/perf/PerfMetricsFilePublisher.java | 81 +++
.../servicecomb/demo/perf/RedisClientUtils.java | 74 ++
.../apache/servicecomb/demo/perf/RedisSession.java | 73 ++
dynamic-config/config-apollo/pom.xml | 3 +-
.../sources/ApolloConfigurationSourceImpl.java | 129 ----
.../io/servicecomb/config/client/ApolloClient.java | 169 -----
.../io/servicecomb/config/client/ApolloConfig.java | 89 ---
.../config/client/ConfigurationAction.java | 24 -
.../sources/ApolloConfigurationSourceImpl.java | 129 ++++
.../servicecomb/config/client/ApolloClient.java | 170 +++++
.../servicecomb/config/client/ApolloConfig.java | 89 +++
.../config/client/ConfigurationAction.java | 24 +
...comb.config.spi.ConfigCenterConfigurationSource | 18 -
...comb.config.spi.ConfigCenterConfigurationSource | 18 +
.../sources/ApolloConfigurationSourceImplTest.java | 80 ---
.../config/client/ApolloClientTest.java | 115 ----
.../config/client/ApolloConfigTest.java | 44 --
.../sources/ApolloConfigurationSourceImplTest.java | 80 +++
.../config/client/ApolloClientTest.java | 115 ++++
.../config/client/ApolloConfigTest.java | 43 ++
.../edge/core/AbstractEdgeDispatcher.java | 39 --
.../edge/core/CompatiblePathVersionMapper.java | 66 --
.../io/servicecomb/edge/core/EdgeBootListener.java | 53 --
.../io/servicecomb/edge/core/EdgeInvocation.java | 125 ----
.../core/OperationInstancesDiscoveryFilter.java | 123 ----
.../edge/core/AbstractEdgeDispatcher.java | 39 ++
.../edge/core/CompatiblePathVersionMapper.java | 65 ++
.../servicecomb/edge/core/EdgeBootListener.java | 52 ++
.../servicecomb/edge/core/EdgeInvocation.java | 126 ++++
.../core/OperationInstancesDiscoveryFilter.java | 123 ++++
...ecomb.serviceregistry.discovery.DiscoveryFilter | 18 -
...ecomb.serviceregistry.discovery.DiscoveryFilter | 18 +
.../edge-core/src/main/resources/microservice.yaml | 2 +-
.../edge/core/TestAbstractEdgeDispatcher.java | 79 ---
.../edge/core/TestCompatiblePathVersionMapper.java | 88 ---
.../edge/core/TestEdgeBootListener.java | 78 ---
.../servicecomb/edge/core/TestEdgeInvocation.java | 220 ------
.../TestOperationInstancesDiscoveryFilter.java | 269 --------
.../edge/core/TestAbstractEdgeDispatcher.java | 79 +++
.../edge/core/TestCompatiblePathVersionMapper.java | 87 +++
.../edge/core/TestEdgeBootListener.java | 77 +++
.../servicecomb/edge/core/TestEdgeInvocation.java | 220 ++++++
.../TestOperationInstancesDiscoveryFilter.java | 269 ++++++++
.../foundation/auth/AuthHeaderProvider.java | 31 -
.../servicecomb/foundation/auth/SignRequest.java | 199 ------
.../foundation/common/AbstractObjectManager.java | 73 --
.../foundation/common/CommonThread.java | 43 --
.../foundation/common/NamedThreadFactory.java | 56 --
.../foundation/common/RegisterManager.java | 89 ---
.../common/base/DescriptiveRunnable.java | 23 -
.../common/base/ServiceCombConstants.java | 66 --
.../foundation/common/cache/VersionedCache.java | 135 ----
.../common/concurrent/ConcurrentHashMapEx.java | 58 --
.../foundation/common/config/ConfigLoader.java | 23 -
.../foundation/common/config/ConfigMgr.java | 102 ---
.../config/PaaSPropertyPlaceholderConfigurer.java | 45 --
.../common/config/PaaSResourceUtils.java | 164 -----
.../common/config/impl/AbstractLoader.java | 34 -
.../foundation/common/config/impl/IdXmlLoader.java | 53 --
.../foundation/common/config/impl/IncConfigs.java | 88 ---
.../config/impl/PaaSPropertiesLoaderUtils.java | 70 --
.../common/config/impl/PropertiesLoader.java | 51 --
.../foundation/common/config/impl/XmlLoader.java | 88 ---
.../common/config/impl/XmlLoaderUtils.java | 87 ---
.../servicecomb/foundation/common/event/Event.java | 22 -
.../foundation/common/event/EventBus.java | 49 --
.../foundation/common/event/EventListener.java | 28 -
.../foundation/common/event/EventManager.java | 49 --
.../common/exceptions/ServiceCombException.java | 30 -
.../foundation/common/http/HttpStatus.java | 55 --
.../foundation/common/http/HttpStatusManager.java | 57 --
.../foundation/common/http/HttpStatusUtils.java | 31 -
.../servicecomb/foundation/common/net/IpPort.java | 90 ---
.../foundation/common/net/NetUtils.java | 205 ------
.../foundation/common/net/URIEndpointObject.java | 81 ---
.../foundation/common/part/AbstractPart.java | 105 ---
.../foundation/common/part/FilePart.java | 54 --
.../foundation/common/part/InputStreamPart.java | 28 -
.../foundation/common/part/ResourcePart.java | 38 -
.../common/spring/PaasNamespaceHandler.java | 66 --
.../foundation/common/utils/BeanUtils.java | 63 --
.../foundation/common/utils/EventUtils.java | 38 -
.../foundation/common/utils/FilePerm.java | 226 ------
.../foundation/common/utils/FortifyUtils.java | 109 ---
.../foundation/common/utils/JsonUtils.java | 82 ---
.../foundation/common/utils/Log4jUtils.java | 127 ----
.../foundation/common/utils/RSAKeyPairEntry.java | 48 --
.../foundation/common/utils/RSAUtils.java | 114 ---
.../foundation/common/utils/ReflectUtils.java | 65 --
.../common/utils/RollingFileAppenderExt.java | 81 ---
.../foundation/common/utils/SPIServiceUtils.java | 90 ---
.../foundation/token/RSAKeypair4Auth.java | 69 --
.../foundation/auth/AuthHeaderProvider.java | 31 +
.../servicecomb/foundation/auth/SignRequest.java | 199 ++++++
.../foundation/common/AbstractObjectManager.java | 73 ++
.../foundation/common/CommonThread.java | 43 ++
.../foundation/common/NamedThreadFactory.java | 56 ++
.../foundation/common/RegisterManager.java | 89 +++
.../common/base/DescriptiveRunnable.java | 23 +
.../common/base/ServiceCombConstants.java | 66 ++
.../foundation/common/cache/VersionedCache.java | 135 ++++
.../common/concurrent/ConcurrentHashMapEx.java | 58 ++
.../foundation/common/config/ConfigLoader.java | 23 +
.../foundation/common/config/ConfigMgr.java | 101 +++
.../config/PaaSPropertyPlaceholderConfigurer.java | 45 ++
.../common/config/PaaSResourceUtils.java | 163 +++++
.../common/config/impl/AbstractLoader.java | 34 +
.../foundation/common/config/impl/IdXmlLoader.java | 53 ++
.../foundation/common/config/impl/IncConfigs.java | 88 +++
.../config/impl/PaaSPropertiesLoaderUtils.java | 69 ++
.../common/config/impl/PropertiesLoader.java | 50 ++
.../foundation/common/config/impl/XmlLoader.java | 87 +++
.../common/config/impl/XmlLoaderUtils.java | 86 +++
.../servicecomb/foundation/common/event/Event.java | 22 +
.../foundation/common/event/EventBus.java | 49 ++
.../foundation/common/event/EventListener.java | 28 +
.../foundation/common/event/EventManager.java | 49 ++
.../common/exceptions/ServiceCombException.java | 30 +
.../foundation/common/http/HttpStatus.java | 55 ++
.../foundation/common/http/HttpStatusManager.java | 57 ++
.../foundation/common/http/HttpStatusUtils.java | 31 +
.../servicecomb/foundation/common/net/IpPort.java | 90 +++
.../foundation/common/net/NetUtils.java | 205 ++++++
.../foundation/common/net/URIEndpointObject.java | 81 +++
.../foundation/common/part/AbstractPart.java | 105 +++
.../foundation/common/part/FilePart.java | 54 ++
.../foundation/common/part/InputStreamPart.java | 28 +
.../foundation/common/part/ResourcePart.java | 38 +
.../common/spring/PaasNamespaceHandler.java | 65 ++
.../foundation/common/utils/BeanUtils.java | 63 ++
.../foundation/common/utils/EventUtils.java | 38 +
.../foundation/common/utils/FilePerm.java | 226 ++++++
.../foundation/common/utils/FortifyUtils.java | 109 +++
.../foundation/common/utils/JsonUtils.java | 82 +++
.../foundation/common/utils/Log4jUtils.java | 126 ++++
.../foundation/common/utils/RSAKeyPairEntry.java | 48 ++
.../foundation/common/utils/RSAUtils.java | 113 +++
.../foundation/common/utils/ReflectUtils.java | 65 ++
.../common/utils/RollingFileAppenderExt.java | 81 +++
.../foundation/common/utils/SPIServiceUtils.java | 93 +++
.../foundation/token/RSAKeypair4Auth.java | 69 ++
.../main/resources/config/base/log4j.properties | 2 +-
.../common/cache/TestVersionedCache.java | 128 ----
.../foundation/common/config/BeanProp.java | 35 -
.../foundation/common/config/TestConfig.java | 188 -----
.../foundation/common/event/TestEventBus.java | 64 --
.../foundation/common/event/TestEventManager.java | 51 --
.../foundation/common/http/TestHttpStatus.java | 57 --
.../common/http/TestHttpStatusUtils.java | 55 --
.../foundation/common/net/TestIpPort.java | 38 -
.../foundation/common/net/TestNetUtils.java | 106 ---
.../common/net/TestURIEndpointObject.java | 69 --
.../foundation/common/part/TestAbstractPart.java | 138 ----
.../foundation/common/part/TestFilePart.java | 76 --
.../common/part/TestInputStreamPart.java | 49 --
.../foundation/common/part/TestResourcePart.java | 50 --
.../common/spring/TestPaasNamespaceHandler.java | 49 --
.../foundation/common/utils/SPIServiceDef.java | 22 -
.../foundation/common/utils/SPIServiceDef0.java | 22 -
.../foundation/common/utils/SPIServiceDefImpl.java | 22 -
.../foundation/common/utils/TestBeanUtils.java | 48 --
.../foundation/common/utils/TestFortifyUtils.java | 79 ---
.../foundation/common/utils/TestRSAUtil.java | 56 --
.../common/utils/TestRollingFileAppenderExt.java | 61 --
.../common/utils/TestSPIServiceUtils.java | 73 --
.../common/cache/TestVersionedCache.java | 128 ++++
.../foundation/common/config/BeanProp.java | 35 +
.../foundation/common/config/TestConfig.java | 187 +++++
.../foundation/common/event/TestEventBus.java | 63 ++
.../foundation/common/event/TestEventManager.java | 51 ++
.../foundation/common/http/TestHttpStatus.java | 57 ++
.../common/http/TestHttpStatusUtils.java | 55 ++
.../foundation/common/net/TestIpPort.java | 38 +
.../foundation/common/net/TestNetUtils.java | 106 +++
.../common/net/TestURIEndpointObject.java | 69 ++
.../foundation/common/part/TestAbstractPart.java | 138 ++++
.../foundation/common/part/TestFilePart.java | 76 ++
.../common/part/TestInputStreamPart.java | 49 ++
.../foundation/common/part/TestResourcePart.java | 50 ++
.../common/spring/TestPaasNamespaceHandler.java | 49 ++
.../foundation/common/utils/SPIServiceDef.java | 22 +
.../foundation/common/utils/SPIServiceDef0.java | 22 +
.../foundation/common/utils/SPIServiceDefImpl.java | 22 +
.../foundation/common/utils/TestBeanUtils.java | 48 ++
.../foundation/common/utils/TestFortifyUtils.java | 79 +++
.../foundation/common/utils/TestRSAUtil.java | 56 ++
.../common/utils/TestRollingFileAppenderExt.java | 61 ++
.../common/utils/TestSPIServiceUtils.java | 73 ++
...rvicecomb.foundation.common.utils.SPIServiceDef | 19 -
...rvicecomb.foundation.common.utils.SPIServiceDef | 18 +
.../test/resources/META-INF/spring/config.bean.xml | 4 +-
.../test/resources/config/config.test.1.inc.xml | 2 +-
.../ConfigCenterConfigurationSourceImpl.java | 128 ----
.../config/client/ConfigCenterClient.java | 360 ----------
.../config/client/ConfigCenterConfig.java | 154 -----
.../servicecomb/config/client/MemberDiscovery.java | 65 --
.../config/client/ParseConfigUtils.java | 116 ----
.../io/servicecomb/config/client/URIConst.java | 58 --
.../ConfigCenterConfigurationSourceImpl.java | 127 ++++
.../config/client/ConfigCenterClient.java | 360 ++++++++++
.../config/client/ConfigCenterConfig.java | 154 +++++
.../servicecomb/config/client/MemberDiscovery.java | 65 ++
.../config/client/ParseConfigUtils.java | 115 ++++
.../apache/servicecomb/config/client/URIConst.java | 58 ++
...comb.config.spi.ConfigCenterConfigurationSource | 18 -
...comb.config.spi.ConfigCenterConfigurationSource | 18 +
.../TestConfigCenterConfigurationSource.java | 94 ---
.../config/client/TestConfigCenterClient.java | 167 -----
.../config/client/TestConfigCenterConfig.java | 40 --
.../config/client/TestMemberDiscovery.java | 56 --
.../config/client/TestParseConfigUtils.java | 83 ---
.../io/servicecomb/config/client/TestURIConst.java | 38 -
.../TestConfigCenterConfigurationSource.java | 94 +++
.../config/client/TestConfigCenterClient.java | 171 +++++
.../config/client/TestConfigCenterConfig.java | 39 ++
.../config/client/TestMemberDiscovery.java | 56 ++
.../config/client/TestParseConfigUtils.java | 83 +++
.../servicecomb/config/client/TestURIConst.java | 38 +
.../java/io/servicecomb/config/ConfigMapping.java | 64 --
.../java/io/servicecomb/config/ConfigUtil.java | 238 -------
.../config/ConfigurationSpringInitializer.java | 60 --
.../io/servicecomb/config/DynamicProperties.java | 77 ---
.../servicecomb/config/DynamicPropertiesImpl.java | 125 ----
.../config/LastPropertyPlaceholderConfigurer.java | 41 --
.../main/java/io/servicecomb/config/YAMLUtil.java | 57 --
.../scheduler/NeverStartPollingScheduler.java | 35 -
.../archaius/sources/AbstractConfigLoader.java | 141 ----
.../config/archaius/sources/ConfigModel.java | 53 --
.../config/archaius/sources/ConfigSourceMaker.java | 28 -
.../archaius/sources/MicroserviceConfigLoader.java | 79 ---
.../sources/MicroserviceConfigurationSource.java | 51 --
.../config/archaius/sources/YAMLConfigLoader.java | 37 -
.../spi/ConfigCenterConfigurationSource.java | 26 -
.../apache/servicecomb/config/ConfigMapping.java | 64 ++
.../org/apache/servicecomb/config/ConfigUtil.java | 237 +++++++
.../config/ConfigurationSpringInitializer.java | 60 ++
.../servicecomb/config/DynamicProperties.java | 77 +++
.../servicecomb/config/DynamicPropertiesImpl.java | 125 ++++
.../config/LastPropertyPlaceholderConfigurer.java | 41 ++
.../org/apache/servicecomb/config/YAMLUtil.java | 57 ++
.../scheduler/NeverStartPollingScheduler.java | 35 +
.../archaius/sources/AbstractConfigLoader.java | 141 ++++
.../config/archaius/sources/ConfigModel.java | 53 ++
.../config/archaius/sources/ConfigSourceMaker.java | 28 +
.../archaius/sources/MicroserviceConfigLoader.java | 78 +++
.../sources/MicroserviceConfigurationSource.java | 51 ++
.../config/archaius/sources/YAMLConfigLoader.java | 37 +
.../spi/ConfigCenterConfigurationSource.java | 26 +
.../main/resources/META-INF/spring/cse.bean.xml | 4 +-
.../servicecomb/config/DynamicPropertiesTest.java | 203 ------
.../config/MapBasedConfigurationSource.java | 96 ---
.../io/servicecomb/config/TestConfigMapping.java | 47 --
.../java/io/servicecomb/config/TestConfigUtil.java | 321 ---------
.../config/TestConfigurationSpringInitializer.java | 68 --
.../TestLastPropertyPlaceholderConfigurer.java | 69 --
.../sources/TestMicroserviceConfigLoader.java | 105 ---
.../sources/TestYAMLConfigurationSource.java | 97 ---
.../servicecomb/config/DynamicPropertiesTest.java | 203 ++++++
.../config/MapBasedConfigurationSource.java | 95 +++
.../servicecomb/config/TestConfigMapping.java | 47 ++
.../apache/servicecomb/config/TestConfigUtil.java | 321 +++++++++
.../config/TestConfigurationSpringInitializer.java | 68 ++
.../TestLastPropertyPlaceholderConfigurer.java | 69 ++
.../sources/TestMicroserviceConfigLoader.java | 105 +++
.../sources/TestYAMLConfigurationSource.java | 96 +++
...comb.config.spi.ConfigCenterConfigurationSource | 19 -
...comb.config.spi.ConfigCenterConfigurationSource | 18 +
.../io/servicecomb/foundation/metrics/Metrics.java | 81 ---
.../foundation/metrics/MetricsConfig.java | 46 --
.../foundation/metrics/MetricsServoRegistry.java | 572 ----------------
.../foundation/metrics/MetricsThread.java | 69 --
.../foundation/metrics/TpsAndLatencyData.java | 51 --
.../metrics/output/MetricsFileOutput.java | 68 --
.../output/servo/FileOutputMetricObserver.java | 54 --
.../output/servo/MetricsContentConvertor.java | 28 -
.../output/servo/MetricsContentFormatter.java | 24 -
.../output/servo/MetricsObserverInitializer.java | 82 ---
.../output/servo/RollingMetricsFileOutput.java | 44 --
.../servo/SimpleMetricsContentConvertor.java | 70 --
.../servo/SimpleMetricsContentFormatter.java | 97 ---
.../metrics/performance/MetricsDataMonitor.java | 240 -------
.../performance/MetricsDataMonitorUtil.java | 57 --
.../foundation/metrics/performance/PerfResult.java | 93 ---
.../foundation/metrics/performance/PerfStat.java | 37 -
.../metrics/performance/PerfStatContext.java | 52 --
.../metrics/performance/PerfStatData.java | 161 -----
.../metrics/performance/PerfStatImpl.java | 91 ---
.../metrics/performance/PerfStatMonitor.java | 91 ---
.../metrics/performance/PerfStatMonitorMgr.java | 83 ---
.../metrics/performance/PerfStatSuccFail.java | 50 --
.../metrics/performance/QueueMetrics.java | 98 ---
.../metrics/performance/QueueMetricsData.java | 215 ------
.../servicecomb/foundation/metrics/Metrics.java | 81 +++
.../foundation/metrics/MetricsConfig.java | 46 ++
.../foundation/metrics/MetricsServoRegistry.java | 576 ++++++++++++++++
.../foundation/metrics/MetricsThread.java | 68 ++
.../foundation/metrics/TpsAndLatencyData.java | 51 ++
.../metrics/output/MetricsFileOutput.java | 70 ++
.../output/servo/FileOutputMetricObserver.java | 56 ++
.../output/servo/MetricsContentConvertor.java | 28 +
.../output/servo/MetricsContentFormatter.java | 24 +
.../output/servo/MetricsObserverInitializer.java | 85 +++
.../output/servo/RollingMetricsFileOutput.java | 43 ++
.../servo/SimpleMetricsContentConvertor.java | 70 ++
.../servo/SimpleMetricsContentFormatter.java | 97 +++
.../metrics/performance/MetricsDataMonitor.java | 240 +++++++
.../performance/MetricsDataMonitorUtil.java | 57 ++
.../foundation/metrics/performance/PerfResult.java | 93 +++
.../foundation/metrics/performance/PerfStat.java | 37 +
.../metrics/performance/PerfStatContext.java | 52 ++
.../metrics/performance/PerfStatData.java | 161 +++++
.../metrics/performance/PerfStatImpl.java | 91 +++
.../metrics/performance/PerfStatMonitor.java | 91 +++
.../metrics/performance/PerfStatMonitorMgr.java | 83 +++
.../metrics/performance/PerfStatSuccFail.java | 50 ++
.../metrics/performance/QueueMetrics.java | 98 +++
.../metrics/performance/QueueMetricsData.java | 215 ++++++
.../resources/META-INF/spring/metrics.bean.xml | 4 +-
...ileOutputMetricObserverAndContentConvertor.java | 132 ----
.../foundation/metrics/TestMetrics.java | 36 -
.../metrics/TestMetricsServoRegistry.java | 221 ------
.../foundation/metrics/TestMetricsThread.java | 47 --
.../metrics/TestSimpleMetricsContentFormatter.java | 42 --
.../performance/TestMetricsDataMonitor.java | 132 ----
.../performance/TestMetricsDataMonitorUtil.java | 62 --
.../metrics/performance/TestPerfResult.java | 70 --
.../metrics/performance/TestPerfStatContext.java | 68 --
.../metrics/performance/TestPerfStatData.java | 83 ---
.../metrics/performance/TestPerfStatImpl.java | 70 --
.../metrics/performance/TestPerfStatMonitor.java | 56 --
.../performance/TestPerfStatMonitorMgr.java | 68 --
.../metrics/performance/TestPerfStatSuccFail.java | 48 --
...ileOutputMetricObserverAndContentConvertor.java | 131 ++++
.../foundation/metrics/TestMetrics.java | 35 +
.../metrics/TestMetricsServoRegistry.java | 220 ++++++
.../foundation/metrics/TestMetricsThread.java | 47 ++
.../metrics/TestSimpleMetricsContentFormatter.java | 41 ++
.../performance/TestMetricsDataMonitor.java | 132 ++++
.../performance/TestMetricsDataMonitorUtil.java | 61 ++
.../metrics/performance/TestPerfResult.java | 70 ++
.../metrics/performance/TestPerfStatContext.java | 68 ++
.../metrics/performance/TestPerfStatData.java | 83 +++
.../metrics/performance/TestPerfStatImpl.java | 70 ++
.../metrics/performance/TestPerfStatMonitor.java | 56 ++
.../performance/TestPerfStatMonitorMgr.java | 68 ++
.../metrics/performance/TestPerfStatSuccFail.java | 48 ++
.../foundation/ssl/CertificateUtil.java | 144 ----
.../servicecomb/foundation/ssl/KeyStoreUtil.java | 117 ----
.../io/servicecomb/foundation/ssl/SSLCustom.java | 63 --
.../io/servicecomb/foundation/ssl/SSLManager.java | 200 ------
.../io/servicecomb/foundation/ssl/SSLOption.java | 448 ------------
.../foundation/ssl/SSLOptionFactory.java | 43 --
.../foundation/ssl/SSLSocketFactoryExt.java | 93 ---
.../foundation/ssl/TrustAllManager.java | 61 --
.../foundation/ssl/TrustManagerExt.java | 280 --------
.../foundation/ssl/CertificateUtil.java | 144 ++++
.../servicecomb/foundation/ssl/KeyStoreUtil.java | 117 ++++
.../servicecomb/foundation/ssl/SSLCustom.java | 63 ++
.../servicecomb/foundation/ssl/SSLManager.java | 200 ++++++
.../servicecomb/foundation/ssl/SSLOption.java | 448 ++++++++++++
.../foundation/ssl/SSLOptionFactory.java | 43 ++
.../foundation/ssl/SSLSocketFactoryExt.java | 93 +++
.../foundation/ssl/TrustAllManager.java | 61 ++
.../foundation/ssl/TrustManagerExt.java | 280 ++++++++
.../foundation/ssl/CertificateUtilTest.java | 296 --------
.../foundation/ssl/KeyStoreUtilTest.java | 168 -----
.../foundation/ssl/MyOptionFactory.java | 33 -
.../servicecomb/foundation/ssl/SSLManagerTest.java | 438 ------------
.../servicecomb/foundation/ssl/SSLOptionTest.java | 401 -----------
.../foundation/ssl/TestSSLOptionFactory.java | 69 --
.../foundation/ssl/TestSSLSocketFactoryExt.java | 56 --
.../foundation/ssl/TestTrustAllManager.java | 50 --
.../foundation/ssl/TrustManagerExtTest.java | 410 -----------
.../foundation/ssl/CertificateUtilTest.java | 296 ++++++++
.../foundation/ssl/KeyStoreUtilTest.java | 168 +++++
.../foundation/ssl/MyOptionFactory.java | 33 +
.../servicecomb/foundation/ssl/SSLManagerTest.java | 438 ++++++++++++
.../servicecomb/foundation/ssl/SSLOptionTest.java | 401 +++++++++++
.../foundation/ssl/TestSSLOptionFactory.java | 69 ++
.../foundation/ssl/TestSSLSocketFactoryExt.java | 56 ++
.../foundation/ssl/TestTrustAllManager.java | 50 ++
.../foundation/ssl/TrustManagerExtTest.java | 410 +++++++++++
.../test/scaffolding/config/ArchaiusUtils.java | 68 --
.../test/scaffolding/spring/SpringUtils.java | 81 ---
.../web/impl/HttpServerRequestWrapperForTest.java | 2 +-
.../test/scaffolding/config/ArchaiusUtils.java | 68 ++
.../test/scaffolding/spring/SpringUtils.java | 81 +++
.../foundation/vertx/AsyncResultCallback.java | 32 -
.../foundation/vertx/SimpleBodyHandler.java | 52 --
.../foundation/vertx/SimpleJsonObject.java | 39 --
.../foundation/vertx/VertxTLSBuilder.java | 142 ----
.../servicecomb/foundation/vertx/VertxUtils.java | 205 ------
.../foundation/vertx/client/ClientPoolFactory.java | 22 -
.../foundation/vertx/client/ClientPoolManager.java | 119 ----
.../foundation/vertx/client/ClientVerticle.java | 31 -
.../vertx/client/http/HttpClientPoolFactory.java | 41 --
.../vertx/client/http/HttpClientWithContext.java | 50 --
.../tcp/AbstractTcpClientConnectionPool.java | 58 --
.../vertx/client/tcp/AbstractTcpClientPackage.java | 37 -
.../client/tcp/AbstractTcpClientPoolFactory.java | 43 --
.../vertx/client/tcp/NetClientWrapper.java | 61 --
.../vertx/client/tcp/TcpClientConfig.java | 39 --
.../vertx/client/tcp/TcpClientConnection.java | 310 ---------
.../vertx/client/tcp/TcpClientConnectionPool.java | 30 -
.../vertx/client/tcp/TcpClientPackage.java | 32 -
.../vertx/client/tcp/TcpClientPoolFactory.java | 30 -
.../foundation/vertx/client/tcp/TcpData.java | 47 --
.../foundation/vertx/client/tcp/TcpRequest.java | 69 --
.../vertx/client/tcp/TcpResponseCallback.java | 24 -
.../vertx/executor/VertxWorkerExecutor.java | 34 -
.../vertx/http/AbstractHttpServletRequest.java | 393 -----------
.../vertx/http/AbstractHttpServletResponse.java | 219 ------
.../foundation/vertx/http/BodyBufferSupport.java | 31 -
.../vertx/http/BodyBufferSupportImpl.java | 61 --
.../foundation/vertx/http/EmptyAsyncContext.java | 92 ---
.../foundation/vertx/http/FileUploadPart.java | 66 --
.../vertx/http/HttpServletRequestEx.java | 30 -
.../vertx/http/HttpServletResponseEx.java | 25 -
.../vertx/http/StandardHttpServletRequestEx.java | 82 ---
.../vertx/http/StandardHttpServletResponseEx.java | 83 ---
.../VertxClientRequestToHttpServletRequest.java | 73 --
.../VertxClientResponseToHttpServletResponse.java | 71 --
.../VertxServerRequestToHttpServletRequest.java | 240 -------
.../VertxServerResponseToHttpServletResponse.java | 101 ---
.../foundation/vertx/server/TcpBufferHandler.java | 29 -
.../foundation/vertx/server/TcpParser.java | 134 ----
.../foundation/vertx/server/TcpServer.java | 79 ---
.../vertx/server/TcpServerConnection.java | 53 --
.../foundation/vertx/stream/BufferInputStream.java | 130 ----
.../vertx/stream/BufferOutputStream.java | 126 ----
.../vertx/stream/InputStreamToReadStream.java | 190 -----
.../foundation/vertx/tcp/TcpConnection.java | 122 ----
.../servicecomb/foundation/vertx/tcp/TcpConst.java | 24 -
.../foundation/vertx/tcp/TcpOutputStream.java | 47 --
.../foundation/vertx/AsyncResultCallback.java | 32 +
.../foundation/vertx/SimpleBodyHandler.java | 52 ++
.../foundation/vertx/SimpleJsonObject.java | 39 ++
.../foundation/vertx/VertxTLSBuilder.java | 143 ++++
.../servicecomb/foundation/vertx/VertxUtils.java | 205 ++++++
.../foundation/vertx/client/ClientPoolFactory.java | 22 +
.../foundation/vertx/client/ClientPoolManager.java | 120 ++++
.../foundation/vertx/client/ClientVerticle.java | 31 +
.../vertx/client/http/HttpClientPoolFactory.java | 42 ++
.../vertx/client/http/HttpClientWithContext.java | 50 ++
.../tcp/AbstractTcpClientConnectionPool.java | 59 ++
.../vertx/client/tcp/AbstractTcpClientPackage.java | 37 +
.../client/tcp/AbstractTcpClientPoolFactory.java | 44 ++
.../vertx/client/tcp/NetClientWrapper.java | 61 ++
.../vertx/client/tcp/TcpClientConfig.java | 39 ++
.../vertx/client/tcp/TcpClientConnection.java | 310 +++++++++
.../vertx/client/tcp/TcpClientConnectionPool.java | 30 +
.../vertx/client/tcp/TcpClientPackage.java | 32 +
.../vertx/client/tcp/TcpClientPoolFactory.java | 30 +
.../foundation/vertx/client/tcp/TcpData.java | 47 ++
.../foundation/vertx/client/tcp/TcpRequest.java | 69 ++
.../vertx/client/tcp/TcpResponseCallback.java | 24 +
.../vertx/executor/VertxWorkerExecutor.java | 34 +
.../vertx/http/AbstractHttpServletRequest.java | 393 +++++++++++
.../vertx/http/AbstractHttpServletResponse.java | 219 ++++++
.../foundation/vertx/http/BodyBufferSupport.java | 31 +
.../vertx/http/BodyBufferSupportImpl.java | 62 ++
.../foundation/vertx/http/EmptyAsyncContext.java | 92 +++
.../foundation/vertx/http/FileUploadPart.java | 66 ++
.../vertx/http/HttpServletRequestEx.java | 30 +
.../vertx/http/HttpServletResponseEx.java | 25 +
.../vertx/http/StandardHttpServletRequestEx.java | 82 +++
.../vertx/http/StandardHttpServletResponseEx.java | 84 +++
.../VertxClientRequestToHttpServletRequest.java | 73 ++
.../VertxClientResponseToHttpServletResponse.java | 72 ++
.../VertxServerRequestToHttpServletRequest.java | 240 +++++++
.../VertxServerResponseToHttpServletResponse.java | 102 +++
.../foundation/vertx/server/TcpBufferHandler.java | 29 +
.../foundation/vertx/server/TcpParser.java | 134 ++++
.../foundation/vertx/server/TcpServer.java | 80 +++
.../vertx/server/TcpServerConnection.java | 53 ++
.../foundation/vertx/stream/BufferInputStream.java | 130 ++++
.../vertx/stream/BufferOutputStream.java | 126 ++++
.../vertx/stream/InputStreamToReadStream.java | 190 +++++
.../foundation/vertx/tcp/TcpConnection.java | 122 ++++
.../servicecomb/foundation/vertx/tcp/TcpConst.java | 24 +
.../foundation/vertx/tcp/TcpOutputStream.java | 47 ++
.../main/resources/META-INF/spring/cse.bean.xml | 2 +-
.../foundation/vertx/TestSimpleBodyHandler.java | 77 ---
.../foundation/vertx/TestSimpleJsonObject.java | 37 -
.../servicecomb/foundation/vertx/TestStream.java | 57 --
.../foundation/vertx/TestVertxTLSBuilder.java | 187 -----
.../foundation/vertx/TestVertxUtils.java | 121 ----
.../vertx/client/TestClientPoolManager.java | 195 ------
.../vertx/client/TestClientVerticle.java | 61 --
.../client/http/TestHttpClientPoolFactory.java | 52 --
.../tcp/TestAbstractTcpClientPoolFactory.java | 50 --
.../vertx/client/tcp/TestNetClientWrapper.java | 107 ---
.../vertx/client/tcp/TestTcpClientConfig.java | 32 -
.../vertx/client/tcp/TestTcpClientConnection.java | 249 -------
.../client/tcp/TestTcpClientConnectionPool.java | 45 --
.../vertx/http/TestAbstractHttpServletRequest.java | 516 --------------
.../http/TestAbstractHttpServletResponse.java | 307 ---------
.../vertx/http/TestBodyBufferSupportImpl.java | 74 --
.../foundation/vertx/http/TestFileUploadPart.java | 139 ----
.../http/TestStandardHttpServletRequestEx.java | 81 ---
.../http/TestStandardHttpServletResponseEx.java | 117 ----
...TestVertxClientRequestToHttpServletRequest.java | 147 ----
...stVertxClientResponseToHttpServletResponse.java | 129 ----
...TestVertxServerRequestToHttpServletRequest.java | 430 ------------
...stVertxServerResponseToHttpServletResponse.java | 184 -----
.../foundation/vertx/server/TestTcpParser.java | 61 --
.../foundation/vertx/server/TestTcpServer.java | 86 ---
.../vertx/server/TestTcpServerConnection.java | 36 -
.../vertx/stream/TestBufferInputStream.java | 115 ----
.../ext/web/impl/TestHttpServerRequestUtils.java | 2 +-
.../foundation/vertx/TestSimpleBodyHandler.java | 77 +++
.../foundation/vertx/TestSimpleJsonObject.java | 37 +
.../servicecomb/foundation/vertx/TestStream.java | 57 ++
.../foundation/vertx/TestVertxTLSBuilder.java | 187 +++++
.../foundation/vertx/TestVertxUtils.java | 121 ++++
.../vertx/client/TestClientPoolManager.java | 195 ++++++
.../vertx/client/TestClientVerticle.java | 61 ++
.../client/http/TestHttpClientPoolFactory.java | 52 ++
.../tcp/TestAbstractTcpClientPoolFactory.java | 50 ++
.../vertx/client/tcp/TestNetClientWrapper.java | 107 +++
.../vertx/client/tcp/TestTcpClientConfig.java | 32 +
.../vertx/client/tcp/TestTcpClientConnection.java | 249 +++++++
.../client/tcp/TestTcpClientConnectionPool.java | 45 ++
.../vertx/http/TestAbstractHttpServletRequest.java | 516 ++++++++++++++
.../http/TestAbstractHttpServletResponse.java | 307 +++++++++
.../vertx/http/TestBodyBufferSupportImpl.java | 74 ++
.../foundation/vertx/http/TestFileUploadPart.java | 139 ++++
.../http/TestStandardHttpServletRequestEx.java | 81 +++
.../http/TestStandardHttpServletResponseEx.java | 117 ++++
...TestVertxClientRequestToHttpServletRequest.java | 147 ++++
...stVertxClientResponseToHttpServletResponse.java | 129 ++++
...TestVertxServerRequestToHttpServletRequest.java | 430 ++++++++++++
...stVertxServerResponseToHttpServletResponse.java | 184 +++++
.../foundation/vertx/server/TestTcpParser.java | 61 ++
.../foundation/vertx/server/TestTcpServer.java | 86 +++
.../vertx/server/TestTcpServerConnection.java | 36 +
.../vertx/stream/TestBufferInputStream.java | 115 ++++
.../java/io/servicecomb/bizkeeper/BeansHolder.java | 32 -
.../io/servicecomb/bizkeeper/BizkeeperCommand.java | 100 ---
.../bizkeeper/BizkeeperExceptionUtils.java | 36 -
.../io/servicecomb/bizkeeper/BizkeeperHandler.java | 97 ---
.../bizkeeper/BizkeeperHandlerDelegate.java | 66 --
.../bizkeeper/BizkeeperRequestContext.java | 40 --
.../java/io/servicecomb/bizkeeper/CommandKey.java | 42 --
.../io/servicecomb/bizkeeper/Configuration.java | 249 -------
.../bizkeeper/ConsumerBizkeeperCommand.java | 44 --
.../bizkeeper/ConsumerBizkeeperHandler.java | 50 --
.../io/servicecomb/bizkeeper/FallbackPolicy.java | 30 -
.../bizkeeper/FallbackPolicyManager.java | 62 --
.../bizkeeper/FromCacheFallbackPolicy.java | 54 --
.../bizkeeper/HystrixCommandPropertiesExt.java | 551 ---------------
.../bizkeeper/HystrixPropertiesStrategyExt.java | 57 --
.../bizkeeper/ProviderBizkeeperCommand.java | 44 --
.../bizkeeper/ProviderBizkeeperHanlder.java | 50 --
.../bizkeeper/ReturnNullFallbackPolicy.java | 38 -
.../bizkeeper/ThrowExceptionFallbackPolicy.java | 41 --
.../apache/servicecomb/bizkeeper/BeansHolder.java | 32 +
.../servicecomb/bizkeeper/BizkeeperCommand.java | 100 +++
.../bizkeeper/BizkeeperExceptionUtils.java | 36 +
.../servicecomb/bizkeeper/BizkeeperHandler.java | 97 +++
.../bizkeeper/BizkeeperHandlerDelegate.java | 67 ++
.../bizkeeper/BizkeeperRequestContext.java | 40 ++
.../apache/servicecomb/bizkeeper/CommandKey.java | 42 ++
.../servicecomb/bizkeeper/Configuration.java | 249 +++++++
.../bizkeeper/ConsumerBizkeeperCommand.java | 44 ++
.../bizkeeper/ConsumerBizkeeperHandler.java | 50 ++
.../servicecomb/bizkeeper/FallbackPolicy.java | 30 +
.../bizkeeper/FallbackPolicyManager.java | 62 ++
.../bizkeeper/FromCacheFallbackPolicy.java | 53 ++
.../bizkeeper/HystrixCommandPropertiesExt.java | 551 +++++++++++++++
.../bizkeeper/HystrixPropertiesStrategyExt.java | 57 ++
.../bizkeeper/ProviderBizkeeperCommand.java | 44 ++
.../bizkeeper/ProviderBizkeeperHanlder.java | 50 ++
.../bizkeeper/ReturnNullFallbackPolicy.java | 37 +
.../bizkeeper/ThrowExceptionFallbackPolicy.java | 40 ++
.../main/resources/META-INF/spring/cse.bean.xml | 2 +-
.../src/main/resources/config/cse.handler.xml | 4 +-
.../bizkeeper/TestBizkeeperCommand.java | 229 -------
.../bizkeeper/TestBizkeeperExceptionUtils.java | 35 -
.../bizkeeper/TestBizkeeperHandler.java | 209 ------
.../bizkeeper/TestBizkeeperRequestContext.java | 50 --
.../io/servicecomb/bizkeeper/TestCommandKey.java | 58 --
.../servicecomb/bizkeeper/TestConfiguration.java | 65 --
.../bizkeeper/TestConsumerBizkeeperHandler.java | 49 --
.../bizkeeper/TestFallbackPolicyManager.java | 103 ---
.../TestHystrixPropertiesStrategyExt.java | 84 ---
.../bizkeeper/TestProviderBizkeeperHandler.java | 49 --
.../bizkeeper/TestBizkeeperCommand.java | 229 +++++++
.../bizkeeper/TestBizkeeperExceptionUtils.java | 34 +
.../bizkeeper/TestBizkeeperHandler.java | 208 ++++++
.../bizkeeper/TestBizkeeperRequestContext.java | 50 ++
.../servicecomb/bizkeeper/TestCommandKey.java | 57 ++
.../servicecomb/bizkeeper/TestConfiguration.java | 64 ++
.../bizkeeper/TestConsumerBizkeeperHandler.java | 48 ++
.../bizkeeper/TestFallbackPolicyManager.java | 103 +++
.../TestHystrixPropertiesStrategyExt.java | 83 +++
.../bizkeeper/TestProviderBizkeeperHandler.java | 48 ++
.../src/main/java/io/servicecomb/qps/Config.java | 67 --
.../qps/ConsumerQpsControllerManager.java | 158 -----
.../qps/ConsumerQpsFlowControlHandler.java | 54 --
.../qps/ProviderQpsControllerManager.java | 144 ----
.../qps/ProviderQpsFlowControlHandler.java | 62 --
.../src/main/java/io/servicecomb/qps/QpsConst.java | 28 -
.../java/io/servicecomb/qps/QpsController.java | 73 --
.../java/org/apache/servicecomb/qps/Config.java | 67 ++
.../qps/ConsumerQpsControllerManager.java | 157 +++++
.../qps/ConsumerQpsFlowControlHandler.java | 54 ++
.../qps/ProviderQpsControllerManager.java | 143 ++++
.../qps/ProviderQpsFlowControlHandler.java | 62 ++
.../java/org/apache/servicecomb/qps/QpsConst.java | 28 +
.../org/apache/servicecomb/qps/QpsController.java | 73 ++
.../src/main/resources/config/cse.handler.xml | 4 +-
.../test/java/io/servicecomb/qps/TestConfig.java | 44 --
.../qps/TestConsumerQpsControllermanager.java | 75 --
.../qps/TestConsumerQpsFlowControlHandler.java | 123 ----
.../qps/TestProviderQpsControllermanager.java | 44 --
.../qps/TestProviderQpsFlowControlHandler.java | 156 -----
.../src/test/java/io/servicecomb/qps/Utils.java | 37 -
.../org/apache/servicecomb/qps/TestConfig.java | 44 ++
.../qps/TestConsumerQpsControllermanager.java | 75 ++
.../qps/TestConsumerQpsFlowControlHandler.java | 123 ++++
.../qps/TestProviderQpsControllermanager.java | 44 ++
.../qps/TestProviderQpsFlowControlHandler.java | 156 +++++
.../java/org/apache/servicecomb/qps/Utils.java | 37 +
.../io/servicecomb/loadbalance/BeansHolder.java | 35 -
.../io/servicecomb/loadbalance/Configuration.java | 274 --------
.../java/io/servicecomb/loadbalance/CseServer.java | 107 ---
.../loadbalance/DefaultRetryExtensionsFactory.java | 48 --
.../servicecomb/loadbalance/ExtensionsFactory.java | 39 --
.../servicecomb/loadbalance/ExtensionsManager.java | 75 --
.../io/servicecomb/loadbalance/LoadBalancer.java | 125 ----
.../loadbalance/LoadbalanceClientConfig.java | 33 -
.../loadbalance/LoadbalanceHandler.java | 356 ----------
.../RuleClassNameExtentionsFactory.java | 61 --
.../loadbalance/RuleNameExtentionsFactory.java | 64 --
.../loadbalance/ServerListFilterExt.java | 45 --
.../loadbalance/SessionStickinessRule.java | 148 ----
.../exception/LoadbalanceExceptionUtils.java | 36 -
.../filter/CseServerDiscoveryFilter.java | 37 -
.../filter/IsolationServerListFilter.java | 129 ----
.../filter/SimpleTransactionControlFilter.java | 58 --
.../filter/TransactionControlFilter.java | 46 --
.../filter/ZoneAwareServerListFilterExt.java | 75 --
.../servicecomb/loadbalance/BeansHolder.java | 35 +
.../servicecomb/loadbalance/Configuration.java | 274 ++++++++
.../apache/servicecomb/loadbalance/CseServer.java | 107 +++
.../loadbalance/DefaultRetryExtensionsFactory.java | 48 ++
.../servicecomb/loadbalance/ExtensionsFactory.java | 39 ++
.../servicecomb/loadbalance/ExtensionsManager.java | 75 ++
.../servicecomb/loadbalance/LoadBalancer.java | 125 ++++
.../loadbalance/LoadbalanceClientConfig.java | 33 +
.../loadbalance/LoadbalanceHandler.java | 356 ++++++++++
.../RuleClassNameExtentionsFactory.java | 61 ++
.../loadbalance/RuleNameExtentionsFactory.java | 67 ++
.../loadbalance/ServerListFilterExt.java | 45 ++
.../loadbalance/SessionStickinessRule.java | 148 ++++
.../exception/LoadbalanceExceptionUtils.java | 36 +
.../filter/CseServerDiscoveryFilter.java | 37 +
.../filter/IsolationServerListFilter.java | 128 ++++
.../filter/SimpleTransactionControlFilter.java | 58 ++
.../filter/TransactionControlFilter.java | 46 ++
.../filter/ZoneAwareServerListFilterExt.java | 75 ++
.../main/resources/META-INF/spring/cse.bean.xml | 2 +-
.../src/main/resources/config/cse.handler.xml | 2 +-
.../loadbalance/MyServerListFilterExt.java | 46 --
.../servicecomb/loadbalance/TestConfiguration.java | 168 -----
.../io/servicecomb/loadbalance/TestCseServer.java | 94 ---
.../loadbalance/TestExtensionsManager.java | 115 ----
.../servicecomb/loadbalance/TestLoadBalancer.java | 150 ----
.../loadbalance/TestLoadbalanceClientConfig.java | 37 -
.../loadbalance/TestLoadbalanceHandler.java | 452 ------------
.../loadbalance/TestSessionSticknessRule.java | 233 -------
.../exception/TestLoadbalanceExceptionUtils.java | 42 --
.../filter/TestCseServerDiscoveryFilter.java | 81 ---
.../filter/TestIsolationServerListFilter.java | 166 -----
.../filter/TestSimpleTransactionControlFilter.java | 91 ---
.../filter/TestZoneAwareServerListFilterExt.java | 141 ----
.../loadbalance/MyServerListFilterExt.java | 46 ++
.../servicecomb/loadbalance/TestConfiguration.java | 168 +++++
.../servicecomb/loadbalance/TestCseServer.java | 93 +++
.../loadbalance/TestExtensionsManager.java | 115 ++++
.../servicecomb/loadbalance/TestLoadBalancer.java | 149 ++++
.../loadbalance/TestLoadbalanceClientConfig.java | 37 +
.../loadbalance/TestLoadbalanceHandler.java | 453 ++++++++++++
.../loadbalance/TestSessionSticknessRule.java | 233 +++++++
.../exception/TestLoadbalanceExceptionUtils.java | 41 ++
.../filter/TestCseServerDiscoveryFilter.java | 81 +++
.../filter/TestIsolationServerListFilter.java | 166 +++++
.../filter/TestSimpleTransactionControlFilter.java | 90 +++
.../filter/TestZoneAwareServerListFilterExt.java | 141 ++++
.../main/java/io/servicecomb/AuthHandlerBoot.java | 52 --
.../authentication/RSAAuthenticationToken.java | 117 ----
.../consumer/ConsumerAuthHandler.java | 54 --
.../consumer/RSAConsumerTokenManager.java | 87 ---
.../provider/ProviderAuthHanlder.java | 42 --
.../provider/RSAProviderTokenManager.java | 92 ---
.../org/apache/servicecomb/AuthHandlerBoot.java | 52 ++
.../authentication/RSAAuthenticationToken.java | 117 ++++
.../consumer/ConsumerAuthHandler.java | 53 ++
.../consumer/RSAConsumerTokenManager.java | 86 +++
.../provider/ProviderAuthHanlder.java | 42 ++
.../provider/RSAProviderTokenManager.java | 91 +++
.../src/main/resources/config/cse.handler.xml | 4 +-
.../authentication/TestAuthHandlerBoot.java | 54 --
.../authentication/TestConsumerAuthHandler.java | 65 --
.../authentication/TestProviderAuthHanlder.java | 47 --
.../authentication/TestRSAAuthenticationToken.java | 80 ---
.../TestRSAProviderTokenManager.java | 102 ---
.../authentication/TestAuthHandlerBoot.java | 54 ++
.../authentication/TestConsumerAuthHandler.java | 64 ++
.../authentication/TestProviderAuthHanlder.java | 46 ++
.../authentication/TestRSAAuthenticationToken.java | 79 +++
.../TestRSAProviderTokenManager.java | 101 +++
.../tracing/zipkin/ConsumerInvocationAdapter.java | 58 --
.../tracing/zipkin/ProviderInvocationAdapter.java | 58 --
.../tracing/zipkin/TracingConfiguration.java | 100 ---
.../tracing/zipkin/ZipkinConsumerDelegate.java | 67 --
.../zipkin/ZipkinConsumerTracingHandler.java | 32 -
.../tracing/zipkin/ZipkinProviderDelegate.java | 67 --
.../zipkin/ZipkinProviderTracingHandler.java | 32 -
.../tracing/zipkin/ZipkinTracingDelegate.java | 34 -
.../tracing/zipkin/ZipkinTracingHandler.java | 76 --
.../tracing/zipkin/ConsumerInvocationAdapter.java | 59 ++
.../tracing/zipkin/ProviderInvocationAdapter.java | 59 ++
.../tracing/zipkin/TracingConfiguration.java | 99 +++
.../tracing/zipkin/ZipkinConsumerDelegate.java | 68 ++
.../zipkin/ZipkinConsumerTracingHandler.java | 33 +
.../tracing/zipkin/ZipkinProviderDelegate.java | 68 ++
.../zipkin/ZipkinProviderTracingHandler.java | 33 +
.../tracing/zipkin/ZipkinTracingDelegate.java | 35 +
.../tracing/zipkin/ZipkinTracingHandler.java | 76 ++
.../src/main/resources/config/cse.handler.xml | 4 +-
.../tracing/zipkin/ZipkinTracingHandlerTest.java | 110 ---
.../tracing/zipkin/ZipkinTracingHandlerTest.java | 110 +++
.../demo/jaxrs/tests/JaxrsIntegrationTestBase.java | 347 ----------
.../demo/jaxrs/tests/JaxrsTestMain.java | 29 -
.../demo/jaxrs/tests/RawJaxrsIntegrationTest.java | 28 -
.../demo/jaxrs/tests/endpoints/CodeFirstJaxrs.java | 84 ---
.../endpoints/EnglishGreetingRestEndpoint.java | 46 --
.../jaxrs/tests/endpoints/SchemaFirstJaxrs.java | 57 --
.../tests/endpoints/SchemaFirstJaxrsImpl.java | 54 --
.../endpoints/SomeAbstractJaxrsRestEndpoint.java | 133 ----
.../demo/jaxrs/tests/JaxrsIntegrationTestBase.java | 346 ++++++++++
.../demo/jaxrs/tests/JaxrsTestMain.java | 29 +
.../demo/jaxrs/tests/RawJaxrsIntegrationTest.java | 28 +
.../demo/jaxrs/tests/endpoints/CodeFirstJaxrs.java | 85 +++
.../endpoints/EnglishGreetingRestEndpoint.java | 46 ++
.../jaxrs/tests/endpoints/SchemaFirstJaxrs.java | 57 ++
.../tests/endpoints/SchemaFirstJaxrsImpl.java | 54 ++
.../endpoints/SomeAbstractJaxrsRestEndpoint.java | 133 ++++
.../resources/microservices/jaxrs/schemaFirst.yaml | 8 +-
.../demo/pojo/test/PojoIntegrationTestBase.java | 317 ---------
.../io/servicecomb/demo/pojo/test/PojoService.java | 59 --
.../servicecomb/demo/pojo/test/PojoTestMain.java | 29 -
.../demo/pojo/test/RawPojoIntegrationTest.java | 29 -
.../servicecomb/demo/pojo/test/SomePojoConfig.java | 63 --
.../demo/pojo/test/endpoints/CodeFirstPojo.java | 90 ---
.../demo/pojo/test/endpoints/HelloImpl.java | 40 --
.../demo/pojo/test/endpoints/SmartCareImpl.java | 60 --
.../demo/pojo/test/endpoints/TestImpl.java | 109 ---
.../demo/pojo/test/PojoIntegrationTestBase.java | 316 +++++++++
.../servicecomb/demo/pojo/test/PojoService.java | 58 ++
.../servicecomb/demo/pojo/test/PojoTestMain.java | 29 +
.../demo/pojo/test/RawPojoIntegrationTest.java | 29 +
.../servicecomb/demo/pojo/test/SomePojoConfig.java | 62 ++
.../demo/pojo/test/endpoints/CodeFirstPojo.java | 90 +++
.../demo/pojo/test/endpoints/HelloImpl.java | 40 ++
.../demo/pojo/test/endpoints/SmartCareImpl.java | 59 ++
.../demo/pojo/test/endpoints/TestImpl.java | 109 +++
.../jaxrs/tests/JaxrsSpringIntegrationTest.java | 28 -
.../demo/jaxrs/tests/JaxrsSpringMain.java | 31 -
.../jaxrs/tests/JaxrsSpringIntegrationTest.java | 28 +
.../demo/jaxrs/tests/JaxrsSpringMain.java | 30 +
.../demo/pojo/test/PojoSpringIntegrationTest.java | 33 -
.../servicecomb/demo/pojo/test/PojoSpringMain.java | 32 -
.../demo/pojo/test/PojoSpringIntegrationTest.java | 33 +
.../servicecomb/demo/pojo/test/PojoSpringMain.java | 31 +
.../tests/SpringMvcSpringIntegrationTest.java | 42 --
.../demo/springmvc/tests/SpringMvcSpringMain.java | 27 -
...SimplifiedMappingAnnotationIntegrationTest.java | 43 --
.../tests/SpringMvcSpringIntegrationTest.java | 42 ++
.../demo/springmvc/tests/SpringMvcSpringMain.java | 26 +
...SimplifiedMappingAnnotationIntegrationTest.java | 43 ++
.../cloud/zuul/tracing/LoggingFilterConfig.java | 79 ---
.../zuul/tracing/SpringCloudZuulTracingTest.java | 81 ---
.../cloud/zuul/tracing/TracedController.java | 49 --
.../spring/cloud/zuul/tracing/TracedZuulMain.java | 34 -
.../cloud/zuul/tracing/LoggingFilterConfig.java | 79 +++
.../zuul/tracing/SpringCloudZuulTracingTest.java | 80 +++
.../cloud/zuul/tracing/TracedController.java | 48 ++
.../spring/cloud/zuul/tracing/TracedZuulMain.java | 33 +
.../tests/RawSpringMvcIntegrationTest.java | 42 --
...SimplifiedMappingAnnotationIntegrationTest.java | 43 --
.../tests/SpringMvcIntegrationTestBase.java | 505 --------------
.../demo/springmvc/tests/SpringMvcTestMain.java | 29 -
.../tests/endpoints/CodeFirstSpringmvc.java | 170 -----
.../tests/endpoints/CodeFirstSpringmvcBase.java | 146 ----
...eFirstSpringmvcSimplifiedMappingAnnotation.java | 174 -----
.../springmvc/tests/endpoints/ControllerBase.java | 50 --
.../springmvc/tests/endpoints/ControllerImpl.java | 67 --
.../ControllerSimplifiedMappingAnnotationImpl.java | 68 --
.../endpoints/EnglishGreetingRestEndpoint.java | 46 --
.../endpoints/EnglishGreetingRestEndpointBase.java | 29 -
...ingSimplifiedMappingAnnotationRestEndpoint.java | 46 --
.../endpoints/FrenchGreetingRestEndpoint.java | 39 --
.../endpoints/FrenchGreetingRestEndpointBase.java | 24 -
...ingSimplifiedMappingAnnotationRestEndpoint.java | 39 --
.../tests/RawSpringMvcIntegrationTest.java | 41 ++
...SimplifiedMappingAnnotationIntegrationTest.java | 42 ++
.../tests/SpringMvcIntegrationTestBase.java | 504 ++++++++++++++
.../demo/springmvc/tests/SpringMvcTestMain.java | 29 +
.../tests/endpoints/CodeFirstSpringmvc.java | 171 +++++
.../tests/endpoints/CodeFirstSpringmvcBase.java | 145 ++++
...eFirstSpringmvcSimplifiedMappingAnnotation.java | 175 +++++
.../springmvc/tests/endpoints/ControllerBase.java | 50 ++
.../springmvc/tests/endpoints/ControllerImpl.java | 66 ++
.../ControllerSimplifiedMappingAnnotationImpl.java | 67 ++
.../endpoints/EnglishGreetingRestEndpoint.java | 45 ++
.../endpoints/EnglishGreetingRestEndpointBase.java | 29 +
...ingSimplifiedMappingAnnotationRestEndpoint.java | 45 ++
.../endpoints/FrenchGreetingRestEndpoint.java | 38 +
.../endpoints/FrenchGreetingRestEndpointBase.java | 24 +
...ingSimplifiedMappingAnnotationRestEndpoint.java | 38 +
.../io/servicecomb/tests/EmbeddedAppender.java | 105 ---
.../java/io/servicecomb/tests/Log4jConfig.java | 39 --
.../tests/tracing/TraceContextConfig.java | 103 ---
.../servicecomb/tests/tracing/TracingTestBase.java | 114 ---
.../apache/servicecomb/tests/EmbeddedAppender.java | 105 +++
.../org/apache/servicecomb/tests/Log4jConfig.java | 39 ++
.../tests/tracing/TraceContextConfig.java | 103 +++
.../servicecomb/tests/tracing/TracingTestBase.java | 114 +++
.../io/servicecomb/tests/tracing/SlowRepo.java | 22 -
.../io/servicecomb/tests/tracing/SlowRepoImpl.java | 39 --
.../tests/tracing/SomeTracedController.java | 53 --
.../tests/tracing/TracedJaxrsController.java | 57 --
.../io/servicecomb/tests/tracing/TracedPojo.java | 23 -
.../tests/tracing/TracedPojoConfig.java | 42 --
.../servicecomb/tests/tracing/TracedPojoImpl.java | 35 -
.../servicecomb/tests/tracing/TracingTestMain.java | 27 -
.../tracing/ZipkinTracingIntegrationTest.java | 53 --
.../apache/servicecomb/tests/tracing/SlowRepo.java | 22 +
.../servicecomb/tests/tracing/SlowRepoImpl.java | 38 +
.../tests/tracing/SomeTracedController.java | 52 ++
.../tests/tracing/TracedJaxrsController.java | 56 ++
.../servicecomb/tests/tracing/TracedPojo.java | 23 +
.../tests/tracing/TracedPojoConfig.java | 41 ++
.../servicecomb/tests/tracing/TracedPojoImpl.java | 34 +
.../servicecomb/tests/tracing/TracingTestMain.java | 27 +
.../tracing/ZipkinTracingIntegrationTest.java | 57 ++
.../io/servicecomb/metrics/common/CallMetric.java | 61 --
.../metrics/common/ConsumerInvocationMetric.java | 59 --
.../common/DefaultHealthCheckExtraData.java | 69 --
.../metrics/common/HealthCheckResult.java | 56 --
.../servicecomb/metrics/common/HealthChecker.java | 24 -
.../metrics/common/HealthCheckerPublisher.java | 26 -
.../servicecomb/metrics/common/InstanceMetric.java | 59 --
.../metrics/common/InvocationMetric.java | 37 -
.../servicecomb/metrics/common/MetricsConst.java | 28 -
.../metrics/common/MetricsPublisher.java | 59 --
.../metrics/common/ProducerInvocationMetric.java | 89 ---
.../servicecomb/metrics/common/RegistryMetric.java | 92 ---
.../servicecomb/metrics/common/SystemMetric.java | 119 ----
.../io/servicecomb/metrics/common/TimerMetric.java | 99 ---
.../servicecomb/metrics/common/CallMetric.java | 61 ++
.../metrics/common/ConsumerInvocationMetric.java | 59 ++
.../common/DefaultHealthCheckExtraData.java | 69 ++
.../metrics/common/HealthCheckResult.java | 56 ++
.../servicecomb/metrics/common/HealthChecker.java | 24 +
.../metrics/common/HealthCheckerPublisher.java | 26 +
.../servicecomb/metrics/common/InstanceMetric.java | 59 ++
.../metrics/common/InvocationMetric.java | 37 +
.../servicecomb/metrics/common/MetricsConst.java | 28 +
.../metrics/common/MetricsPublisher.java | 59 ++
.../metrics/common/ProducerInvocationMetric.java | 89 +++
.../servicecomb/metrics/common/RegistryMetric.java | 92 +++
.../servicecomb/metrics/common/SystemMetric.java | 119 ++++
.../servicecomb/metrics/common/TimerMetric.java | 99 +++
.../io/servicecomb/metrics/core/MetricsConfig.java | 22 -
.../core/event/DefaultEventListenerManager.java | 41 --
.../metrics/core/event/EventListenerManager.java | 24 -
.../event/InvocationFinishedEventListener.java | 53 --
.../InvocationStartProcessingEventListener.java | 49 --
.../core/event/InvocationStartedEventListener.java | 53 --
.../health/DefaultMicroserviceHealthChecker.java | 67 --
.../metrics/core/monitor/CallMonitor.java | 55 --
.../core/monitor/ConsumerInvocationMonitor.java | 47 --
.../metrics/core/monitor/DefaultSystemMonitor.java | 106 ---
.../metrics/core/monitor/InvocationMonitor.java | 37 -
.../core/monitor/ProducerInvocationMonitor.java | 74 --
.../metrics/core/monitor/RegistryMonitor.java | 66 --
.../metrics/core/monitor/SystemMonitor.java | 44 --
.../metrics/core/monitor/TimerMonitor.java | 80 ---
.../metrics/core/publish/DataSource.java | 62 --
.../metrics/core/publish/DefaultDataSource.java | 99 ---
.../core/publish/DefaultHealthCheckerManager.java | 67 --
.../publish/DefaultHealthCheckerPublisher.java | 59 --
.../core/publish/DefaultMetricsPublisher.java | 66 --
.../metrics/core/publish/HealthCheckerManager.java | 31 -
.../servicecomb/metrics/core/MetricsConfig.java | 22 +
.../core/event/DefaultEventListenerManager.java | 40 ++
.../metrics/core/event/EventListenerManager.java | 24 +
.../event/InvocationFinishedEventListener.java | 53 ++
.../InvocationStartProcessingEventListener.java | 49 ++
.../core/event/InvocationStartedEventListener.java | 53 ++
.../health/DefaultMicroserviceHealthChecker.java | 66 ++
.../metrics/core/monitor/CallMonitor.java | 55 ++
.../core/monitor/ConsumerInvocationMonitor.java | 47 ++
.../metrics/core/monitor/DefaultSystemMonitor.java | 105 +++
.../metrics/core/monitor/InvocationMonitor.java | 37 +
.../core/monitor/ProducerInvocationMonitor.java | 74 ++
.../metrics/core/monitor/RegistryMonitor.java | 65 ++
.../metrics/core/monitor/SystemMonitor.java | 44 ++
.../metrics/core/monitor/TimerMonitor.java | 80 +++
.../metrics/core/publish/DataSource.java | 62 ++
.../metrics/core/publish/DefaultDataSource.java | 98 +++
.../core/publish/DefaultHealthCheckerManager.java | 66 ++
.../publish/DefaultHealthCheckerPublisher.java | 59 ++
.../core/publish/DefaultMetricsPublisher.java | 66 ++
.../metrics/core/publish/HealthCheckerManager.java | 31 +
.../metrics/core/TestEventAndRunner.java | 266 -------
.../metrics/core/TestHealthCheckerManager.java | 88 ---
.../metrics/core/TestHealthCheckerPublisher.java | 59 --
.../io/servicecomb/metrics/core/TestPublisher.java | 58 --
.../metrics/core/TestEventAndRunner.java | 309 +++++++++
.../metrics/core/TestHealthCheckerManager.java | 88 +++
.../metrics/core/TestHealthCheckerPublisher.java | 58 ++
.../servicecomb/metrics/core/TestPublisher.java | 57 ++
.../metrics/prometheus/MetricsCollector.java | 77 ---
.../metrics/prometheus/MetricsPublisher.java | 71 --
.../metrics/prometheus/MetricsCollector.java | 79 +++
.../metrics/prometheus/MetricsPublisher.java | 71 ++
.../servicecomb/provider/pojo/InstanceFactory.java | 24 -
.../java/io/servicecomb/provider/pojo/Invoker.java | 134 ----
.../io/servicecomb/provider/pojo/PojoConfig.java | 49 --
.../io/servicecomb/provider/pojo/PojoConst.java | 41 --
.../provider/pojo/PojoConsumerProvider.java | 32 -
.../provider/pojo/PojoProducerProvider.java | 105 ---
.../io/servicecomb/provider/pojo/RpcReference.java | 34 -
.../io/servicecomb/provider/pojo/RpcSchema.java | 37 -
.../pojo/instance/PojoInstanceFactory.java | 38 -
.../pojo/instance/SpringInstanceFactory.java | 39 --
.../provider/pojo/reference/PojoReferenceMeta.java | 87 ---
.../pojo/reference/ReferenceDefParser.java | 58 --
.../pojo/reference/RpcReferenceProcessor.java | 80 ---
.../provider/pojo/schema/PojoProducerMeta.java | 44 --
.../provider/pojo/schema/PojoProducers.java | 89 ---
.../provider/pojo/schema/SchemaDefParser.java | 49 --
.../servicecomb/provider/pojo/InstanceFactory.java | 24 +
.../apache/servicecomb/provider/pojo/Invoker.java | 133 ++++
.../servicecomb/provider/pojo/PojoConfig.java | 49 ++
.../servicecomb/provider/pojo/PojoConst.java | 41 ++
.../provider/pojo/PojoConsumerProvider.java | 31 +
.../provider/pojo/PojoProducerProvider.java | 104 +++
.../servicecomb/provider/pojo/RpcReference.java | 34 +
.../servicecomb/provider/pojo/RpcSchema.java | 37 +
.../pojo/instance/PojoInstanceFactory.java | 38 +
.../pojo/instance/SpringInstanceFactory.java | 39 ++
.../provider/pojo/reference/PojoReferenceMeta.java | 86 +++
.../pojo/reference/ReferenceDefParser.java | 57 ++
.../pojo/reference/RpcReferenceProcessor.java | 79 +++
.../provider/pojo/schema/PojoProducerMeta.java | 43 ++
.../provider/pojo/schema/PojoProducers.java | 88 +++
.../provider/pojo/schema/SchemaDefParser.java | 48 ++
.../src/main/resources/META-INF/spring.handlers | 2 +-
.../resources/META-INF/spring/namespace.properties | 4 +-
.../io/servicecomb/provider/common/MockUtil.java | 195 ------
.../java/io/servicecomb/provider/pojo/IPerson.java | 22 -
.../java/io/servicecomb/provider/pojo/Person.java | 31 -
.../servicecomb/provider/pojo/PersonReference.java | 23 -
.../io/servicecomb/provider/pojo/TestInvoker.java | 253 -------
.../provider/pojo/TestPojoConsumerProvider.java | 32 -
.../provider/pojo/TestPojoProducerProvider.java | 84 ---
.../pojo/instance/TestPojoInstanceFactory.java | 47 --
.../pojo/instance/TestSpringInstanceFactory.java | 51 --
.../pojo/reference/PojoReferenceMetaTest.java | 64 --
.../pojo/reference/TestReferenceDefParser.java | 41 --
.../pojo/reference/TestRpcReferenceProcessor.java | 65 --
.../provider/pojo/schema/TestPojoProducers.java | 74 --
.../provider/pojo/schema/TestPojoSchemaMeta.java | 67 --
.../provider/pojo/schema/TestSchemaDefParser.java | 39 --
.../servicecomb/provider/common/MockUtil.java | 195 ++++++
.../apache/servicecomb/provider/pojo/IPerson.java | 22 +
.../apache/servicecomb/provider/pojo/Person.java | 31 +
.../servicecomb/provider/pojo/PersonReference.java | 23 +
.../servicecomb/provider/pojo/TestInvoker.java | 254 +++++++
.../provider/pojo/TestPojoConsumerProvider.java | 32 +
.../provider/pojo/TestPojoProducerProvider.java | 84 +++
.../pojo/instance/TestPojoInstanceFactory.java | 46 ++
.../pojo/instance/TestSpringInstanceFactory.java | 50 ++
.../pojo/reference/PojoReferenceMetaTest.java | 63 ++
.../pojo/reference/TestReferenceDefParser.java | 40 ++
.../pojo/reference/TestRpcReferenceProcessor.java | 65 ++
.../provider/pojo/schema/TestPojoProducers.java | 74 ++
.../provider/pojo/schema/TestPojoSchemaMeta.java | 67 ++
.../provider/pojo/schema/TestSchemaDefParser.java | 39 ++
.../common/InvocationToHttpServletRequest.java | 128 ----
.../rest/common/ProducerHttpRequestArgMapper.java | 44 --
.../ProducerHttpRequestArgMapperFactory.java | 41 --
.../provider/rest/common/RestConsumerProvider.java | 31 -
.../provider/rest/common/RestProducerProvider.java | 56 --
.../provider/rest/common/RestProducers.java | 61 --
.../provider/rest/common/RestSchema.java | 37 -
.../common/InvocationToHttpServletRequest.java | 129 ++++
.../rest/common/ProducerHttpRequestArgMapper.java | 44 ++
.../ProducerHttpRequestArgMapperFactory.java | 40 ++
.../provider/rest/common/RestConsumerProvider.java | 30 +
.../provider/rest/common/RestProducerProvider.java | 55 ++
.../provider/rest/common/RestProducers.java | 60 ++
.../provider/rest/common/RestSchema.java | 37 +
.../io/servicecomb/provider/common/MockUtil.java | 72 --
.../common/TestInvocationToHttpServletRequest.java | 326 ---------
.../common/TestProducerHttpRequestArgMapper.java | 74 --
.../rest/common/TestRestConsumerProvider.java | 33 -
.../provider/rest/common/TestRestProducers.java | 56 --
.../rest/common/TestRestServiceProvider.java | 73 --
.../servicecomb/provider/common/MockUtil.java | 72 ++
.../common/TestInvocationToHttpServletRequest.java | 326 +++++++++
.../common/TestProducerHttpRequestArgMapper.java | 74 ++
.../rest/common/TestRestConsumerProvider.java | 32 +
.../provider/rest/common/TestRestProducers.java | 55 ++
.../rest/common/TestRestServiceProvider.java | 73 ++
.../reference/AcceptableRestTemplate.java | 28 -
.../reference/CommonToHttpServletRequest.java | 218 ------
.../springmvc/reference/CseClientHttpRequest.java | 176 -----
.../reference/CseClientHttpRequestFactory.java | 32 -
.../springmvc/reference/CseClientHttpResponse.java | 111 ---
.../springmvc/reference/CseHttpEntity.java | 63 --
.../springmvc/reference/CseRequestCallback.java | 49 --
.../springmvc/reference/CseRestTemplate.java | 59 --
.../springmvc/reference/CseUriTemplateHandler.java | 78 ---
.../provider/springmvc/reference/RequestMeta.java | 65 --
.../springmvc/reference/RestTemplateBuilder.java | 35 -
.../reference/RestTemplateCopyHeaderFilter.java | 62 --
.../springmvc/reference/RestTemplateWrapper.java | 323 ---------
.../reference/ServiceCombRestTemplateConfig.java | 30 -
...UrlWithServiceNameClientHttpRequestFactory.java | 45 --
.../reference/AcceptableRestTemplate.java | 28 +
.../reference/CommonToHttpServletRequest.java | 217 ++++++
.../springmvc/reference/CseClientHttpRequest.java | 176 +++++
.../reference/CseClientHttpRequestFactory.java | 32 +
.../springmvc/reference/CseClientHttpResponse.java | 110 +++
.../springmvc/reference/CseHttpEntity.java | 62 ++
.../springmvc/reference/CseRequestCallback.java | 49 ++
.../springmvc/reference/CseRestTemplate.java | 58 ++
.../springmvc/reference/CseUriTemplateHandler.java | 77 +++
.../provider/springmvc/reference/RequestMeta.java | 65 ++
.../springmvc/reference/RestTemplateBuilder.java | 35 +
.../reference/RestTemplateCopyHeaderFilter.java | 61 ++
.../springmvc/reference/RestTemplateWrapper.java | 323 +++++++++
.../reference/ServiceCombRestTemplateConfig.java | 30 +
...UrlWithServiceNameClientHttpRequestFactory.java | 45 ++
.../web/client/CseHttpMessageConverter.java | 5 +-
...servicecomb.common.rest.filter.HttpClientFilter | 18 -
...servicecomb.common.rest.filter.HttpClientFilter | 18 +
.../io/servicecomb/provider/common/MockUtil.java | 360 ----------
.../ServiceCombRestTemplateConfigTest.java | 36 -
.../reference/TestCommonToHttpServletRequest.java | 239 -------
.../reference/TestCseClientHttpRequest.java | 119 ----
.../reference/TestCseClientHttpRequestFactory.java | 40 --
.../reference/TestCseClientHttpResponse.java | 65 --
.../springmvc/reference/TestCseHttpEntity.java | 40 --
.../reference/TestCseRequestCallback.java | 49 --
.../springmvc/reference/TestCseRestTemplate.java | 29 -
.../reference/TestCseUriTemplateHandler.java | 43 --
.../springmvc/reference/TestRequestMeta.java | 71 --
.../reference/TestRestTemplateBuilder.java | 63 --
.../TestRestTemplateCopyHeaderFilter.java | 103 ---
.../reference/TestRestTemplateWrapper.java | 446 ------------
...UrlWithServiceNameClientHttpRequestFactory.java | 79 ---
.../servicecomb/provider/common/MockUtil.java | 360 ++++++++++
.../ServiceCombRestTemplateConfigTest.java | 36 +
.../reference/TestCommonToHttpServletRequest.java | 238 +++++++
.../reference/TestCseClientHttpRequest.java | 119 ++++
.../reference/TestCseClientHttpRequestFactory.java | 40 ++
.../reference/TestCseClientHttpResponse.java | 64 ++
.../springmvc/reference/TestCseHttpEntity.java | 39 ++
.../reference/TestCseRequestCallback.java | 49 ++
.../springmvc/reference/TestCseRestTemplate.java | 29 +
.../reference/TestCseUriTemplateHandler.java | 43 ++
.../springmvc/reference/TestRequestMeta.java | 70 ++
.../reference/TestRestTemplateBuilder.java | 63 ++
.../TestRestTemplateCopyHeaderFilter.java | 103 +++
.../reference/TestRestTemplateWrapper.java | 446 ++++++++++++
...UrlWithServiceNameClientHttpRequestFactory.java | 79 +++
.../web/client/TestCseHttpMessageConverter.java | 5 +-
samples/auth-sample/auth-consumer/pom.xml | 71 +-
.../springmvc/consumer/AuthConsumerMain.java | 56 --
.../springmvc/consumer/AuthConsumerMain.java | 55 ++
samples/auth-sample/auth-provider/pom.xml | 68 +-
.../springmvc/provider/AuthProviderMain.java | 29 -
.../springmvc/provider/SpringmvcHelloImpl.java | 47 --
.../springmvc/provider/AuthProviderMain.java | 29 +
.../springmvc/provider/SpringmvcHelloImpl.java | 46 ++
.../META-INF/spring/pojo.provider.bean.xml | 2 +-
samples/auth-sample/pom.xml | 7 +-
samples/bmi/calculator/pom.xml | 3 +-
.../io/servicecomb/samples/bmi/BMIViewObject.java | 60 --
.../samples/bmi/CalculatorApplication.java | 32 -
.../samples/bmi/CalculatorEndpoint.java | 29 -
.../samples/bmi/CalculatorRestEndpoint.java | 54 --
.../servicecomb/samples/bmi/CalculatorService.java | 29 -
.../samples/bmi/CalculatorServiceImpl.java | 44 --
.../samples/bmi/InstanceInfoService.java | 26 -
.../samples/bmi/InstanceInfoServiceImpl.java | 42 --
.../servicecomb/samples/bmi/BMIViewObject.java | 60 ++
.../samples/bmi/CalculatorApplication.java | 31 +
.../samples/bmi/CalculatorEndpoint.java | 29 +
.../samples/bmi/CalculatorRestEndpoint.java | 54 ++
.../servicecomb/samples/bmi/CalculatorService.java | 29 +
.../samples/bmi/CalculatorServiceImpl.java | 44 ++
.../samples/bmi/InstanceInfoService.java | 26 +
.../samples/bmi/InstanceInfoServiceImpl.java | 41 ++
samples/bmi/pom.xml | 2 +-
samples/bmi/webapp/pom.xml | 3 +-
.../samples/bmi/GatewayApplication.java | 33 -
.../samples/bmi/GatewayApplication.java | 32 +
.../codefirst-sample/codefirst-consumer/pom.xml | 70 +-
.../codefirst/consumer/CodeFirstConsumerMain.java | 55 --
.../codefirst/consumer/CodeFirstConsumerMain.java | 54 ++
.../META-INF/spring/pojo.consumer.bean.xml | 2 +-
.../codefirst-sample/codefirst-provider/pom.xml | 78 +--
.../provider/CodeFirstJaxrsHelloImpl.java | 48 --
.../codefirst/provider/CodeFirstPojoHelloImpl.java | 35 -
.../codefirst/provider/CodeFirstProviderMain.java | 29 -
.../provider/CodeFirstSpringmvcHelloImpl.java | 47 --
.../provider/CodeFirstJaxrsHelloImpl.java | 48 ++
.../codefirst/provider/CodeFirstPojoHelloImpl.java | 35 +
.../codefirst/provider/CodeFirstProviderMain.java | 29 +
.../provider/CodeFirstSpringmvcHelloImpl.java | 46 ++
.../META-INF/spring/pojo.provider.bean.xml | 2 +-
samples/codefirst-sample/pom.xml | 38 +-
samples/common-schema/pom.xml | 3 +-
.../servicecomb/samples/common/schema/Hello.java | 27 -
.../samples/common/schema/models/Person.java | 30 -
.../servicecomb/samples/common/schema/Hello.java | 27 +
.../samples/common/schema/models/Person.java | 30 +
samples/config-apollo-sample/pom.xml | 3 +-
.../src/main/java/MainServer.java | 6 +-
.../custom-handler-consumer/pom.xml | 78 +--
.../consumer/CustomHandlerCustomerMain.java | 45 --
.../customerhandler/handlers/MyHandler.java | 41 --
.../consumer/CustomHandlerCustomerMain.java | 44 ++
.../customerhandler/handlers/MyHandler.java | 40 ++
.../META-INF/spring/pojo.consumer.bean.xml | 2 +-
.../src/main/resources/config/cse.handler.xml | 2 +-
.../custom-handler-provider/pom.xml | 78 +--
.../provider/CustomHandlerProviderMain.java | 30 -
.../customerhandler/provider/HelloImpl.java | 37 -
.../provider/CustomHandlerProviderMain.java | 30 +
.../customerhandler/provider/HelloImpl.java | 37 +
.../META-INF/spring/pojo.provider.bean.xml | 2 +-
samples/custom-handler-sample/pom.xml | 28 +-
.../samples/jaxrs/consumer/JaxrsConsumerMain.java | 45 --
.../samples/jaxrs/consumer/JaxrsConsumerMain.java | 44 ++
.../META-INF/spring/pojo.consumer.bean.xml | 2 +-
.../main/resources/microservices/hello/hello.yaml | 2 +-
.../samples/jaxrs/provider/JaxrsHelloImpl.java | 48 --
.../samples/jaxrs/provider/JaxrsProviderMain.java | 29 -
.../samples/jaxrs/provider/JaxrsHelloImpl.java | 48 ++
.../samples/jaxrs/provider/JaxrsProviderMain.java | 29 +
.../META-INF/spring/pojo.provider.bean.xml | 2 +-
.../main/resources/microservices/hello/hello.yaml | 2 +-
.../CustomHealthCheckerAnnotation.java | 37 -
.../ExtendHealthCheckApplication.java | 31 -
.../extendhealthcheck/MySqlHealthChecker.java | 54 --
.../SomeServiceWithHealthCheckerManager.java | 36 -
.../CustomHealthCheckerAnnotation.java | 36 +
.../ExtendHealthCheckApplication.java | 30 +
.../extendhealthcheck/MySqlHealthChecker.java | 54 ++
.../SomeServiceWithHealthCheckerManager.java | 35 +
.../samples/mwf/Log4JMetricsFileWriter.java | 79 ---
.../samples/mwf/ServiceApplication.java | 31 -
.../io/servicecomb/samples/mwf/SimpleService.java | 36 -
.../samples/mwf/Log4JMetricsFileWriter.java | 78 +++
.../samples/mwf/ServiceApplication.java | 30 +
.../servicecomb/samples/mwf/SimpleService.java | 35 +
.../samples/mwf/Log4J2MetricsFileWriter.java | 105 ---
.../samples/mwf/ServiceApplication.java | 31 -
.../io/servicecomb/samples/mwf/SimpleService.java | 36 -
.../samples/mwf/Log4J2MetricsFileWriter.java | 104 +++
.../samples/mwf/ServiceApplication.java | 30 +
.../servicecomb/samples/mwf/SimpleService.java | 35 +
.../samples/mwf/FileContentConvertor.java | 27 -
.../samples/mwf/FileContentFormatter.java | 24 -
.../samples/mwf/MetricsBootListener.java | 41 --
.../servicecomb/samples/mwf/MetricsFileWriter.java | 22 -
.../samples/mwf/SimpleFileContentConvertor.java | 60 --
.../samples/mwf/SimpleFileContentFormatter.java | 86 ---
.../samples/mwf/WriteFileInitializer.java | 100 ---
.../samples/mwf/FileContentConvertor.java | 27 +
.../samples/mwf/FileContentFormatter.java | 24 +
.../samples/mwf/MetricsBootListener.java | 40 ++
.../servicecomb/samples/mwf/MetricsFileWriter.java | 22 +
.../samples/mwf/SimpleFileContentConvertor.java | 61 ++
.../samples/mwf/SimpleFileContentFormatter.java | 86 +++
.../samples/mwf/WriteFileInitializer.java | 99 +++
.../io/servicecomb/samples/mwf/TestWriteFile.java | 165 -----
.../servicecomb/samples/mwf/TestWriteFile.java | 167 +++++
.../java/io/servicecomb/samples/pojo/Compute.java | 28 -
.../samples/pojo/consumer/PojoConsumerMain.java | 52 --
.../apache/servicecomb/samples/pojo/Compute.java | 28 +
.../samples/pojo/consumer/PojoConsumerMain.java | 51 ++
.../META-INF/spring/pojo.consumer.bean.xml | 2 +-
.../main/resources/microservices/hello/hello.yaml | 2 +-
.../java/io/servicecomb/samples/pojo/Compute.java | 28 -
.../pojo/provider/CodeFirstComputeImpl.java | 48 --
.../samples/pojo/provider/HelloImpl.java | 37 -
.../samples/pojo/provider/PojoProviderMain.java | 29 -
.../apache/servicecomb/samples/pojo/Compute.java | 28 +
.../pojo/provider/CodeFirstComputeImpl.java | 48 ++
.../samples/pojo/provider/HelloImpl.java | 37 +
.../samples/pojo/provider/PojoProviderMain.java | 29 +
.../META-INF/spring/pojo.provider.bean.xml | 2 +-
.../main/resources/microservices/hello/hello.yaml | 2 +-
.../springmvc/consumer/SpringmvcConsumerMain.java | 60 --
.../springmvc/consumer/SpringmvcConsumerMain.java | 59 ++
.../META-INF/spring/pojo.consumer.bean.xml | 2 +-
.../main/resources/microservices/hello/hello.yaml | 2 +-
.../springmvc/provider/SpringmvcHelloImpl.java | 46 --
.../springmvc/provider/SpringmvcProviderMain.java | 29 -
.../springmvc/provider/SpringmvcHelloImpl.java | 45 ++
.../springmvc/provider/SpringmvcProviderMain.java | 29 +
.../META-INF/spring/pojo.provider.bean.xml | 2 +-
.../main/resources/microservices/hello/hello.yaml | 2 +-
.../io/servicecomb/serviceregistry/Features.java | 30 -
.../servicecomb/serviceregistry/RegistryUtils.java | 224 ------
.../serviceregistry/ServiceRegistry.java | 62 --
.../io/servicecomb/serviceregistry/api/Const.java | 153 -----
.../serviceregistry/api/MicroserviceKey.java | 76 --
.../serviceregistry/api/PropertyExtended.java | 24 -
.../serviceregistry/api/registry/BasePath.java | 48 --
.../api/registry/DataCenterInfo.java | 50 --
.../serviceregistry/api/registry/Framework.java | 44 --
.../serviceregistry/api/registry/HealthCheck.java | 73 --
.../api/registry/HealthCheckMode.java | 40 --
.../serviceregistry/api/registry/Microservice.java | 212 ------
.../api/registry/MicroserviceFactory.java | 85 ---
.../api/registry/MicroserviceInstance.java | 181 -----
.../api/registry/MicroserviceInstanceStatus.java | 29 -
.../api/registry/MicroserviceStatus.java | 27 -
.../serviceregistry/api/registry/WatchAction.java | 43 --
.../api/request/CreateSchemaRequest.java | 30 -
.../api/request/CreateServiceRequest.java | 35 -
.../api/request/RegisterInstanceRequest.java | 35 -
.../api/request/UpdatePropertiesRequest.java | 35 -
.../api/response/CreateServiceResponse.java | 33 -
.../api/response/FindInstancesResponse.java | 37 -
.../api/response/GetAllServicesResponse.java | 37 -
.../api/response/GetExistenceResponse.java | 43 --
.../api/response/GetInstancesResponse.java | 37 -
.../api/response/GetSchemaResponse.java | 30 -
.../api/response/GetServiceResponse.java | 35 -
.../api/response/HeartbeatResponse.java | 43 --
.../response/MicroserviceInstanceChangedEvent.java | 57 --
.../api/response/MicroserviceInstanceResponse.java | 35 -
.../api/response/RegisterInstanceResponse.java | 33 -
.../serviceregistry/cache/CacheEndpoint.java | 44 --
.../serviceregistry/cache/InstanceCache.java | 138 ----
.../cache/InstanceCacheManager.java | 27 -
.../cache/InstanceCacheManagerNew.java | 42 --
.../cache/MicroserviceInstanceCache.java | 68 --
.../serviceregistry/client/ClientException.java | 30 -
.../serviceregistry/client/Endpoints.java | 67 --
.../serviceregistry/client/IpPortManager.java | 115 ----
.../client/LocalServiceRegistryClientImpl.java | 376 ----------
.../client/ServiceRegistryClient.java | 143 ----
.../client/http/AbstractClientPool.java | 66 --
.../serviceregistry/client/http/ClientPool.java | 32 -
.../client/http/EmptyAuthHeaderProvider.java | 30 -
.../client/http/HttpClientPool.java | 66 --
.../client/http/MicroserviceInstances.java | 56 --
.../client/http/RequestContext.java | 77 ---
.../serviceregistry/client/http/RequestParam.java | 145 ----
.../serviceregistry/client/http/RestResponse.java | 51 --
.../serviceregistry/client/http/RestUtils.java | 214 ------
.../client/http/ServiceRegistryClientImpl.java | 711 -------------------
.../client/http/WebsocketClientPool.java | 57 --
.../client/http/WebsocketUtils.java | 73 --
.../config/AbstractPropertiesLoader.java | 98 ---
.../config/ConfigurePropertyUtils.java | 84 ---
.../config/InstancePropertiesLoader.java | 31 -
.../config/MicroservicePropertiesLoader.java | 33 -
.../config/ServiceRegistryConfig.java | 312 ---------
.../serviceregistry/consumer/AppManager.java | 68 --
.../DefaultMicroserviceVersionFactory.java | 27 -
.../consumer/MicroserviceManager.java | 73 --
.../consumer/MicroserviceVersion.java | 45 --
.../consumer/MicroserviceVersionFactory.java | 22 -
.../consumer/MicroserviceVersionRule.java | 160 -----
.../consumer/MicroserviceVersions.java | 200 ------
.../definition/DefinitionConst.java | 37 -
.../definition/MicroserviceDefinition.java | 155 -----
.../discovery/AbstractDiscoveryFilter.java | 39 --
.../discovery/AbstractEndpointDiscoveryFilter.java | 85 ---
.../discovery/DiscoveryContext.java | 70 --
.../serviceregistry/discovery/DiscoveryFilter.java | 31 -
.../serviceregistry/discovery/DiscoveryTree.java | 138 ----
.../discovery/DiscoveryTreeNode.java | 86 ---
.../registry/AbstractServiceRegistry.java | 283 --------
.../registry/LocalServiceRegistry.java | 35 -
.../registry/RemoteServiceRegistry.java | 113 ---
.../registry/ServiceRegistryFactory.java | 85 ---
.../serviceregistry/task/AbstractRegisterTask.java | 48 --
.../serviceregistry/task/AbstractTask.java | 68 --
.../serviceregistry/task/CompositeTask.java | 38 -
.../serviceregistry/task/HeartbeatResult.java | 23 -
.../task/MicroserviceInstanceHeartbeatTask.java | 89 ---
.../task/MicroserviceInstanceRegisterTask.java | 87 ---
.../task/MicroserviceRegisterTask.java | 154 -----
.../task/MicroserviceServiceCenterTask.java | 33 -
.../task/MicroserviceWatchTask.java | 129 ----
.../serviceregistry/task/ServiceCenterTask.java | 96 ---
.../task/ServiceCenterTaskMonitor.java | 54 --
.../serviceregistry/task/TaskStatus.java | 23 -
.../serviceregistry/task/event/ExceptionEvent.java | 29 -
.../task/event/HeartbeatFailEvent.java | 27 -
.../task/event/HeartbeatSuccEvent.java | 27 -
.../task/event/PeriodicPullEvent.java | 22 -
.../PullMicroserviceVersionsInstancesEvent.java | 39 --
.../serviceregistry/task/event/RecoveryEvent.java | 21 -
.../serviceregistry/task/event/ShutdownEvent.java | 21 -
.../serviceregistry/version/Version.java | 136 ----
.../serviceregistry/version/VersionRule.java | 39 --
.../version/VersionRuleFixedParser.java | 42 --
.../version/VersionRuleLatestParser.java | 46 --
.../serviceregistry/version/VersionRuleParser.java | 23 -
.../version/VersionRuleRangeParser.java | 50 --
.../version/VersionRuleStartFromParser.java | 46 --
.../serviceregistry/version/VersionRuleUtils.java | 60 --
.../serviceregistry/version/VersionUtils.java | 33 -
.../servicecomb/serviceregistry/Features.java | 30 +
.../servicecomb/serviceregistry/RegistryUtils.java | 224 ++++++
.../serviceregistry/ServiceRegistry.java | 62 ++
.../servicecomb/serviceregistry/api/Const.java | 153 +++++
.../serviceregistry/api/MicroserviceKey.java | 76 ++
.../serviceregistry/api/PropertyExtended.java | 24 +
.../serviceregistry/api/registry/BasePath.java | 48 ++
.../api/registry/DataCenterInfo.java | 50 ++
.../serviceregistry/api/registry/Framework.java | 44 ++
.../serviceregistry/api/registry/HealthCheck.java | 73 ++
.../api/registry/HealthCheckMode.java | 40 ++
.../serviceregistry/api/registry/Microservice.java | 212 ++++++
.../api/registry/MicroserviceFactory.java | 84 +++
.../api/registry/MicroserviceInstance.java | 181 +++++
.../api/registry/MicroserviceInstanceStatus.java | 29 +
.../api/registry/MicroserviceStatus.java | 27 +
.../serviceregistry/api/registry/WatchAction.java | 43 ++
.../api/request/CreateSchemaRequest.java | 30 +
.../api/request/CreateServiceRequest.java | 35 +
.../api/request/RegisterInstanceRequest.java | 35 +
.../api/request/UpdatePropertiesRequest.java | 35 +
.../api/response/CreateServiceResponse.java | 33 +
.../api/response/FindInstancesResponse.java | 37 +
.../api/response/GetAllServicesResponse.java | 37 +
.../api/response/GetExistenceResponse.java | 43 ++
.../api/response/GetInstancesResponse.java | 37 +
.../api/response/GetSchemaResponse.java | 30 +
.../api/response/GetServiceResponse.java | 35 +
.../api/response/HeartbeatResponse.java | 43 ++
.../response/MicroserviceInstanceChangedEvent.java | 57 ++
.../api/response/MicroserviceInstanceResponse.java | 35 +
.../api/response/RegisterInstanceResponse.java | 33 +
.../serviceregistry/cache/CacheEndpoint.java | 44 ++
.../serviceregistry/cache/InstanceCache.java | 137 ++++
.../cache/InstanceCacheManager.java | 27 +
.../cache/InstanceCacheManagerNew.java | 42 ++
.../cache/MicroserviceInstanceCache.java | 67 ++
.../serviceregistry/client/ClientException.java | 30 +
.../serviceregistry/client/Endpoints.java | 67 ++
.../serviceregistry/client/IpPortManager.java | 114 +++
.../client/LocalServiceRegistryClientImpl.java | 375 ++++++++++
.../client/ServiceRegistryClient.java | 143 ++++
.../client/http/AbstractClientPool.java | 66 ++
.../serviceregistry/client/http/ClientPool.java | 33 +
.../client/http/EmptyAuthHeaderProvider.java | 30 +
.../client/http/HttpClientPool.java | 66 ++
.../client/http/MicroserviceInstances.java | 56 ++
.../client/http/RequestContext.java | 78 +++
.../serviceregistry/client/http/RequestParam.java | 145 ++++
.../serviceregistry/client/http/RestResponse.java | 51 ++
.../serviceregistry/client/http/RestUtils.java | 215 ++++++
.../client/http/ServiceRegistryClientImpl.java | 713 +++++++++++++++++++
.../client/http/WebsocketClientPool.java | 57 ++
.../client/http/WebsocketUtils.java | 73 ++
.../config/AbstractPropertiesLoader.java | 98 +++
.../config/ConfigurePropertyUtils.java | 83 +++
.../config/InstancePropertiesLoader.java | 31 +
.../config/MicroservicePropertiesLoader.java | 33 +
.../config/ServiceRegistryConfig.java | 312 +++++++++
.../serviceregistry/consumer/AppManager.java | 68 ++
.../DefaultMicroserviceVersionFactory.java | 27 +
.../consumer/MicroserviceManager.java | 73 ++
.../consumer/MicroserviceVersion.java | 45 ++
.../consumer/MicroserviceVersionFactory.java | 22 +
.../consumer/MicroserviceVersionRule.java | 159 +++++
.../consumer/MicroserviceVersions.java | 199 ++++++
.../definition/DefinitionConst.java | 37 +
.../definition/MicroserviceDefinition.java | 154 +++++
.../discovery/AbstractDiscoveryFilter.java | 39 ++
.../discovery/AbstractEndpointDiscoveryFilter.java | 84 +++
.../discovery/DiscoveryContext.java | 70 ++
.../serviceregistry/discovery/DiscoveryFilter.java | 31 +
.../serviceregistry/discovery/DiscoveryTree.java | 137 ++++
.../discovery/DiscoveryTreeNode.java | 86 +++
.../registry/AbstractServiceRegistry.java | 285 ++++++++
.../registry/LocalServiceRegistry.java | 35 +
.../registry/RemoteServiceRegistry.java | 113 +++
.../registry/ServiceRegistryFactory.java | 84 +++
.../serviceregistry/task/AbstractRegisterTask.java | 48 ++
.../serviceregistry/task/AbstractTask.java | 68 ++
.../serviceregistry/task/CompositeTask.java | 38 +
.../serviceregistry/task/HeartbeatResult.java | 23 +
.../task/MicroserviceInstanceHeartbeatTask.java | 88 +++
.../task/MicroserviceInstanceRegisterTask.java | 86 +++
.../task/MicroserviceRegisterTask.java | 153 +++++
.../task/MicroserviceServiceCenterTask.java | 33 +
.../task/MicroserviceWatchTask.java | 128 ++++
.../serviceregistry/task/ServiceCenterTask.java | 95 +++
.../task/ServiceCenterTaskMonitor.java | 54 ++
.../serviceregistry/task/TaskStatus.java | 23 +
.../serviceregistry/task/event/ExceptionEvent.java | 29 +
.../task/event/HeartbeatFailEvent.java | 27 +
.../task/event/HeartbeatSuccEvent.java | 27 +
.../task/event/PeriodicPullEvent.java | 22 +
.../PullMicroserviceVersionsInstancesEvent.java | 39 ++
.../serviceregistry/task/event/RecoveryEvent.java | 21 +
.../serviceregistry/task/event/ShutdownEvent.java | 21 +
.../serviceregistry/version/Version.java | 136 ++++
.../serviceregistry/version/VersionRule.java | 39 ++
.../version/VersionRuleFixedParser.java | 42 ++
.../version/VersionRuleLatestParser.java | 46 ++
.../serviceregistry/version/VersionRuleParser.java | 23 +
.../version/VersionRuleRangeParser.java | 50 ++
.../version/VersionRuleStartFromParser.java | 46 ++
.../serviceregistry/version/VersionRuleUtils.java | 60 ++
.../serviceregistry/version/VersionUtils.java | 33 +
....servicecomb.foundation.auth.AuthHeaderProvider | 18 -
....servicecomb.foundation.auth.AuthHeaderProvider | 18 +
.../MicroServicePropertyExtendedStub.java | 36 -
.../servicecomb/serviceregistry/TestRegistry.java | 229 -------
.../servicecomb/serviceregistry/api/TestConst.java | 82 ---
.../serviceregistry/api/TestMicroserviceKey.java | 65 --
.../serviceregistry/api/registry/TestBasePath.java | 60 --
.../api/registry/TestFramework.java | 39 --
.../api/registry/TestHealthCheck.java | 76 --
.../api/registry/TestMicroService.java | 104 ---
.../api/registry/TestMicroServiceInstance.java | 127 ----
.../api/registry/TestMicroserviceFactory.java | 62 --
.../api/request/TestCreateSchemaRequest.java | 32 -
.../api/request/TestCreateServiceRequest.java | 60 --
.../api/request/TestRegisterInstanceRequest.java | 60 --
.../api/request/TestUpdatePropertiesRequest.java | 37 -
.../api/response/TestCreateServiceResponse.java | 53 --
.../api/response/TestFindInstancesResponse.java | 64 --
.../api/response/TestGetAllServicesResponse.java | 65 --
.../api/response/TestGetExistenceResponse.java | 56 --
.../api/response/TestGetInstancesResponse.java | 64 --
.../api/response/TestGetServiceResponse.java | 59 --
.../api/response/TestHeartbeatResponse.java | 56 --
.../TestMicroserviceInstanceChangedEvent.java | 80 ---
.../response/TestMicroserviceInstanceResponse.java | 36 -
.../api/response/TestRegisterInstanceResponse.java | 53 --
.../serviceregistry/cache/TestInstanceCache.java | 78 ---
.../cache/TestInstanceCacheManagerNew.java | 69 --
.../client/LocalServiceRegistryClientImplTest.java | 177 -----
.../client/ServiceRegistryDemo.java | 32 -
.../serviceregistry/client/TestEndpoints.java | 44 --
.../serviceregistry/client/TestIpPortManager.java | 156 -----
.../client/http/MockAuthHeaderProvider.java | 32 -
.../serviceregistry/client/http/RestUtilsTest.java | 46 --
.../client/http/TestClientHttp.java | 155 -----
.../client/http/TestClientPool.java | 59 --
.../client/http/TestMicroserviceInstances.java | 78 ---
.../client/http/TestServiceRegistryClientImpl.java | 261 -------
.../config/TestConfigurePropertyUtils.java | 54 --
.../config/TestPropertiesLoader.java | 122 ----
.../config/TestServiceRegistryConfig.java | 73 --
.../consumer/MicroserviceVersionTestUtils.java | 38 -
.../serviceregistry/consumer/TestAppManager.java | 100 ---
.../TestDefaultMicroserviceVersionFactory.java | 45 --
.../consumer/TestMicroserviceManager.java | 115 ----
.../consumer/TestMicroserviceVersion.java | 54 --
.../consumer/TestMicroserviceVersionRule.java | 115 ----
.../consumer/TestMicroserviceVersions.java | 281 --------
.../discovery/TestAbstractDiscoveryFilter.java | 98 ---
.../TestAbstractTransportDiscoveryFilter.java | 181 -----
.../discovery/TestDiscoveryContext.java | 55 --
.../discovery/TestDiscoveryTree.java | 236 -------
.../discovery/TestDiscoveryTreeNode.java | 79 ---
.../registry/TestAbstractServiceRegistry.java | 112 ---
.../registry/TestLocalServiceRegistry.java | 103 ---
.../registry/TestRemoteServiceRegistry.java | 137 ----
.../registry/TestServiceRegistryFactory.java | 69 --
.../task/TestAbstractRegisterTask.java | 93 ---
.../serviceregistry/task/TestCompositeTask.java | 39 --
.../TestMicroserviceInstanceHeartbeatTask.java | 188 -----
.../task/TestMicroserviceInstanceRegisterTask.java | 176 -----
.../task/TestMicroserviceRegisterTask.java | 232 -------
.../task/TestMicroserviceWatchTask.java | 230 -------
.../task/TestServiceCenterTask.java | 93 ---
.../serviceregistry/version/TestVersion.java | 172 -----
.../serviceregistry/version/TestVersionRule.java | 46 --
.../version/TestVersionRuleFixedParser.java | 40 --
.../version/TestVersionRuleLatestParser.java | 50 --
.../version/TestVersionRuleRangeParser.java | 47 --
.../version/TestVersionRuleStartFromParser.java | 47 --
.../version/TestVersionRuleUtils.java | 71 --
.../serviceregistry/version/TestVersionUtils.java | 47 --
.../serviceregistry/version/VersionConst.java | 28 -
.../MicroServicePropertyExtendedStub.java | 36 +
.../servicecomb/serviceregistry/TestRegistry.java | 230 +++++++
.../servicecomb/serviceregistry/api/TestConst.java | 81 +++
.../serviceregistry/api/TestMicroserviceKey.java | 65 ++
.../serviceregistry/api/registry/TestBasePath.java | 60 ++
.../api/registry/TestFramework.java | 39 ++
.../api/registry/TestHealthCheck.java | 76 ++
.../api/registry/TestMicroService.java | 104 +++
.../api/registry/TestMicroServiceInstance.java | 127 ++++
.../api/registry/TestMicroserviceFactory.java | 62 ++
.../api/request/TestCreateSchemaRequest.java | 32 +
.../api/request/TestCreateServiceRequest.java | 59 ++
.../api/request/TestRegisterInstanceRequest.java | 59 ++
.../api/request/TestUpdatePropertiesRequest.java | 37 +
.../api/response/TestCreateServiceResponse.java | 53 ++
.../api/response/TestFindInstancesResponse.java | 63 ++
.../api/response/TestGetAllServicesResponse.java | 64 ++
.../api/response/TestGetExistenceResponse.java | 56 ++
.../api/response/TestGetInstancesResponse.java | 63 ++
.../api/response/TestGetServiceResponse.java | 58 ++
.../api/response/TestHeartbeatResponse.java | 56 ++
.../TestMicroserviceInstanceChangedEvent.java | 79 +++
.../response/TestMicroserviceInstanceResponse.java | 34 +
.../api/response/TestRegisterInstanceResponse.java | 53 ++
.../serviceregistry/cache/TestInstanceCache.java | 77 +++
.../cache/TestInstanceCacheManagerNew.java | 69 ++
.../client/LocalServiceRegistryClientImplTest.java | 175 +++++
.../client/ServiceRegistryDemo.java | 32 +
.../serviceregistry/client/TestEndpoints.java | 43 ++
.../serviceregistry/client/TestIpPortManager.java | 156 +++++
.../client/http/MockAuthHeaderProvider.java | 32 +
.../serviceregistry/client/http/RestUtilsTest.java | 46 ++
.../client/http/TestClientHttp.java | 155 +++++
.../client/http/TestClientPool.java | 59 ++
.../client/http/TestMicroserviceInstances.java | 77 +++
.../client/http/TestServiceRegistryClientImpl.java | 260 +++++++
.../config/TestConfigurePropertyUtils.java | 53 ++
.../config/TestPropertiesLoader.java | 121 ++++
.../config/TestServiceRegistryConfig.java | 72 ++
.../consumer/MicroserviceVersionTestUtils.java | 39 ++
.../serviceregistry/consumer/TestAppManager.java | 100 +++
.../TestDefaultMicroserviceVersionFactory.java | 45 ++
.../consumer/TestMicroserviceManager.java | 115 ++++
.../consumer/TestMicroserviceVersion.java | 54 ++
.../consumer/TestMicroserviceVersionRule.java | 114 +++
.../consumer/TestMicroserviceVersions.java | 281 ++++++++
.../discovery/TestAbstractDiscoveryFilter.java | 98 +++
.../TestAbstractTransportDiscoveryFilter.java | 180 +++++
.../discovery/TestDiscoveryContext.java | 55 ++
.../discovery/TestDiscoveryTree.java | 236 +++++++
.../discovery/TestDiscoveryTreeNode.java | 78 +++
.../registry/TestAbstractServiceRegistry.java | 112 +++
.../registry/TestLocalServiceRegistry.java | 102 +++
.../registry/TestRemoteServiceRegistry.java | 137 ++++
.../registry/TestServiceRegistryFactory.java | 69 ++
.../task/TestAbstractRegisterTask.java | 93 +++
.../serviceregistry/task/TestCompositeTask.java | 39 ++
.../TestMicroserviceInstanceHeartbeatTask.java | 188 +++++
.../task/TestMicroserviceInstanceRegisterTask.java | 176 +++++
.../task/TestMicroserviceRegisterTask.java | 232 +++++++
.../task/TestMicroserviceWatchTask.java | 230 +++++++
.../task/TestServiceCenterTask.java | 96 +++
.../serviceregistry/version/TestVersion.java | 172 +++++
.../serviceregistry/version/TestVersionRule.java | 46 ++
.../version/TestVersionRuleFixedParser.java | 40 ++
.../version/TestVersionRuleLatestParser.java | 49 ++
.../version/TestVersionRuleRangeParser.java | 47 ++
.../version/TestVersionRuleStartFromParser.java | 47 ++
.../version/TestVersionRuleUtils.java | 70 ++
.../serviceregistry/version/TestVersionUtils.java | 47 ++
.../serviceregistry/version/VersionConst.java | 28 +
....servicecomb.foundation.auth.AuthHeaderProvider | 18 -
....servicecomb.foundation.auth.AuthHeaderProvider | 18 +
.../src/test/resources/microservice.yaml | 4 +-
.../starter/discovery/CseDiscoveryClient.java | 85 ---
.../discovery/CseDiscoveryClientConfiguration.java | 34 -
.../discovery/CseRibbonClientConfiguration.java | 40 --
.../starter/discovery/CseRibbonConfiguration.java | 34 -
.../starter/discovery/ServiceCombServerList.java | 72 --
.../springboot/starter/discovery/package-info.java | 17 -
.../starter/discovery/CseDiscoveryClient.java | 84 +++
.../discovery/CseDiscoveryClientConfiguration.java | 34 +
.../discovery/CseRibbonClientConfiguration.java | 40 ++
.../starter/discovery/CseRibbonConfiguration.java | 34 +
.../starter/discovery/ServiceCombServerList.java | 72 ++
.../springboot/starter/discovery/package-info.java | 17 +
.../src/main/resources/META-INF/spring.factories | 10 +-
.../starter/discovery/TestCseDiscoveryClient.java | 84 ---
.../TestCseDiscoveryClientConfiguration.java | 12 -
.../TestCseRibbonClientConfiguration.java | 16 -
.../discovery/TestServiceCombServerList.java | 76 --
.../starter/discovery/TestCseDiscoveryClient.java | 84 +++
.../TestCseDiscoveryClientConfiguration.java | 12 +
.../TestCseRibbonClientConfiguration.java | 16 +
.../discovery/TestServiceCombServerList.java | 76 ++
.../starter/registry/CseAutoConfiguration.java | 27 -
.../starter/registry/RegistryIntializer.java | 50 --
.../starter/registry/CseAutoConfiguration.java | 27 +
.../starter/registry/RegistryIntializer.java | 49 ++
.../src/main/resources/META-INF/spring.factories | 2 +-
.../starter/registry/TestCseAutoConfiguration.java | 59 --
.../starter/registry/TestCseAutoConfiguration.java | 59 ++
.../starter/provider/EnableServiceComb.java | 34 -
.../provider/ServiceCombSpringConfiguration.java | 35 -
.../springboot/starter/provider/package-info.java | 25 -
.../starter/provider/EnableServiceComb.java | 34 +
.../provider/ServiceCombSpringConfiguration.java | 34 +
.../springboot/starter/provider/package-info.java | 25 +
.../starter/transport/RestServletInitializer.java | 70 --
.../springboot/starter/transport/package-info.java | 24 -
.../starter/transport/RestServletInitializer.java | 69 ++
.../springboot/starter/transport/package-info.java | 24 +
.../transport/TestRestServletInitializer.java | 113 ---
.../transport/TestRestServletInitializer.java | 112 +++
.../zuul/tracing/SpringTracingConfiguration.java | 104 ---
.../cloud/zuul/tracing/TracePostZuulFilter.java | 73 --
.../cloud/zuul/tracing/TracePreZuulFilter.java | 115 ----
.../zuul/tracing/SpringTracingConfiguration.java | 104 +++
.../cloud/zuul/tracing/TracePostZuulFilter.java | 73 ++
.../cloud/zuul/tracing/TracePreZuulFilter.java | 115 ++++
.../tracing/SpringTracingConfigurationTest.java | 78 ---
.../tracing/SpringTracingConfigurationTest.java | 78 +++
.../spring/cloud/zuul/ContextHeaderZuulFilter.java | 75 --
.../spring/cloud/zuul/ContextHeaderZuulFilter.java | 74 ++
.../java/io/servicecomb/swagger/SwaggerUtils.java | 117 ----
.../swagger/converter/AbstractConverter.java | 56 --
.../servicecomb/swagger/converter/Converter.java | 28 -
.../swagger/converter/ConverterMgr.java | 206 ------
.../converter/model/AbstractModelConverter.java | 29 -
.../converter/model/ArrayModelConverter.java | 42 --
.../converter/model/ModelImplConverter.java | 59 --
.../swagger/converter/model/RefModelConverter.java | 33 -
.../AbstractSerializableParameterConverter.java | 55 --
.../parameter/BodyParameterConverter.java | 34 -
.../property/AbstractPropertyConverter.java | 29 -
.../converter/property/ArrayPropertyConverter.java | 56 --
.../converter/property/MapPropertyConverter.java | 46 --
.../converter/property/RefPropertyConverter.java | 33 -
.../property/StringPropertyConverter.java | 89 ---
.../io/servicecomb/swagger/extend/ExtendConst.java | 28 -
.../swagger/extend/ModelResolverExt.java | 159 -----
.../extend/annotations/RawJsonRequestBody.java | 39 --
.../extend/annotations/ResponseHeaders.java | 31 -
.../swagger/extend/parameter/ContextParameter.java | 26 -
.../extend/parameter/HttpRequestParameter.java | 23 -
.../property/AbstractBaseIntegerProperty.java | 134 ----
.../swagger/extend/property/ByteProperty.java | 35 -
.../swagger/extend/property/ShortProperty.java | 35 -
.../property/creator/ByteArrayPropertyCreator.java | 36 -
.../property/creator/BytePropertyCreator.java | 36 -
.../creator/InputStreamPropertyCreator.java | 38 -
.../property/creator/PartPropertyCreator.java | 37 -
.../extend/property/creator/PropertyCreator.java | 26 -
.../property/creator/ShortPropertyCreator.java | 36 -
.../core/AbstractSwaggerGeneratorContext.java | 184 -----
.../generator/core/AnnotationProcessorManager.java | 46 --
.../generator/core/ClassAnnotationProcessor.java | 22 -
.../core/CommonParameterTypeProcessor.java | 25 -
.../core/CompositeSwaggerGeneratorContext.java | 66 --
.../generator/core/DefaultParameterProcessor.java | 27 -
.../generator/core/MethodAnnotationProcessor.java | 22 -
.../swagger/generator/core/OperationGenerator.java | 370 ----------
.../core/ParameterAnnotationProcessor.java | 23 -
.../generator/core/ParameterTypeProcessor.java | 22 -
.../generator/core/ResponseTypeProcessor.java | 26 -
.../swagger/generator/core/SwaggerConst.java | 34 -
.../swagger/generator/core/SwaggerGenerator.java | 311 ---------
.../generator/core/SwaggerGeneratorContext.java | 51 --
.../swagger/generator/core/package-info.java | 22 -
.../core/processor/annotation/AnnotationUtils.java | 221 ------
.../annotation/ApiImplicitParamClassProcessor.java | 33 -
.../ApiImplicitParamMethodProcessor.java | 33 -
.../ApiImplicitParamsClassProcessor.java | 36 -
.../ApiImplicitParamsMethodProcessor.java | 36 -
.../annotation/ApiOperationProcessor.java | 119 ----
.../core/processor/annotation/ApiProcessor.java | 43 --
.../annotation/ApiResponseClassProcessor.java | 31 -
.../annotation/ApiResponseMethodProcessor.java | 34 -
.../annotation/ApiResponsesClassProcessor.java | 35 -
.../annotation/ApiResponsesMethodProcessor.java | 36 -
.../annotation/ResponseHeaderProcessor.java | 38 -
.../annotation/ResponseHeadersProcessor.java | 36 -
.../annotation/SwaggerDefinitionProcessor.java | 159 -----
.../annotation/models/ResponseConfig.java | 75 --
.../annotation/models/ResponseConfigBase.java | 65 --
.../annotation/models/ResponseHeaderConfig.java | 34 -
.../core/processor/annotation/package-info.java | 21 -
.../parameter/AbstractParameterProcessor.java | 60 --
.../parametertype/HttpServletRequestProcessor.java | 37 -
.../parametertype/RawJsonRequestBodyProcessor.java | 33 -
.../AbstractOneGenericResponseProcessor.java | 41 --
.../response/CompletableFutureProcessor.java | 27 -
.../response/DefaultResponseTypeProcessor.java | 41 --
.../core/unittest/SwaggerGeneratorForTest.java | 77 ---
.../core/unittest/UnitTestSwaggerUtils.java | 132 ----
.../generator/core/unittest/package-info.java | 21 -
.../swagger/generator/core/utils/ClassUtils.java | 260 -------
.../swagger/generator/core/utils/ParamUtils.java | 156 -----
.../pojo/PojoSwaggerGeneratorContext.java | 135 ----
.../parameter/PendingBodyParameterConverter.java | 34 -
.../extend/parameter/PendingBodyParameter.java | 100 ---
.../swagger/generator/pojo/package-info.java | 20 -
.../parameter/PojoDefaultParameterProcessor.java | 33 -
.../generator/pojo/utils/PojoParamUtils.java | 53 --
.../rest/RestSwaggerGeneratorContext.java | 45 --
.../apache/servicecomb/swagger/SwaggerUtils.java | 117 ++++
.../swagger/converter/AbstractConverter.java | 57 ++
.../servicecomb/swagger/converter/Converter.java | 28 +
.../swagger/converter/ConverterMgr.java | 207 ++++++
.../converter/model/AbstractModelConverter.java | 30 +
.../converter/model/ArrayModelConverter.java | 43 ++
.../converter/model/ModelImplConverter.java | 60 ++
.../swagger/converter/model/RefModelConverter.java | 34 +
.../AbstractSerializableParameterConverter.java | 56 ++
.../parameter/BodyParameterConverter.java | 35 +
.../property/AbstractPropertyConverter.java | 30 +
.../converter/property/ArrayPropertyConverter.java | 57 ++
.../converter/property/MapPropertyConverter.java | 47 ++
.../converter/property/RefPropertyConverter.java | 34 +
.../property/StringPropertyConverter.java | 90 +++
.../servicecomb/swagger/extend/ExtendConst.java | 28 +
.../swagger/extend/ModelResolverExt.java | 159 +++++
.../extend/annotations/RawJsonRequestBody.java | 39 ++
.../extend/annotations/ResponseHeaders.java | 31 +
.../swagger/extend/parameter/ContextParameter.java | 26 +
.../extend/parameter/HttpRequestParameter.java | 23 +
.../property/AbstractBaseIntegerProperty.java | 134 ++++
.../swagger/extend/property/ByteProperty.java | 35 +
.../swagger/extend/property/ShortProperty.java | 35 +
.../property/creator/ByteArrayPropertyCreator.java | 36 +
.../property/creator/BytePropertyCreator.java | 37 +
.../creator/InputStreamPropertyCreator.java | 38 +
.../property/creator/PartPropertyCreator.java | 37 +
.../extend/property/creator/PropertyCreator.java | 26 +
.../property/creator/ShortPropertyCreator.java | 37 +
.../core/AbstractSwaggerGeneratorContext.java | 184 +++++
.../generator/core/AnnotationProcessorManager.java | 46 ++
.../generator/core/ClassAnnotationProcessor.java | 22 +
.../core/CommonParameterTypeProcessor.java | 25 +
.../core/CompositeSwaggerGeneratorContext.java | 65 ++
.../generator/core/DefaultParameterProcessor.java | 27 +
.../generator/core/MethodAnnotationProcessor.java | 22 +
.../swagger/generator/core/OperationGenerator.java | 370 ++++++++++
.../core/ParameterAnnotationProcessor.java | 23 +
.../generator/core/ParameterTypeProcessor.java | 22 +
.../generator/core/ResponseTypeProcessor.java | 26 +
.../swagger/generator/core/SwaggerConst.java | 34 +
.../swagger/generator/core/SwaggerGenerator.java | 311 +++++++++
.../generator/core/SwaggerGeneratorContext.java | 51 ++
.../swagger/generator/core/package-info.java | 22 +
.../core/processor/annotation/AnnotationUtils.java | 221 ++++++
.../annotation/ApiImplicitParamClassProcessor.java | 34 +
.../ApiImplicitParamMethodProcessor.java | 34 +
.../ApiImplicitParamsClassProcessor.java | 37 +
.../ApiImplicitParamsMethodProcessor.java | 37 +
.../annotation/ApiOperationProcessor.java | 119 ++++
.../core/processor/annotation/ApiProcessor.java | 43 ++
.../annotation/ApiResponseClassProcessor.java | 32 +
.../annotation/ApiResponseMethodProcessor.java | 35 +
.../annotation/ApiResponsesClassProcessor.java | 36 +
.../annotation/ApiResponsesMethodProcessor.java | 37 +
.../annotation/ResponseHeaderProcessor.java | 39 ++
.../annotation/ResponseHeadersProcessor.java | 37 +
.../annotation/SwaggerDefinitionProcessor.java | 159 +++++
.../annotation/models/ResponseConfig.java | 76 ++
.../annotation/models/ResponseConfigBase.java | 65 ++
.../annotation/models/ResponseHeaderConfig.java | 34 +
.../core/processor/annotation/package-info.java | 21 +
.../parameter/AbstractParameterProcessor.java | 61 ++
.../parametertype/HttpServletRequestProcessor.java | 37 +
.../parametertype/RawJsonRequestBodyProcessor.java | 34 +
.../AbstractOneGenericResponseProcessor.java | 42 ++
.../response/CompletableFutureProcessor.java | 27 +
.../response/DefaultResponseTypeProcessor.java | 42 ++
.../core/unittest/SwaggerGeneratorForTest.java | 77 +++
.../core/unittest/UnitTestSwaggerUtils.java | 132 ++++
.../generator/core/unittest/package-info.java | 21 +
.../swagger/generator/core/utils/ClassUtils.java | 260 +++++++
.../swagger/generator/core/utils/ParamUtils.java | 156 +++++
.../pojo/PojoSwaggerGeneratorContext.java | 135 ++++
.../parameter/PendingBodyParameterConverter.java | 35 +
.../extend/parameter/PendingBodyParameter.java | 101 +++
.../swagger/generator/pojo/package-info.java | 20 +
.../parameter/PojoDefaultParameterProcessor.java | 33 +
.../generator/pojo/utils/PojoParamUtils.java | 54 ++
.../rest/RestSwaggerGeneratorContext.java | 44 ++
...ger.generator.core.CommonParameterTypeProcessor | 18 -
...mb.swagger.generator.core.ResponseTypeProcessor | 18 -
....swagger.generator.core.SwaggerGeneratorContext | 18 -
.../services/io.swagger.converter.ModelConverter | 2 +-
...ger.generator.core.CommonParameterTypeProcessor | 18 +
...mb.swagger.generator.core.ResponseTypeProcessor | 18 +
....swagger.generator.core.SwaggerGeneratorContext | 18 +
.../io/servicecomb/swagger/TestSwaggerUtils.java | 177 -----
.../property/creator/TestPartPropertyCreator.java | 42 --
.../generator/core/TestApiImplicitParams.java | 62 --
.../swagger/generator/core/TestApiOperation.java | 171 -----
.../swagger/generator/core/TestApiResponse.java | 137 ----
.../swagger/generator/core/TestArrayType.java | 52 --
.../swagger/generator/core/TestClassUtils.java | 207 ------
.../swagger/generator/core/TestInvalidType.java | 103 ---
.../generator/core/TestOperationGenerator.java | 104 ---
.../swagger/generator/core/TestParamUtils.java | 45 --
.../swagger/generator/core/TestProperty.java | 53 --
.../generator/core/TestSwaggerDefinition.java | 136 ----
.../generator/core/TestSwaggerGenerator.java | 58 --
.../swagger/generator/core/TestSwaggerUtils.java | 247 -------
.../annotation/ApiOperationProcessorTest.java | 74 --
.../processor/annotation/ApiProcessorTest.java | 63 --
.../annotation/SwaggerDefinitionProcessorTest.java | 75 --
.../TestAbstractOneGenericResponseProcessor.java | 61 --
.../response/TestCompletableFutureProcessor.java | 31 -
.../swagger/generator/core/schema/AllType.java | 66 --
.../swagger/generator/core/schema/ArrayType.java | 27 -
.../swagger/generator/core/schema/Color.java | 23 -
.../core/schema/InvalidResponseHeader.java | 26 -
.../swagger/generator/core/schema/InvalidType.java | 65 --
.../generator/core/schema/RepeatOperation.java | 27 -
.../swagger/generator/core/schema/Schema.java | 185 -----
.../swagger/generator/core/schema/User.java | 24 -
.../servicecomb/swagger/TestSwaggerUtils.java | 177 +++++
.../property/creator/TestPartPropertyCreator.java | 42 ++
.../generator/core/TestApiImplicitParams.java | 62 ++
.../swagger/generator/core/TestApiOperation.java | 171 +++++
.../swagger/generator/core/TestApiResponse.java | 137 ++++
.../swagger/generator/core/TestArrayType.java | 52 ++
.../swagger/generator/core/TestClassUtils.java | 207 ++++++
.../swagger/generator/core/TestInvalidType.java | 102 +++
.../generator/core/TestOperationGenerator.java | 104 +++
.../swagger/generator/core/TestParamUtils.java | 45 ++
.../swagger/generator/core/TestProperty.java | 53 ++
.../generator/core/TestSwaggerDefinition.java | 136 ++++
.../generator/core/TestSwaggerGenerator.java | 57 ++
.../swagger/generator/core/TestSwaggerUtils.java | 247 +++++++
.../annotation/ApiOperationProcessorTest.java | 74 ++
.../processor/annotation/ApiProcessorTest.java | 63 ++
.../annotation/SwaggerDefinitionProcessorTest.java | 75 ++
.../TestAbstractOneGenericResponseProcessor.java | 61 ++
.../response/TestCompletableFutureProcessor.java | 31 +
.../swagger/generator/core/schema/AllType.java | 66 ++
.../swagger/generator/core/schema/ArrayType.java | 27 +
.../swagger/generator/core/schema/Color.java | 23 +
.../core/schema/InvalidResponseHeader.java | 26 +
.../swagger/generator/core/schema/InvalidType.java | 65 ++
.../generator/core/schema/RepeatOperation.java | 27 +
.../swagger/generator/core/schema/Schema.java | 185 +++++
.../swagger/generator/core/schema/User.java | 24 +
.../src/test/resources/schemas/allMethod.yaml | 14 +-
.../src/test/resources/schemas/allType.yaml | 8 +-
.../src/test/resources/schemas/apiOperation.yaml | 2 +-
.../src/test/resources/schemas/apiResponse.yaml | 2 +-
.../src/test/resources/schemas/array.yaml | 2 +-
.../src/test/resources/schemas/boolean.yaml | 2 +-
.../src/test/resources/schemas/booleanObject.yaml | 2 +-
.../src/test/resources/schemas/byte.yaml | 2 +-
.../src/test/resources/schemas/byteObject.yaml | 2 +-
.../src/test/resources/schemas/bytes.yaml | 2 +-
.../src/test/resources/schemas/bytesObject.yaml | 2 +-
.../src/test/resources/schemas/char.yaml | 2 +-
.../src/test/resources/schemas/charObject.yaml | 2 +-
.../test/resources/schemas/completableFuture.yaml | 2 +-
.../src/test/resources/schemas/date.yaml | 2 +-
.../src/test/resources/schemas/double.yaml | 2 +-
.../src/test/resources/schemas/doubleObject.yaml | 2 +-
.../src/test/resources/schemas/enum.yaml | 6 +-
.../src/test/resources/schemas/float.yaml | 2 +-
.../src/test/resources/schemas/floatObject.yaml | 2 +-
.../src/test/resources/schemas/int.yaml | 2 +-
.../src/test/resources/schemas/intObject.yaml | 2 +-
.../src/test/resources/schemas/list.yaml | 4 +-
.../src/test/resources/schemas/long.yaml | 2 +-
.../src/test/resources/schemas/longObject.yaml | 2 +-
.../src/test/resources/schemas/map.yaml | 4 +-
.../src/test/resources/schemas/mapList.yaml | 4 +-
.../src/test/resources/schemas/multiParam.yaml | 10 +-
.../src/test/resources/schemas/object.yaml | 4 +-
.../src/test/resources/schemas/responseHeader.yaml | 2 +-
.../src/test/resources/schemas/set.yaml | 2 +-
.../src/test/resources/schemas/short.yaml | 2 +-
.../src/test/resources/schemas/shortObject.yaml | 2 +-
.../src/test/resources/schemas/string.yaml | 2 +-
.../jaxrs/JaxrsSwaggerGeneratorContext.java | 114 ---
.../annotation/ConsumesAnnotationProcessor.java | 38 -
.../annotation/CookieParamAnnotationProcessor.java | 35 -
.../annotation/FormParamAnnotationProcessor.java | 35 -
.../annotation/HeaderParamAnnotationProcessor.java | 35 -
.../annotation/HttpMethodAnnotationProcessor.java | 35 -
.../annotation/PathClassAnnotationProcessor.java | 33 -
.../annotation/PathMethodAnnotationProcessor.java | 32 -
.../annotation/PathParamAnnotationProcessor.java | 35 -
.../annotation/ProducesAnnotationProcessor.java | 38 -
.../annotation/QueryParamAnnotationProcessor.java | 35 -
.../parameter/JaxrsDefaultParameterProcessor.java | 32 -
.../processor/response/JaxrsResponseProcessor.java | 55 --
.../jaxrs/JaxrsSwaggerGeneratorContext.java | 114 +++
.../annotation/ConsumesAnnotationProcessor.java | 37 +
.../annotation/CookieParamAnnotationProcessor.java | 36 +
.../annotation/FormParamAnnotationProcessor.java | 36 +
.../annotation/HeaderParamAnnotationProcessor.java | 36 +
.../annotation/HttpMethodAnnotationProcessor.java | 35 +
.../annotation/PathClassAnnotationProcessor.java | 33 +
.../annotation/PathMethodAnnotationProcessor.java | 32 +
.../annotation/PathParamAnnotationProcessor.java | 36 +
.../annotation/ProducesAnnotationProcessor.java | 37 +
.../annotation/QueryParamAnnotationProcessor.java | 36 +
.../parameter/JaxrsDefaultParameterProcessor.java | 33 +
.../processor/response/JaxrsResponseProcessor.java | 56 ++
...mb.swagger.generator.core.ResponseTypeProcessor | 18 -
....swagger.generator.core.SwaggerGeneratorContext | 18 -
...mb.swagger.generator.core.ResponseTypeProcessor | 18 +
....swagger.generator.core.SwaggerGeneratorContext | 18 +
.../swagger/generator/jaxrs/ClassMethodNoPath.java | 28 -
.../servicecomb/swagger/generator/jaxrs/Echo.java | 102 ---
.../swagger/generator/jaxrs/MultiDefaultPath.java | 33 -
.../swagger/generator/jaxrs/TestJaxrs.java | 114 ---
.../servicecomb/swagger/generator/jaxrs/User.java | 22 -
.../swagger/generator/jaxrs/ClassMethodNoPath.java | 28 +
.../servicecomb/swagger/generator/jaxrs/Echo.java | 103 +++
.../swagger/generator/jaxrs/MultiDefaultPath.java | 33 +
.../swagger/generator/jaxrs/TestJaxrs.java | 113 +++
.../servicecomb/swagger/generator/jaxrs/User.java | 22 +
.../src/test/resources/schemas/cookie.yaml | 2 +-
.../src/test/resources/schemas/echo.yaml | 4 +-
.../src/test/resources/schemas/emptyContract.yaml | 2 +-
.../src/test/resources/schemas/emptyPath.yaml | 2 +-
.../src/test/resources/schemas/form.yaml | 2 +-
.../src/test/resources/schemas/query.yaml | 2 +-
.../resources/schemas/rawJsonStringMethod.yaml | 2 +-
.../src/test/resources/schemas/response.yaml | 2 +-
.../springmvc/MultipartFilePropertyCreator.java | 39 --
.../SpringmvcSwaggerGeneratorContext.java | 118 ----
...stractHttpMethodMappingAnnotationProcessor.java | 64 --
.../annotation/CookieValueAnnotationProcessor.java | 35 -
.../DeleteMappingMethodAnnotationProcessor.java | 46 --
.../GetMappingMethodAnnotationProcessor.java | 46 --
.../PatchMappingMethodAnnotationProcessor.java | 46 --
.../PathVariableAnnotationProcessor.java | 35 -
.../PostMappingMethodAnnotationProcessor.java | 46 --
.../PutMappingMethodAnnotationProcessor.java | 46 --
.../RequestAttributeAnnotationProcessor.java | 35 -
.../annotation/RequestBodyAnnotationProcessor.java | 31 -
.../RequestHeaderAnnotationProcessor.java | 45 --
.../RequestMappingClassAnnotationProcessor.java | 86 ---
.../RequestMappingMethodAnnotationProcessor.java | 62 --
.../RequestParamAnnotationProcessor.java | 35 -
.../annotation/RequestPartAnnotationProcessor.java | 35 -
.../parameter/MultipartFileTypeProcessor.java | 41 --
.../SpringmvcDefaultParameterProcessor.java | 39 --
.../response/ResponseEntityProcessor.java | 28 -
.../springmvc/MultipartFilePropertyCreator.java | 39 ++
.../SpringmvcSwaggerGeneratorContext.java | 117 ++++
...stractHttpMethodMappingAnnotationProcessor.java | 64 ++
.../annotation/CookieValueAnnotationProcessor.java | 35 +
.../DeleteMappingMethodAnnotationProcessor.java | 46 ++
.../GetMappingMethodAnnotationProcessor.java | 46 ++
.../PatchMappingMethodAnnotationProcessor.java | 46 ++
.../PathVariableAnnotationProcessor.java | 35 +
.../PostMappingMethodAnnotationProcessor.java | 46 ++
.../PutMappingMethodAnnotationProcessor.java | 46 ++
.../RequestAttributeAnnotationProcessor.java | 35 +
.../annotation/RequestBodyAnnotationProcessor.java | 32 +
.../RequestHeaderAnnotationProcessor.java | 45 ++
.../RequestMappingClassAnnotationProcessor.java | 86 +++
.../RequestMappingMethodAnnotationProcessor.java | 62 ++
.../RequestParamAnnotationProcessor.java | 35 +
.../annotation/RequestPartAnnotationProcessor.java | 35 +
.../parameter/MultipartFileTypeProcessor.java | 41 ++
.../SpringmvcDefaultParameterProcessor.java | 40 ++
.../response/ResponseEntityProcessor.java | 27 +
...swagger.extend.property.creator.PropertyCreator | 18 -
...ger.generator.core.CommonParameterTypeProcessor | 18 -
...mb.swagger.generator.core.ResponseTypeProcessor | 18 -
....swagger.generator.core.SwaggerGeneratorContext | 18 -
...swagger.extend.property.creator.PropertyCreator | 18 +
...ger.generator.core.CommonParameterTypeProcessor | 18 +
...mb.swagger.generator.core.ResponseTypeProcessor | 18 +
....swagger.generator.core.SwaggerGeneratorContext | 18 +
.../springmvc/ClassMethodNoHttpMethod.java | 28 -
.../generator/springmvc/ClassMethodNoPath.java | 29 -
.../generator/springmvc/ClassMultiHttpMethod.java | 26 -
.../generator/springmvc/ClassMultiPath.java | 25 -
.../swagger/generator/springmvc/Echo.java | 47 --
.../springmvc/MethodDefaultParameter.java | 54 --
.../generator/springmvc/MethodEmptyPath.java | 63 --
.../springmvc/MethodMixupAnnotations.java | 89 ---
.../generator/springmvc/MethodMultiPath.java | 58 --
.../generator/springmvc/MethodResponseEntity.java | 63 --
.../generator/springmvc/MultiDefaultPath.java | 34 -
.../springmvc/TestResponseEntityProcessor.java | 32 -
.../swagger/generator/springmvc/TestSpringmvc.java | 182 -----
.../swagger/generator/springmvc/User.java | 22 -
.../springmvc/ClassMethodNoHttpMethod.java | 28 +
.../generator/springmvc/ClassMethodNoPath.java | 29 +
.../generator/springmvc/ClassMultiHttpMethod.java | 26 +
.../generator/springmvc/ClassMultiPath.java | 25 +
.../swagger/generator/springmvc/Echo.java | 46 ++
.../springmvc/MethodDefaultParameter.java | 54 ++
.../generator/springmvc/MethodEmptyPath.java | 63 ++
.../springmvc/MethodMixupAnnotations.java | 89 +++
.../generator/springmvc/MethodMultiPath.java | 58 ++
.../generator/springmvc/MethodResponseEntity.java | 63 ++
.../generator/springmvc/MultiDefaultPath.java | 34 +
.../springmvc/TestResponseEntityProcessor.java | 31 +
.../swagger/generator/springmvc/TestSpringmvc.java | 182 +++++
.../swagger/generator/springmvc/User.java | 22 +
.../test/resources/schemas/MethodEmptyPath.yaml | 2 +-
.../test/resources/schemas/defaultParameter.yaml | 2 +-
.../src/test/resources/schemas/emptyPath.yaml | 2 +-
.../test/resources/schemas/inheritHttpMethod.yaml | 2 +-
.../test/resources/schemas/mixupAnnotations.yaml | 4 +-
.../resources/schemas/rawJsonStringMethod.yaml | 2 +-
.../src/test/resources/schemas/responseEntity.yaml | 4 +-
.../swagger/engine/SwaggerBootstrap.java | 21 -
.../swagger/engine/SwaggerConsumer.java | 52 --
.../swagger/engine/SwaggerConsumerOperation.java | 74 --
.../swagger/engine/SwaggerEnvironment.java | 199 ------
.../swagger/engine/SwaggerProducer.java | 57 --
.../swagger/engine/SwaggerProducerOperation.java | 163 -----
.../swagger/engine/bootstrap/BootstrapNormal.java | 49 --
.../engine/unittest/LocalProducerInvoker.java | 94 ---
.../parameter/InvocationContextParameter.java | 24 -
.../swagger/invocation/AsyncResponse.java | 48 --
.../swagger/invocation/InvocationType.java | 23 -
.../servicecomb/swagger/invocation/Response.java | 190 -----
.../swagger/invocation/SwaggerInvocation.java | 60 --
.../invocation/arguments/ArgumentMapper.java | 24 -
.../arguments/ArgumentsMapperConfig.java | 60 --
.../arguments/ArgumentsMapperFactory.java | 186 -----
.../arguments/ContextArgumentMapperFactory.java | 24 -
.../swagger/invocation/arguments/FieldInfo.java | 40 --
.../invocation/arguments/ProviderParameter.java | 46 --
.../arguments/consumer/ConsumerArgumentSame.java | 42 --
.../consumer/ConsumerArgumentToBodyField.java | 84 ---
.../consumer/ConsumerArgumentsMapper.java | 55 --
.../consumer/ConsumerArgumentsMapperFactory.java | 66 --
.../consumer/ConsumerInvocationContextMapper.java | 36 -
.../ConsumerInvocationContextMapperFactory.java | 40 --
.../producer/AbstractProducerContextArgMapper.java | 37 -
.../arguments/producer/ProducerArgumentSame.java | 43 --
.../producer/ProducerArgumentsMapper.java | 49 --
.../producer/ProducerArgumentsMapperFactory.java | 65 --
.../producer/ProducerInvocationContextMapper.java | 32 -
.../ProducerInvocationContextMapperFactory.java | 40 --
.../SwaggerArgumentToProducerBodyField.java | 57 --
.../swagger/invocation/context/ContextUtils.java | 48 --
.../swagger/invocation/context/HttpStatus.java | 23 -
.../invocation/context/HttpStatusManager.java | 20 -
.../invocation/context/InvocationContext.java | 85 ---
.../swagger/invocation/converter/Converter.java | 21 -
.../swagger/invocation/converter/ConverterMgr.java | 167 -----
.../invocation/converter/CustomizedConverter.java | 25 -
.../invocation/converter/impl/ConverterCommon.java | 38 -
.../invocation/converter/impl/ConverterSame.java | 35 -
.../converter/impl/SameElementArrayToList.java | 42 --
.../converter/impl/SameElementArrayToSet.java | 46 --
.../impl/SameElementCollectionToArray.java | 42 --
.../converter/impl/part/FileToPartConverter.java | 48 --
.../impl/part/InputStreamToPartConverter.java | 48 --
.../impl/part/ResourceToPartConverter.java | 48 --
.../invocation/exception/CommonExceptionData.java | 45 --
.../DefaultExceptionToResponseConverter.java | 39 --
.../invocation/exception/ExceptionFactory.java | 130 ----
.../exception/ExceptionToResponseConverter.java | 26 -
.../exception/ExceptionToResponseConverters.java | 49 --
.../invocation/exception/InvocationException.java | 91 ---
.../InvocationExceptionToResponseConverter.java | 32 -
.../generator/InvocationContextProcessor.java | 36 -
.../swagger/invocation/response/Headers.java | 77 ---
.../invocation/response/ResponseMapperFactory.java | 35 -
.../response/ResponseMapperFactorys.java | 64 --
.../swagger/invocation/response/ResponseMeta.java | 64 --
.../swagger/invocation/response/ResponsesMeta.java | 89 ---
...letableFutureConsumerResponseMapperFactory.java | 41 --
.../response/consumer/ConsumerResponseMapper.java | 23 -
.../consumer/ConsumerResponseMapperFactory.java | 22 -
.../CseResponseConsumerResponseMapperFactory.java | 37 -
.../consumer/DefaultConsumerResponseMapper.java | 33 -
.../DefaultConsumerResponseMapperFactory.java | 49 --
...letableFutureProducerResponseMapperFactory.java | 41 --
.../CseResponseProducerResponseMapperFactory.java | 37 -
.../producer/DefaultProducerResponseMapper.java | 36 -
.../DefaultProducerResponseMapperFactory.java | 49 --
.../response/producer/ProducerResponseMapper.java | 25 -
.../producer/ProducerResponseMapperFactory.java | 23 -
.../swagger/engine/SwaggerBootstrap.java | 21 +
.../swagger/engine/SwaggerConsumer.java | 52 ++
.../swagger/engine/SwaggerConsumerOperation.java | 74 ++
.../swagger/engine/SwaggerEnvironment.java | 199 ++++++
.../swagger/engine/SwaggerProducer.java | 57 ++
.../swagger/engine/SwaggerProducerOperation.java | 163 +++++
.../swagger/engine/bootstrap/BootstrapNormal.java | 49 ++
.../engine/unittest/LocalProducerInvoker.java | 94 +++
.../parameter/InvocationContextParameter.java | 24 +
.../swagger/invocation/AsyncResponse.java | 48 ++
.../swagger/invocation/InvocationType.java | 23 +
.../servicecomb/swagger/invocation/Response.java | 190 +++++
.../swagger/invocation/SwaggerInvocation.java | 60 ++
.../invocation/arguments/ArgumentMapper.java | 24 +
.../arguments/ArgumentsMapperConfig.java | 60 ++
.../arguments/ArgumentsMapperFactory.java | 185 +++++
.../arguments/ContextArgumentMapperFactory.java | 24 +
.../swagger/invocation/arguments/FieldInfo.java | 40 ++
.../invocation/arguments/ProviderParameter.java | 46 ++
.../arguments/consumer/ConsumerArgumentSame.java | 42 ++
.../consumer/ConsumerArgumentToBodyField.java | 84 +++
.../consumer/ConsumerArgumentsMapper.java | 55 ++
.../consumer/ConsumerArgumentsMapperFactory.java | 65 ++
.../consumer/ConsumerInvocationContextMapper.java | 36 +
.../ConsumerInvocationContextMapperFactory.java | 39 ++
.../producer/AbstractProducerContextArgMapper.java | 37 +
.../arguments/producer/ProducerArgumentSame.java | 43 ++
.../producer/ProducerArgumentsMapper.java | 49 ++
.../producer/ProducerArgumentsMapperFactory.java | 64 ++
.../producer/ProducerInvocationContextMapper.java | 32 +
.../ProducerInvocationContextMapperFactory.java | 39 ++
.../SwaggerArgumentToProducerBodyField.java | 57 ++
.../swagger/invocation/context/ContextUtils.java | 48 ++
.../swagger/invocation/context/HttpStatus.java | 23 +
.../invocation/context/HttpStatusManager.java | 20 +
.../invocation/context/InvocationContext.java | 85 +++
.../swagger/invocation/converter/Converter.java | 21 +
.../swagger/invocation/converter/ConverterMgr.java | 166 +++++
.../invocation/converter/CustomizedConverter.java | 25 +
.../invocation/converter/impl/ConverterCommon.java | 38 +
.../invocation/converter/impl/ConverterSame.java | 35 +
.../converter/impl/SameElementArrayToList.java | 42 ++
.../converter/impl/SameElementArrayToSet.java | 46 ++
.../impl/SameElementCollectionToArray.java | 42 ++
.../converter/impl/part/FileToPartConverter.java | 47 ++
.../impl/part/InputStreamToPartConverter.java | 47 ++
.../impl/part/ResourceToPartConverter.java | 47 ++
.../invocation/exception/CommonExceptionData.java | 45 ++
.../DefaultExceptionToResponseConverter.java | 38 +
.../invocation/exception/ExceptionFactory.java | 130 ++++
.../exception/ExceptionToResponseConverter.java | 26 +
.../exception/ExceptionToResponseConverters.java | 49 ++
.../invocation/exception/InvocationException.java | 91 +++
.../InvocationExceptionToResponseConverter.java | 32 +
.../generator/InvocationContextProcessor.java | 36 +
.../swagger/invocation/response/Headers.java | 77 +++
.../invocation/response/ResponseMapperFactory.java | 35 +
.../response/ResponseMapperFactorys.java | 63 ++
.../swagger/invocation/response/ResponseMeta.java | 65 ++
.../swagger/invocation/response/ResponsesMeta.java | 90 +++
...letableFutureConsumerResponseMapperFactory.java | 41 ++
.../response/consumer/ConsumerResponseMapper.java | 23 +
.../consumer/ConsumerResponseMapperFactory.java | 22 +
.../CseResponseConsumerResponseMapperFactory.java | 37 +
.../consumer/DefaultConsumerResponseMapper.java | 33 +
.../DefaultConsumerResponseMapperFactory.java | 49 ++
...letableFutureProducerResponseMapperFactory.java | 41 ++
.../CseResponseProducerResponseMapperFactory.java | 37 +
.../producer/DefaultProducerResponseMapper.java | 36 +
.../DefaultProducerResponseMapperFactory.java | 49 ++
.../response/producer/ProducerResponseMapper.java | 25 +
.../producer/ProducerResponseMapperFactory.java | 23 +
...ger.generator.core.CommonParameterTypeProcessor | 18 -
...vocation.exception.ExceptionToResponseConverter | 19 -
...response.consumer.ConsumerResponseMapperFactory | 20 -
...response.producer.ProducerResponseMapperFactory | 20 -
...ger.generator.core.CommonParameterTypeProcessor | 18 +
...vocation.exception.ExceptionToResponseConverter | 19 +
...response.consumer.ConsumerResponseMapperFactory | 20 +
...response.producer.ProducerResponseMapperFactory | 20 +
.../java/io/servicecomb/core/TestException.java | 70 --
.../java/io/servicecomb/core/TestResponse.java | 129 ----
.../servicecomb/engine/TestSwaggerEnvironment.java | 53 --
.../engine/TestSwaggerProducerOperation.java | 51 --
.../arguments/TestPojoConsumerEqualProducer.java | 195 ------
.../arguments/TestPojoConsumerEqualSwagger.java | 219 ------
.../swagger/invocation/arguments/utils/Utils.java | 30 -
.../impl/part/TestFileToPartConverter.java | 47 --
.../impl/part/TestInputStreamToPartConverter.java | 47 --
.../impl/part/TestResourceToPartConverter.java | 48 --
.../exception/ErrorToResponseConverter.java | 34 -
.../TestDefaultExceptionToResponseConverter.java | 39 --
.../invocation/exception/TestExceptionFactory.java | 35 -
.../TestExceptionToResponseConverters.java | 71 --
...TestInvocationExceptionToResponseConverter.java | 39 --
.../swagger/invocation/models/JaxrsImpl.java | 118 ----
.../swagger/invocation/models/Person.java | 42 --
.../invocation/models/PojoConsumerIntf.java | 55 --
.../swagger/invocation/models/PojoImpl.java | 84 ---
.../swagger/invocation/models/ProducerImpl.java | 32 -
.../swagger/invocation/models/SpringmvcImpl.java | 22 -
.../swagger/invocation/response/TestHeaders.java | 66 --
.../response/TestResponseMapperFactorys.java | 83 ---
.../invocation/response/TestResponsesMeta.java | 70 --
...letableFutureConsumerResponseMapperFactory.java | 77 ---
...stCseResponseConsumerResponseMapperFactory.java | 44 --
.../TestDefaultConsumerResponseMapper.java | 38 -
.../TestDefaultConsumerResponseMapperFactory.java | 52 --
...letableFutureProducerResponseMapperFactory.java | 77 ---
...stCseResponseProducerResponseMapperFactory.java | 46 --
.../TestDefaultProducerResponseMapper.java | 41 --
.../TestDefaultProducerResponseMapperFactory.java | 56 --
.../org/apache/servicecomb/core/TestException.java | 69 ++
.../org/apache/servicecomb/core/TestResponse.java | 128 ++++
.../servicecomb/engine/TestSwaggerEnvironment.java | 52 ++
.../engine/TestSwaggerProducerOperation.java | 51 ++
.../arguments/TestPojoConsumerEqualProducer.java | 194 ++++++
.../arguments/TestPojoConsumerEqualSwagger.java | 218 ++++++
.../swagger/invocation/arguments/utils/Utils.java | 30 +
.../impl/part/TestFileToPartConverter.java | 47 ++
.../impl/part/TestInputStreamToPartConverter.java | 47 ++
.../impl/part/TestResourceToPartConverter.java | 48 ++
.../exception/ErrorToResponseConverter.java | 34 +
.../TestDefaultExceptionToResponseConverter.java | 39 ++
.../invocation/exception/TestExceptionFactory.java | 34 +
.../TestExceptionToResponseConverters.java | 71 ++
...TestInvocationExceptionToResponseConverter.java | 39 ++
.../swagger/invocation/models/JaxrsImpl.java | 118 ++++
.../swagger/invocation/models/Person.java | 42 ++
.../invocation/models/PojoConsumerIntf.java | 56 ++
.../swagger/invocation/models/PojoImpl.java | 85 +++
.../swagger/invocation/models/ProducerImpl.java | 32 +
.../swagger/invocation/models/SpringmvcImpl.java | 22 +
.../swagger/invocation/response/TestHeaders.java | 66 ++
.../response/TestResponseMapperFactorys.java | 83 +++
.../invocation/response/TestResponsesMeta.java | 70 ++
...letableFutureConsumerResponseMapperFactory.java | 76 ++
...stCseResponseConsumerResponseMapperFactory.java | 43 ++
.../TestDefaultConsumerResponseMapper.java | 37 +
.../TestDefaultConsumerResponseMapperFactory.java | 51 ++
...letableFutureProducerResponseMapperFactory.java | 76 ++
...stCseResponseProducerResponseMapperFactory.java | 45 ++
.../TestDefaultProducerResponseMapper.java | 40 ++
.../TestDefaultProducerResponseMapperFactory.java | 55 ++
...vocation.exception.ExceptionToResponseConverter | 1 -
...vocation.exception.ExceptionToResponseConverter | 18 +
.../response/JaxrsConsumerResponseMapper.java | 43 --
.../JaxrsConsumerResponseMapperFactory.java | 38 -
.../response/JaxrsProducerResponseMapper.java | 44 --
.../JaxrsProducerResponseMapperFactory.java | 38 -
.../response/JaxrsConsumerResponseMapper.java | 43 ++
.../JaxrsConsumerResponseMapperFactory.java | 38 +
.../response/JaxrsProducerResponseMapper.java | 44 ++
.../JaxrsProducerResponseMapperFactory.java | 38 +
...response.consumer.ConsumerResponseMapperFactory | 18 -
...response.producer.ProducerResponseMapperFactory | 18 -
...response.consumer.ConsumerResponseMapperFactory | 18 +
...response.producer.ProducerResponseMapperFactory | 18 +
.../response/TestJaxrsConsumerResponseMapper.java | 104 ---
.../TestJaxrsConsumerResponseMapperFactory.java | 43 --
.../response/TestJaxrsProducerResponseMapper.java | 74 --
.../TestJaxrsProducerResponseMapperFactory.java | 43 --
.../response/TestJaxrsConsumerResponseMapper.java | 104 +++
.../TestJaxrsConsumerResponseMapperFactory.java | 43 ++
.../response/TestJaxrsProducerResponseMapper.java | 74 ++
.../TestJaxrsProducerResponseMapperFactory.java | 43 ++
.../invocation/converter/PartToMultipartFile.java | 77 ---
.../converter/SpringMultipartConverter.java | 47 --
.../response/SpringmvcConsumerResponseMapper.java | 55 --
.../SpringmvcConsumerResponseMapperFactory.java | 45 --
.../response/SpringmvcProducerResponseMapper.java | 68 --
.../SpringmvcProducerResponseMapperFactory.java | 45 --
.../invocation/converter/PartToMultipartFile.java | 77 +++
.../converter/SpringMultipartConverter.java | 47 ++
.../response/SpringmvcConsumerResponseMapper.java | 54 ++
.../SpringmvcConsumerResponseMapperFactory.java | 44 ++
.../response/SpringmvcProducerResponseMapper.java | 67 ++
.../SpringmvcProducerResponseMapperFactory.java | 44 ++
...response.consumer.ConsumerResponseMapperFactory | 18 -
...response.producer.ProducerResponseMapperFactory | 18 -
...response.consumer.ConsumerResponseMapperFactory | 18 +
...response.producer.ProducerResponseMapperFactory | 18 +
.../converter/TestPartToMultipartFile.java | 186 -----
.../TestSpringmvcConsumerResponseMapper.java | 68 --
...TestSpringmvcConsumerResponseMapperFactory.java | 102 ---
.../TestSpringmvcProducerResponseMapper.java | 91 ---
...TestSpringmvcProducerResponseMapperFactory.java | 81 ---
.../converter/TestPartToMultipartFile.java | 186 +++++
.../TestSpringmvcConsumerResponseMapper.java | 68 ++
...TestSpringmvcConsumerResponseMapperFactory.java | 101 +++
.../TestSpringmvcProducerResponseMapper.java | 94 +++
...TestSpringmvcProducerResponseMapperFactory.java | 80 +++
tracing/README.md | 2 +-
.../src/main/java/io/servicecomb/tracing/Span.java | 31 -
.../java/org/apache/servicecomb/tracing/Span.java | 31 +
.../tracing/zipkin/EnableZipkinTracing.java | 35 -
.../tracing/zipkin/ZipkinSpanAspect.java | 59 --
.../tracing/zipkin/ZipkinSpanAspectConfig.java | 33 -
.../tracing/zipkin/ZipkinTracingAdviser.java | 59 --
.../tracing/zipkin/EnableZipkinTracing.java | 35 +
.../tracing/zipkin/ZipkinSpanAspect.java | 59 ++
.../tracing/zipkin/ZipkinSpanAspectConfig.java | 33 +
.../tracing/zipkin/ZipkinTracingAdviser.java | 59 ++
.../tracing/zipkin/ZipkinSpanAspectTest.java | 117 ----
.../tracing/zipkin/ZipkinTracingAdviserTest.java | 159 -----
.../zipkin/app/ZipkinSpanTestApplication.java | 57 --
.../tracing/zipkin/ZipkinSpanAspectTest.java | 116 ++++
.../tracing/zipkin/ZipkinTracingAdviserTest.java | 160 +++++
.../zipkin/app/ZipkinSpanTestApplication.java | 56 ++
.../transport/highway/HighwayClient.java | 123 ----
.../transport/highway/HighwayClientConnection.java | 76 --
.../highway/HighwayClientConnectionPool.java | 32 -
.../transport/highway/HighwayClientPackage.java | 49 --
.../highway/HighwayClientPoolFactory.java | 33 -
.../transport/highway/HighwayCodec.java | 99 ---
.../transport/highway/HighwayConfig.java | 45 --
.../transport/highway/HighwayOutputStream.java | 63 --
.../transport/highway/HighwayServer.java | 34 -
.../transport/highway/HighwayServerConnection.java | 123 ----
.../transport/highway/HighwayServerInvoke.java | 224 ------
.../transport/highway/HighwayServerVerticle.java | 79 ---
.../transport/highway/HighwayTransport.java | 60 --
.../io/servicecomb/transport/highway/MsgType.java | 26 -
.../transport/highway/message/LoginRequest.java | 76 --
.../transport/highway/message/LoginResponse.java | 76 --
.../transport/highway/message/RequestHeader.java | 117 ----
.../transport/highway/message/ResponseHeader.java | 95 ---
.../transport/highway/HighwayClient.java | 123 ++++
.../transport/highway/HighwayClientConnection.java | 76 ++
.../highway/HighwayClientConnectionPool.java | 33 +
.../transport/highway/HighwayClientPackage.java | 49 ++
.../highway/HighwayClientPoolFactory.java | 34 +
.../transport/highway/HighwayCodec.java | 100 +++
.../transport/highway/HighwayConfig.java | 45 ++
.../transport/highway/HighwayOutputStream.java | 64 ++
.../transport/highway/HighwayServer.java | 34 +
.../transport/highway/HighwayServerConnection.java | 123 ++++
.../transport/highway/HighwayServerInvoke.java | 224 ++++++
.../transport/highway/HighwayServerVerticle.java | 79 +++
.../transport/highway/HighwayTransport.java | 60 ++
.../servicecomb/transport/highway/MsgType.java | 26 +
.../transport/highway/message/LoginRequest.java | 77 +++
.../transport/highway/message/LoginResponse.java | 77 +++
.../transport/highway/message/RequestHeader.java | 118 ++++
.../transport/highway/message/ResponseHeader.java | 96 +++
.../io/servicecomb/transport/common/MockUtil.java | 89 ---
.../transport/highway/TestHighwayClient.java | 249 -------
.../transport/highway/TestHighwayCodec.java | 221 ------
.../transport/highway/TestHighwayConfig.java | 38 -
.../highway/TestHighwayServerConnection.java | 223 ------
.../transport/highway/TestHighwayServerInvoke.java | 116 ----
.../transport/highway/TestHighwayTransport.java | 94 ---
.../transport/highway/TestHighwayVerticle.java | 85 ---
.../highway/message/TestLoginRequest.java | 32 -
.../highway/message/TestLoginResponse.java | 32 -
.../highway/message/TestRequestHeader.java | 75 --
.../highway/message/TestResponseHeader.java | 51 --
.../servicecomb/transport/common/MockUtil.java | 89 +++
.../transport/highway/TestHighwayClient.java | 249 +++++++
.../transport/highway/TestHighwayCodec.java | 221 ++++++
.../transport/highway/TestHighwayConfig.java | 38 +
.../highway/TestHighwayServerConnection.java | 223 ++++++
.../transport/highway/TestHighwayServerInvoke.java | 116 ++++
.../transport/highway/TestHighwayTransport.java | 94 +++
.../transport/highway/TestHighwayVerticle.java | 85 +++
.../highway/message/TestLoginRequest.java | 32 +
.../highway/message/TestLoginResponse.java | 32 +
.../highway/message/TestRequestHeader.java | 75 ++
.../highway/message/TestResponseHeader.java | 51 ++
.../transport/rest/client/RestTransportClient.java | 72 --
.../rest/client/RestTransportClientManager.java | 42 --
.../rest/client/TransportClientConfig.java | 46 --
.../rest/client/http/DefaultHttpClientFilter.java | 100 ---
.../rest/client/http/VertxHttpMethod.java | 184 -----
.../transport/rest/client/RestTransportClient.java | 72 ++
.../rest/client/RestTransportClientManager.java | 43 ++
.../rest/client/TransportClientConfig.java | 43 ++
.../rest/client/http/DefaultHttpClientFilter.java | 100 +++
.../rest/client/http/VertxHttpMethod.java | 184 +++++
...servicecomb.common.rest.filter.HttpClientFilter | 18 -
...servicecomb.common.rest.filter.HttpClientFilter | 18 +
.../rest/client/TestRestTransportClient.java | 105 ---
.../rest/client/TestTransportClientConfig.java | 43 --
.../client/http/TestDefaultHttpClientFilter.java | 156 -----
.../rest/client/http/TestVertxHttpMethod.java | 300 --------
.../rest/client/TestRestTransportClient.java | 105 +++
.../rest/client/TestTransportClientConfig.java | 43 ++
.../client/http/TestDefaultHttpClientFilter.java | 157 +++++
.../rest/client/http/TestVertxHttpMethod.java | 300 ++++++++
.../rest/servlet/CseXmlWebApplicationContext.java | 86 ---
.../transport/rest/servlet/RestAsyncListener.java | 95 ---
.../transport/rest/servlet/RestServlet.java | 52 --
.../rest/servlet/RestServletContextListener.java | 64 --
.../rest/servlet/RestServletInjector.java | 71 --
.../servlet/RestServletProducerInvocation.java | 42 --
.../transport/rest/servlet/ServletConfig.java | 53 --
.../rest/servlet/ServletRestDispatcher.java | 59 --
.../rest/servlet/ServletRestTransport.java | 81 ---
.../transport/rest/servlet/ServletUtils.java | 134 ----
.../rest/servlet/CseXmlWebApplicationContext.java | 85 +++
.../transport/rest/servlet/RestAsyncListener.java | 94 +++
.../transport/rest/servlet/RestServlet.java | 52 ++
.../rest/servlet/RestServletContextListener.java | 63 ++
.../rest/servlet/RestServletInjector.java | 71 ++
.../servlet/RestServletProducerInvocation.java | 42 ++
.../transport/rest/servlet/ServletConfig.java | 53 ++
.../rest/servlet/ServletRestDispatcher.java | 59 ++
.../rest/servlet/ServletRestTransport.java | 80 +++
.../transport/rest/servlet/ServletUtils.java | 133 ++++
.../servlet/TestCseXmlWebApplicationContext.java | 124 ----
.../rest/servlet/TestRestAsyncListener.java | 133 ----
.../transport/rest/servlet/TestRestServlet.java | 75 --
.../servlet/TestRestServletContextListener.java | 57 --
.../rest/servlet/TestRestServletInjector.java | 84 ---
.../servlet/TestRestServletProducerInvocation.java | 104 ---
.../transport/rest/servlet/TestServletConfig.java | 58 --
.../rest/servlet/TestServletRestDispatcher.java | 79 ---
.../rest/servlet/TestServletRestTransport.java | 167 -----
.../transport/rest/servlet/TestServletUtils.java | 182 -----
.../servlet/TestCseXmlWebApplicationContext.java | 124 ++++
.../rest/servlet/TestRestAsyncListener.java | 133 ++++
.../transport/rest/servlet/TestRestServlet.java | 75 ++
.../servlet/TestRestServletContextListener.java | 57 ++
.../rest/servlet/TestRestServletInjector.java | 84 +++
.../servlet/TestRestServletProducerInvocation.java | 104 +++
.../transport/rest/servlet/TestServletConfig.java | 57 ++
.../rest/servlet/TestServletRestDispatcher.java | 79 +++
.../rest/servlet/TestServletRestTransport.java | 167 +++++
.../transport/rest/servlet/TestServletUtils.java | 182 +++++
.../rest/vertx/AbstractVertxHttpDispatcher.java | 58 --
.../transport/rest/vertx/RestBodyHandler.java | 263 -------
.../transport/rest/vertx/RestServerVerticle.java | 143 ----
.../transport/rest/vertx/TransportConfig.java | 43 --
.../transport/rest/vertx/VertxHttpDispatcher.java | 26 -
.../transport/rest/vertx/VertxRestDispatcher.java | 84 ---
.../transport/rest/vertx/VertxRestTransport.java | 85 ---
.../vertx/accesslog/AccessLogConfiguration.java | 50 --
.../rest/vertx/accesslog/AccessLogParam.java | 65 --
.../vertx/accesslog/element/AccessLogElement.java | 33 -
.../element/impl/BytesWrittenV1Element.java | 42 --
.../element/impl/BytesWrittenV2Element.java | 45 --
.../accesslog/element/impl/CookieElement.java | 60 --
.../element/impl/DatetimeConfigurableElement.java | 114 ---
.../element/impl/DurationMillisecondElement.java | 28 -
.../element/impl/DurationSecondElement.java | 28 -
.../element/impl/FirstLineOfRequestElement.java | 43 --
.../accesslog/element/impl/LocalHostElement.java | 49 --
.../accesslog/element/impl/LocalPortElement.java | 43 --
.../accesslog/element/impl/MethodElement.java | 45 --
.../accesslog/element/impl/PlainTextElement.java | 37 -
.../accesslog/element/impl/QueryOnlyElement.java | 43 --
.../accesslog/element/impl/RemoteHostElement.java | 49 --
.../element/impl/RequestHeaderElement.java | 53 --
.../element/impl/ResponseHeaderElement.java | 58 --
.../accesslog/element/impl/StatusElement.java | 37 -
.../element/impl/UriPathIncludeQueryElement.java | 44 --
.../accesslog/element/impl/UriPathOnlyElement.java | 43 --
.../element/impl/VersionOrProtocolElement.java | 53 --
.../vertx/accesslog/impl/AccessLogHandler.java | 71 --
.../parser/AccessLogElementExtraction.java | 77 ---
.../accesslog/parser/AccessLogPatternParser.java | 24 -
.../parser/impl/DefaultAccessLogPatternParser.java | 127 ----
.../parser/matcher/AccessLogElementMatcher.java | 35 -
.../parser/matcher/impl/BytesWrittenV1Matcher.java | 36 -
.../parser/matcher/impl/BytesWrittenV2Matcher.java | 36 -
.../impl/ConfigurableAccessLogElementMatcher.java | 73 --
.../parser/matcher/impl/CookieElementMatcher.java | 42 --
.../matcher/impl/DatetimeConfigurableMatcher.java | 51 --
.../parser/matcher/impl/DatetimeMatcher.java | 36 -
.../matcher/impl/DurationMillisecondMatcher.java | 36 -
.../parser/matcher/impl/DurationSecondMatcher.java | 36 -
.../matcher/impl/FirstLineOfRequestMatcher.java | 36 -
.../impl/ImmutableAccessLogElementMatcher.java | 53 --
.../parser/matcher/impl/LocalHostMatcher.java | 36 -
.../parser/matcher/impl/LocalPortMatcher.java | 36 -
.../parser/matcher/impl/MethodMatcher.java | 37 -
.../impl/MultiPatternImmutableElementMatcher.java | 39 --
.../parser/matcher/impl/QueryOnlyMatcher.java | 36 -
.../parser/matcher/impl/RemoteHostMatcher.java | 36 -
.../matcher/impl/RequestHeaderElementMatcher.java | 42 --
.../matcher/impl/ResponseHeaderElementMatcher.java | 42 --
.../impl/SinglePatternImmutableElementMatcher.java | 37 -
.../parser/matcher/impl/StatusMatcher.java | 36 -
.../matcher/impl/UriPathIncludeQueryMatcher.java | 72 --
.../parser/matcher/impl/UriPathOnlyMatcher.java | 36 -
.../matcher/impl/VersionOrProtocolMatcher.java | 36 -
.../rest/vertx/AbstractVertxHttpDispatcher.java | 58 ++
.../transport/rest/vertx/RestBodyHandler.java | 264 +++++++
.../transport/rest/vertx/RestServerVerticle.java | 143 ++++
.../transport/rest/vertx/TransportConfig.java | 45 ++
.../transport/rest/vertx/VertxHttpDispatcher.java | 26 +
.../transport/rest/vertx/VertxRestDispatcher.java | 84 +++
.../transport/rest/vertx/VertxRestTransport.java | 85 +++
.../vertx/accesslog/AccessLogConfiguration.java | 50 ++
.../rest/vertx/accesslog/AccessLogParam.java | 65 ++
.../transport/rest/vertx/accesslog/README.md | 0
.../vertx/accesslog/element/AccessLogElement.java | 33 +
.../element/impl/BytesWrittenV1Element.java | 43 ++
.../element/impl/BytesWrittenV2Element.java | 46 ++
.../accesslog/element/impl/CookieElement.java | 61 ++
.../element/impl/DatetimeConfigurableElement.java | 113 +++
.../element/impl/DurationMillisecondElement.java | 28 +
.../element/impl/DurationSecondElement.java | 28 +
.../element/impl/FirstLineOfRequestElement.java | 43 ++
.../accesslog/element/impl/LocalHostElement.java | 49 ++
.../accesslog/element/impl/LocalPortElement.java | 44 ++
.../accesslog/element/impl/MethodElement.java | 46 ++
.../accesslog/element/impl/PlainTextElement.java | 37 +
.../accesslog/element/impl/QueryOnlyElement.java | 43 ++
.../accesslog/element/impl/RemoteHostElement.java | 49 ++
.../element/impl/RequestHeaderElement.java | 54 ++
.../element/impl/ResponseHeaderElement.java | 59 ++
.../accesslog/element/impl/StatusElement.java | 38 +
.../element/impl/UriPathIncludeQueryElement.java | 44 ++
.../accesslog/element/impl/UriPathOnlyElement.java | 44 ++
.../element/impl/VersionOrProtocolElement.java | 54 ++
.../vertx/accesslog/impl/AccessLogHandler.java | 71 ++
.../parser/AccessLogElementExtraction.java | 77 +++
.../accesslog/parser/AccessLogPatternParser.java | 24 +
.../parser/impl/DefaultAccessLogPatternParser.java | 125 ++++
.../parser/matcher/AccessLogElementMatcher.java | 35 +
.../parser/matcher/impl/BytesWrittenV1Matcher.java | 36 +
.../parser/matcher/impl/BytesWrittenV2Matcher.java | 36 +
.../impl/ConfigurableAccessLogElementMatcher.java | 73 ++
.../parser/matcher/impl/CookieElementMatcher.java | 42 ++
.../matcher/impl/DatetimeConfigurableMatcher.java | 51 ++
.../parser/matcher/impl/DatetimeMatcher.java | 36 +
.../matcher/impl/DurationMillisecondMatcher.java | 36 +
.../parser/matcher/impl/DurationSecondMatcher.java | 36 +
.../matcher/impl/FirstLineOfRequestMatcher.java | 36 +
.../impl/ImmutableAccessLogElementMatcher.java | 53 ++
.../parser/matcher/impl/LocalHostMatcher.java | 36 +
.../parser/matcher/impl/LocalPortMatcher.java | 36 +
.../parser/matcher/impl/MethodMatcher.java | 37 +
.../impl/MultiPatternImmutableElementMatcher.java | 39 ++
.../parser/matcher/impl/QueryOnlyMatcher.java | 36 +
.../parser/matcher/impl/RemoteHostMatcher.java | 36 +
.../matcher/impl/RequestHeaderElementMatcher.java | 42 ++
.../matcher/impl/ResponseHeaderElementMatcher.java | 42 ++
.../impl/SinglePatternImmutableElementMatcher.java | 37 +
.../parser/matcher/impl/StatusMatcher.java | 36 +
.../matcher/impl/UriPathIncludeQueryMatcher.java | 72 ++
.../parser/matcher/impl/UriPathOnlyMatcher.java | 36 +
.../matcher/impl/VersionOrProtocolMatcher.java | 36 +
...cecomb.transport.rest.vertx.VertxHttpDispatcher | 18 -
...cecomb.transport.rest.vertx.VertxHttpDispatcher | 18 +
.../main/resources/config/base/log4j.properties | 2 +-
.../rest/vertx/MockForRestServerVerticle.java | 65 --
.../vertx/TestAbstractVertxHttpDispatcher.java | 98 ---
.../rest/vertx/TestRestServerVerticle.java | 135 ----
.../transport/rest/vertx/TestTransportConfig.java | 67 --
.../rest/vertx/TestVertxRestDispatcher.java | 164 -----
.../rest/vertx/TestVertxRestTransport.java | 149 ----
.../accesslog/AccessLogConfigurationTest.java | 38 -
.../element/impl/BytesWrittenV1ElementTest.java | 79 ---
.../element/impl/BytesWrittenV2ElementTest.java | 78 ---
.../accesslog/element/impl/CookieElementTest.java | 101 ---
.../impl/DatetimeConfigurableElementTest.java | 127 ----
.../impl/DurationMillisecondElementTest.java | 38 -
.../element/impl/DurationSecondElementTest.java | 56 --
.../impl/FirstLineOfRequestElementTest.java | 52 --
.../element/impl/LocalHostElementTest.java | 114 ---
.../element/impl/LocalPortElementTest.java | 76 --
.../accesslog/element/impl/MethodElementTest.java | 63 --
.../element/impl/PlainTextElementTest.java | 31 -
.../element/impl/QueryOnlyElementTest.java | 90 ---
.../element/impl/RemoteHostElementTest.java | 117 ----
.../element/impl/RequestHeaderElementTest.java | 84 ---
.../element/impl/ResponseHeaderElementTest.java | 103 ---
.../accesslog/element/impl/StatusElementTest.java | 62 --
.../impl/UriPathIncludeQueryElementTest.java | 94 ---
.../element/impl/UriPathOnlyElementTest.java | 73 --
.../element/impl/VersionOrProtocolElementTest.java | 82 ---
.../vertx/accesslog/impl/AccessLogHandlerTest.java | 97 ---
.../impl/DefaultAccessLogPatternParserTest.java | 107 ---
.../matcher/impl/BytesWrittenV1MatcherTest.java | 63 --
.../matcher/impl/BytesWrittenV2MatcherTest.java | 63 --
.../matcher/impl/CookieElementMatcherTest.java | 65 --
.../impl/DatetimeConfigurableMatcherTest.java | 137 ----
.../parser/matcher/impl/DatetimeMatcherTest.java | 63 --
.../impl/DurationMillisecondMatcherTest.java | 63 --
.../matcher/impl/DurationSecondMatcherTest.java | 63 --
.../impl/FirstLineOfRequestMatcherTest.java | 63 --
.../impl/ImmutableAccessLogElementMatcherTest.java | 81 ---
.../parser/matcher/impl/LocalHostMatcherTest.java | 63 --
.../parser/matcher/impl/LocalPortMatcherTest.java | 63 --
.../parser/matcher/impl/MethodMatcherTest.java | 47 --
.../parser/matcher/impl/QueryOnlyMatcherTest.java | 43 --
.../parser/matcher/impl/RemoteHostMatcherTest.java | 66 --
.../impl/RequestHeaderElementMatcherTest.java | 64 --
.../impl/ResponseHeaderElementMatcherTest.java | 65 --
.../parser/matcher/impl/StatusMatcherTest.java | 41 --
.../impl/UriPathIncludeQueryMatcherTest.java | 52 --
.../matcher/impl/UriPathOnlyMatcherTest.java | 43 --
.../matcher/impl/VersionOrProtocolMatcherTest.java | 66 --
.../rest/vertx/MockForRestServerVerticle.java | 65 ++
.../vertx/TestAbstractVertxHttpDispatcher.java | 98 +++
.../rest/vertx/TestRestServerVerticle.java | 135 ++++
.../transport/rest/vertx/TestTransportConfig.java | 66 ++
.../rest/vertx/TestVertxRestDispatcher.java | 164 +++++
.../rest/vertx/TestVertxRestTransport.java | 149 ++++
.../accesslog/AccessLogConfigurationTest.java | 38 +
.../element/impl/BytesWrittenV1ElementTest.java | 79 +++
.../element/impl/BytesWrittenV2ElementTest.java | 78 +++
.../accesslog/element/impl/CookieElementTest.java | 101 +++
.../impl/DatetimeConfigurableElementTest.java | 126 ++++
.../impl/DurationMillisecondElementTest.java | 37 +
.../element/impl/DurationSecondElementTest.java | 55 ++
.../impl/FirstLineOfRequestElementTest.java | 52 ++
.../element/impl/LocalHostElementTest.java | 114 +++
.../element/impl/LocalPortElementTest.java | 76 ++
.../accesslog/element/impl/MethodElementTest.java | 63 ++
.../element/impl/PlainTextElementTest.java | 31 +
.../element/impl/QueryOnlyElementTest.java | 90 +++
.../element/impl/RemoteHostElementTest.java | 117 ++++
.../element/impl/RequestHeaderElementTest.java | 84 +++
.../element/impl/ResponseHeaderElementTest.java | 103 +++
.../accesslog/element/impl/StatusElementTest.java | 62 ++
.../impl/UriPathIncludeQueryElementTest.java | 94 +++
.../element/impl/UriPathOnlyElementTest.java | 73 ++
.../element/impl/VersionOrProtocolElementTest.java | 82 +++
.../vertx/accesslog/impl/AccessLogHandlerTest.java | 97 +++
.../impl/DefaultAccessLogPatternParserTest.java | 107 +++
.../matcher/impl/BytesWrittenV1MatcherTest.java | 62 ++
.../matcher/impl/BytesWrittenV2MatcherTest.java | 62 ++
.../matcher/impl/CookieElementMatcherTest.java | 64 ++
.../impl/DatetimeConfigurableMatcherTest.java | 137 ++++
.../parser/matcher/impl/DatetimeMatcherTest.java | 62 ++
.../impl/DurationMillisecondMatcherTest.java | 62 ++
.../matcher/impl/DurationSecondMatcherTest.java | 62 ++
.../impl/FirstLineOfRequestMatcherTest.java | 62 ++
.../impl/ImmutableAccessLogElementMatcherTest.java | 80 +++
.../parser/matcher/impl/LocalHostMatcherTest.java | 62 ++
.../parser/matcher/impl/LocalPortMatcherTest.java | 62 ++
.../parser/matcher/impl/MethodMatcherTest.java | 46 ++
.../parser/matcher/impl/QueryOnlyMatcherTest.java | 42 ++
.../parser/matcher/impl/RemoteHostMatcherTest.java | 65 ++
.../impl/RequestHeaderElementMatcherTest.java | 63 ++
.../impl/ResponseHeaderElementMatcherTest.java | 64 ++
.../parser/matcher/impl/StatusMatcherTest.java | 40 ++
.../impl/UriPathIncludeQueryMatcherTest.java | 51 ++
.../matcher/impl/UriPathOnlyMatcherTest.java | 42 ++
.../matcher/impl/VersionOrProtocolMatcherTest.java | 65 ++
3435 files changed, 125101 insertions(+), 125228 deletions(-)
diff --git a/common/common-javassist/pom.xml b/common/common-javassist/pom.xml
index 69e92cf..63fb9bd 100644
--- a/common/common-javassist/pom.xml
+++ b/common/common-javassist/pom.xml
@@ -16,34 +16,34 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>io.servicecomb</groupId>
- <artifactId>common</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- </parent>
- <artifactId>common-javassist</artifactId>
- <name>Java Chassis::Common::Javassist</name>
-
- <dependencies>
- <dependency>
- <groupId>org.javassist</groupId>
- <artifactId>javassist</artifactId>
- </dependency>
- <dependency>
- <groupId>io.servicecomb</groupId>
- <artifactId>foundation-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>io.servicecomb</groupId>
+ <artifactId>common</artifactId>
+ <version>0.6.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>common-javassist</artifactId>
+ <name>Java Chassis::Common::Javassist</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.javassist</groupId>
+ <artifactId>javassist</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.servicecomb</groupId>
+ <artifactId>foundation-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
diff --git a/common/common-javassist/src/main/java/io/servicecomb/common/javassist/ClassConfig.java b/common/common-javassist/src/main/java/io/servicecomb/common/javassist/ClassConfig.java
deleted file mode 100644
index 2777bbd..0000000
--- a/common/common-javassist/src/main/java/io/servicecomb/common/javassist/ClassConfig.java
+++ /dev/null
@@ -1,104 +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.servicecomb.common.javassist;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.fasterxml.jackson.databind.JavaType;
-import com.fasterxml.jackson.databind.type.TypeFactory;
-
-public class ClassConfig {
-
- private String className;
-
- private boolean intf;
-
- private List<String> intfList = new ArrayList<>();
-
- private List<FieldConfig> fieldList = new ArrayList<>();
-
- private List<MethodConfig> methodList = new ArrayList<>();
-
- public boolean isIntf() {
- return intf;
- }
-
- public void setIntf(boolean intf) {
- this.intf = intf;
- }
-
- public String getClassName() {
- return className;
- }
-
- public void setClassName(String className) {
- this.className = className;
- }
-
- public void addInterface(Class<?> intf) {
- addInterface(intf.getName());
- }
-
- public void addInterface(String intf) {
- intfList.add(intf);
- }
-
- public List<String> getIntfList() {
- return intfList;
- }
-
- public List<FieldConfig> getFieldList() {
- return fieldList;
- }
-
- public FieldConfig addField(String name, Type genericType) {
- return addField(name, TypeFactory.defaultInstance().constructType(genericType));
- }
-
- public FieldConfig addField(String name, JavaType javaType) {
- FieldConfig field = new FieldConfig();
- field.setName(name);
- field.setType(javaType);
-
- fieldList.add(field);
-
- return field;
- }
-
- public void addMethod(MethodConfig methodConfig) {
- methodConfig.init();
- methodList.add(methodConfig);
- }
-
- public void addMethod(String source) {
- addMethod(source, null);
- }
-
- public void addMethod(String source, String genericSignature) {
- MethodConfig methodConfig = new MethodConfig();
- methodConfig.setSource(source);
- methodConfig.setGenericSignature(genericSignature);
- addMethod(methodConfig);
- }
-
- public List<MethodConfig> getMethodList() {
- return methodList;
- }
-}
diff --git a/common/common-javassist/src/main/java/io/servicecomb/common/javassist/FieldConfig.java b/common/common-javassist/src/main/java/io/servicecomb/common/javassist/FieldConfig.java
deleted file mode 100644
index f57a396..0000000
--- a/common/common-javassist/src/main/java/io/servicecomb/common/javassist/FieldConfig.java
+++ /dev/null
@@ -1,80 +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.servicecomb.common.javassist;
-
-import org.springframework.util.ClassUtils;
-
-import com.fasterxml.jackson.databind.JavaType;
-
-public class FieldConfig {
- private String name;
-
- // javassist的成员不支持int这样的类型,必须是Integer才行
- private Class<?> rawType;
-
- private JavaType type;
-
- private boolean genGetter;
-
- private boolean genSetter;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Class<?> getRawType() {
- return rawType;
- }
-
- public JavaType getType() {
- return type;
- }
-
- public void setType(JavaType type) {
- this.rawType = ClassUtils.resolvePrimitiveIfNecessary(type.getRawClass());
- this.type = type;
- }
-
- public boolean isGenGetter() {
- return genGetter;
- }
-
- public void setGenGetter(boolean genGetter) {
- this.genGetter = genGetter;
- }
-
- public boolean isGenSetter() {
- return genSetter;
- }
-
- public void setGenSetter(boolean genSetter) {
- this.genSetter = genSetter;
- }
-
- public String getGenericSignature() {
- if (type.hasGenericTypes()) {
- return type.getGenericSignature();
- }
-
- return null;
- }
-}
diff --git a/common/common-javassist/src/main/java/io/servicecomb/common/javassist/JavassistUtils.java b/common/common-javassist/src/main/java/io/servicecomb/common/javassist/JavassistUtils.java
deleted file mode 100644
index 78b46d2..0000000
--- a/common/common-javassist/src/main/java/io/servicecomb/common/javassist/JavassistUtils.java
+++ /dev/null
@@ -1,352 +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.servicecomb.common.javassist;
-
-import static java.util.Locale.ENGLISH;
-
-import java.lang.reflect.Modifier;
-import java.util.Arrays;
-import java.util.IdentityHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.util.ClassUtils;
-
-import com.fasterxml.jackson.databind.JavaType;
-
-import javassist.CannotCompileException;
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.CtConstructor;
-import javassist.CtField;
-import javassist.CtMethod;
-import javassist.LoaderClassPath;
-import javassist.NotFoundException;
-
-public final class JavassistUtils {
- private static final Logger LOGGER = LoggerFactory.getLogger(JavassistUtils.class);
-
- private static final Map<ClassLoader, ClassPool> CLASSPOOLS = new IdentityHashMap<>();
-
- private static final Object LOCK = new Object();
-
- private static ClassPool getOrCreateClassPool(ClassLoader classLoader) {
- ClassPool classPool = CLASSPOOLS.get(classLoader);
- if (classPool == null) {
- synchronized (LOCK) {
- classPool = CLASSPOOLS.get(classLoader);
- if (classPool == null) {
- classPool = new ClassPool(null);
- classPool.appendSystemPath();
- classPool.appendClassPath(new LoaderClassPath(classLoader));
-
- CLASSPOOLS.put(classLoader, classPool);
- }
- }
- }
-
- return classPool;
- }
-
- public static void clearByClassLoader(ClassLoader classLoader) {
- CLASSPOOLS.remove(classLoader);
- }
-
- private JavassistUtils() {
- }
-
- @SuppressWarnings("rawtypes")
- public static Class<? extends Enum> createEnum(String clsName, String... values) {
- return createEnum(null, clsName, Arrays.asList(values));
- }
-
- @SuppressWarnings("rawtypes")
- public static Class<? extends Enum> createEnum(String clsName, List<String> values) {
- return createEnum(null, clsName, values);
- }
-
- @SuppressWarnings({"rawtypes", "unchecked"})
- public static Class<? extends Enum> createEnum(ClassLoader classLoader, String clsName, List<String> values) {
- if (values == null || values.size() == 0) {
- throw new Error("values is not allowed empty.");
- }
-
- if (classLoader == null) {
- classLoader = Thread.currentThread().getContextClassLoader();
- }
-
- ClassPool classPool = getOrCreateClassPool(classLoader);
- CtClass ctClass = classPool.makeClass(clsName);
- ctClass.setModifiers(ctClass.getModifiers() | javassist.Modifier.ENUM);
-
- try {
- ctClass.setSuperclass(classPool.get(Enum.class.getName()));
-
- addEnumConstructor(classPool, ctClass);
- addEnumValuesMethod(ctClass, values);
-
- return ctClass.toClass(classLoader, null);
- } catch (Throwable e) {
- throw new Error(e);
- }
- }
-
- private static void addEnumConstructor(ClassPool classPool, CtClass ctClass) throws Exception {
- String src = "super($1, $2);";
- CtConstructor ctConstructor = new CtConstructor(
- classPool.get(new String[] {String.class.getName(), int.class.getName()}), ctClass);
- ctConstructor.setBody(src);
-
- ctClass.addConstructor(ctConstructor);
- }
-
- private static void addEnumValuesMethod(CtClass ctClass, List<String> values) throws CannotCompileException {
- StringBuilder sb = new StringBuilder();
- sb.append("public static Enum[] values(){return new Enum[]{");
- for (int idx = 0; idx < values.size(); idx++) {
- String value = values.get(idx);
-
- String line = String.format("new %s(\"%s\", %d),", ctClass.getName(), value, idx);
- sb.append(line);
- }
- sb.setLength(sb.length() - 1);
- sb.append("};}");
-
- CtMethod valuesMethod = CtMethod.make(sb.toString(), ctClass);
- ctClass.addMethod(valuesMethod);
- }
-
- public static Class<?> createClass(ClassConfig config) {
- return createClass(null, config);
- }
-
- public static Class<?> createClass(ClassLoader classLoader, ClassConfig config) {
- if (classLoader == null) {
- classLoader = Thread.currentThread().getContextClassLoader();
- }
-
- ClassPool classPool = getOrCreateClassPool(classLoader);
- CtClass ctClass = classPool.getOrNull(config.getClassName());
- if (ctClass == null) {
- if (config.isIntf()) {
- ctClass = classPool.makeInterface(config.getClassName());
- } else {
-
- ctClass = classPool.makeClass(config.getClassName());
- }
- }
-
- try {
- for (String intfName : config.getIntfList()) {
- ctClass.addInterface(classPool.get(intfName));
- }
-
- for (FieldConfig fieldConfig : config.getFieldList()) {
- CtField field = createCtField(classPool, ctClass, fieldConfig);
- ctClass.addField(field);
-
- if (fieldConfig.isGenGetter()) {
- addFieldGetter(config, fieldConfig);
- }
-
- if (fieldConfig.isGenSetter()) {
- addFieldSetter(config, fieldConfig);
- }
- }
-
- for (MethodConfig methodConfig : config.getMethodList()) {
- CtMethod ctMethod = CtMethod.make(methodConfig.getSource(), ctClass);
- if (methodConfig.getGenericSignature() != null) {
- ctMethod.setGenericSignature(methodConfig.getGenericSignature());
- }
- ctClass.addMethod(ctMethod);
- }
-
- LOGGER.info("generate {} in classLoader {}.", config.getClassName(), classLoader);
- return ctClass.toClass(classLoader, null);
- } catch (Throwable e) {
- throw new Error(String.format("Failed to create %s in classLoader %s.", config.getClassName(), classLoader), e);
- }
- }
-
- public static String capitalize(String name) {
- if (name == null || name.length() == 0) {
- return name;
- }
- return name.substring(0, 1).toUpperCase(ENGLISH) + name.substring(1);
- }
-
- private static void addFieldGetter(ClassConfig config, FieldConfig fieldConfig) {
- MethodConfig methodConfig = new MethodConfig();
-
- Class<?> cls = fieldConfig.getRawType();
- String prefix = "get";
- if (cls.equals(Boolean.class) || cls.equals(boolean.class)) {
- prefix = "is";
- }
- methodConfig.setName(prefix + capitalize(fieldConfig.getName()));
- methodConfig.setResult(fieldConfig.getType());
- methodConfig.setBodySource("return " + fieldConfig.getName() + ";");
-
- config.addMethod(methodConfig);
- }
-
- private static void addFieldSetter(ClassConfig config, FieldConfig fieldConfig) {
- MethodConfig methodConfig = new MethodConfig();
- methodConfig.setName("set" + capitalize(fieldConfig.getName()));
- methodConfig.addParameter(fieldConfig.getName(), fieldConfig.getType());
- methodConfig.setBodySource(" this." + fieldConfig.getName() + " = " + fieldConfig.getName() + ";");
-
- config.addMethod(methodConfig);
- }
-
- public static void genMultiWrapperInterface(ClassConfig config) {
- try {
- config.addInterface(MultiWrapper.class);
-
- config.addMethod(genReadFieldsMethodSource(config.getFieldList()));
- config.addMethod(genWriteFieldsMethodSource(config.getFieldList()));
- } catch (Exception e) {
- String msg = String.format("failed to genMultiWrapperInterface, name=%s", config.getClassName());
- LOGGER.error(msg, e);
-
- throw new Error(msg, e);
- }
- }
-
- public static void genSingleWrapperInterface(ClassConfig config) {
- try {
- config.addInterface(SingleWrapper.class);
-
- config.addMethod(genReadFieldMethodSource(config.getFieldList()));
- config.addMethod(genWriteFieldMethodSource(config.getFieldList()));
- } catch (Exception e) {
- String msg = String.format("failed to genSingleWrapperMethod, name=%s", config.getClassName());
- LOGGER.error(msg, e);
-
- throw new Error(msg, e);
- }
- }
-
- private static String genReadFieldsMethodSource(List<FieldConfig> fieldList) throws Exception {
- StringBuilder sb = new StringBuilder();
- sb.append("public Object[] readFields(){");
- sb.append(String.format("Object values[] = new Object[%d];", fieldList.size()));
-
- for (int idx = 0; idx < fieldList.size(); idx++) {
- String fieldName = fieldList.get(idx).getName();
- String code = String.format(" values[%d] = %s;",
- idx,
- fieldName);
-
- sb.append(code);
- }
- sb.append("return values;");
- sb.append("}");
-
- return sb.toString();
- }
-
- private static String genWriteFieldsMethodSource(List<FieldConfig> fieldList) throws Exception {
- StringBuilder sb = new StringBuilder();
- sb.append("public void writeFields(Object[] values){");
- for (int idx = 0; idx < fieldList.size(); idx++) {
- FieldConfig fieldConfig = fieldList.get(idx);
-
- String fieldName = fieldConfig.getName();
- Class<?> type = fieldConfig.getRawType();
- String code = String.format(" %s = (%s)values[%d];",
- fieldName,
- type.getTypeName(),
- idx);
-
- sb.append(code);
- }
- sb.append("}");
-
- return sb.toString();
- }
-
- private static String genReadFieldMethodSource(List<FieldConfig> fieldList) throws Exception {
- StringBuilder sb = new StringBuilder();
- sb.append("public Object readField(){");
-
- String fieldName = "null";
- if (!fieldList.isEmpty()) {
- fieldName = fieldList.get(0).getName();
- }
-
- sb.append(String.format(" return %s;", fieldName));
- sb.append("}");
-
- return sb.toString();
- }
-
- private static String genWriteFieldMethodSource(List<FieldConfig> fieldList) throws Exception {
- StringBuilder sb = new StringBuilder();
- sb.append("public void writeField(Object value){");
-
- if (!fieldList.isEmpty()) {
- FieldConfig fieldConfig = fieldList.get(0);
- sb.append(
- String.format(" %s=(%s)value;",
- fieldConfig.getName(),
- fieldConfig.getRawType().getTypeName()));
- }
-
- sb.append("}");
-
- return sb.toString();
- }
-
- private static CtField createCtField(ClassPool pool, CtClass ctClass, FieldConfig field) throws Exception {
- Class<?> fieldType = field.getRawType();
-
- CtField ctField = new CtField(pool.getCtClass(fieldType.getName()), field.getName(), ctClass);
- if (field.getGenericSignature() != null) {
- ctField.setGenericSignature(field.getGenericSignature());
- }
- ctField.setModifiers(Modifier.PUBLIC);
- return ctField;
- }
-
- public static String getNameForGenerateCode(JavaType javaType) {
- if (byte[].class.equals(javaType.getRawClass())) {
- return "byte[]";
- }
-
- if (!javaType.isArrayType()) {
- Class<?> rawClass = ClassUtils.resolvePrimitiveIfNecessary(javaType.getRawClass());
- return rawClass.getTypeName();
- }
-
- return javaType.getContentType().getRawClass().getName() + "[]";
- }
-
- // for test
- public static void detach(String clsName) {
- try {
- ClassPool classPool = getOrCreateClassPool(Thread.currentThread().getContextClassLoader());
- classPool.getCtClass(clsName).detach();
- } catch (NotFoundException e) {
- // do nothing.
- }
- }
-}
diff --git a/common/common-javassist/src/main/java/io/servicecomb/common/javassist/MethodConfig.java b/common/common-javassist/src/main/java/io/servicecomb/common/javassist/MethodConfig.java
deleted file mode 100644
index 152d35f..0000000
--- a/common/common-javassist/src/main/java/io/servicecomb/common/javassist/MethodConfig.java
+++ /dev/null
@@ -1,121 +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.servicecomb.common.javassist;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.fasterxml.jackson.databind.JavaType;
-
-public class MethodConfig {
- private String name;
-
- private JavaType result;
-
- private List<ParameterConfig> parameterList = new ArrayList<>();
-
- // 不包括前后的{}
- private String bodySource;
-
- // 根据上面的信息,生成下面两个字段
- // 包括method声明和body
- // 如果是接口,则只是method声明
- private String source;
-
- // 泛型声明,如果method参数及应答中没有泛型类型,则此字段应该为null
- private String genericSignature;
-
- public String getSource() {
- return source;
- }
-
- public void setSource(String source) {
- this.source = source;
- }
-
- public String getGenericSignature() {
- return genericSignature;
- }
-
- public void setGenericSignature(String genericSignature) {
- this.genericSignature = genericSignature;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setResult(JavaType result) {
- this.result = result;
- }
-
- public void addParameter(String name, JavaType type) {
- ParameterConfig parameterConfig = new ParameterConfig();
- parameterConfig.setName(name);
- parameterConfig.setType(type);
- parameterList.add(parameterConfig);
- }
-
- public void setBodySource(String bodySource) {
- this.bodySource = bodySource;
- }
-
- void init() {
- if (source != null) {
- return;
- }
-
- StringBuilder sbMethod = new StringBuilder();
- StringBuilder sbMethodGenericSignature = new StringBuilder();
-
- sbMethod.append("public ");
- sbMethod.append(result == null ? "void" : JavassistUtils.getNameForGenerateCode(result));
- sbMethod.append(" ")
- .append(name)
- .append("(");
- sbMethodGenericSignature.append("(");
-
- boolean hasGenericSignature = result == null ? false : result.hasGenericTypes();
- for (ParameterConfig parameter : parameterList) {
- hasGenericSignature = hasGenericSignature || parameter.getType().hasGenericTypes();
-
- String paramTypeName = JavassistUtils.getNameForGenerateCode(parameter.getType());
- String code = String.format("%s %s,", paramTypeName, parameter.getName());
- sbMethod.append(code);
- sbMethodGenericSignature.append(parameter.getType().getGenericSignature());
- }
-
- if (!parameterList.isEmpty()) {
- sbMethod.setLength(sbMethod.length() - 1);
- }
- sbMethod.append(")");
- sbMethodGenericSignature.append(")");
- sbMethodGenericSignature.append(result == null ? "V" : result.getGenericSignature());
-
- if (bodySource != null) {
- sbMethod.append("{").append(bodySource).append("}");
- } else {
- sbMethod.append(";");
- }
-
- source = sbMethod.toString();
- if (hasGenericSignature) {
- genericSignature = sbMethodGenericSignature.toString();
- }
- }
-}
diff --git a/common/common-javassist/src/main/java/io/servicecomb/common/javassist/MultiWrapper.java b/common/common-javassist/src/main/java/io/servicecomb/common/javassist/MultiWrapper.java
deleted file mode 100644
index 2dcc840..0000000
--- a/common/common-javassist/src/main/java/io/servicecomb/common/javassist/MultiWrapper.java
+++ /dev/null
@@ -1,24 +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.servicecomb.common.javassist;
-
-public interface MultiWrapper {
- void writeFields(Object[] values);
-
- Object[] readFields();
-}
diff --git a/common/common-javassist/src/main/java/io/servicecomb/common/javassist/ParameterConfig.java b/common/common-javassist/src/main/java/io/servicecomb/common/javassist/ParameterConfig.java
deleted file mode 100644
index b4d8d5f..0000000
--- a/common/common-javassist/src/main/java/io/servicecomb/common/javassist/ParameterConfig.java
+++ /dev/null
@@ -1,41 +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.servicecomb.common.javassist;
-
-import com.fasterxml.jackson.databind.JavaType;
-
-public class ParameterConfig {
- private String name;
-
- private JavaType type;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public JavaType getType() {
- return type;
- }
-
- public void setType(JavaType type) {
- this.type = type;
- }
-}
diff --git a/common/common-javassist/src/main/java/io/servicecomb/common/javassist/SingleWrapper.java b/common/common-javassist/src/main/java/io/servicecomb/common/javassist/SingleWrapper.java
deleted file mode 100644
index 52f54f4..0000000
--- a/common/common-javassist/src/main/java/io/servicecomb/common/javassist/SingleWrapper.java
+++ /dev/null
@@ -1,24 +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.servicecomb.common.javassist;
-
-public interface SingleWrapper {
- void writeField(Object value);
-
- Object readField();
-}
diff --git a/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/ClassConfig.java b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/ClassConfig.java
new file mode 100644
index 0000000..9471d7a
--- /dev/null
+++ b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/ClassConfig.java
@@ -0,0 +1,104 @@
+/*
+ * 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.common.javassist;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+
+public class ClassConfig {
+
+ private String className;
+
+ private boolean intf;
+
+ private List<String> intfList = new ArrayList<>();
+
+ private List<FieldConfig> fieldList = new ArrayList<>();
+
+ private List<MethodConfig> methodList = new ArrayList<>();
+
+ public boolean isIntf() {
+ return intf;
+ }
+
+ public void setIntf(boolean intf) {
+ this.intf = intf;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public void addInterface(Class<?> intf) {
+ addInterface(intf.getName());
+ }
+
+ public void addInterface(String intf) {
+ intfList.add(intf);
+ }
+
+ public List<String> getIntfList() {
+ return intfList;
+ }
+
+ public List<FieldConfig> getFieldList() {
+ return fieldList;
+ }
+
+ public FieldConfig addField(String name, Type genericType) {
+ return addField(name, TypeFactory.defaultInstance().constructType(genericType));
+ }
+
+ public FieldConfig addField(String name, JavaType javaType) {
+ FieldConfig field = new FieldConfig();
+ field.setName(name);
+ field.setType(javaType);
+
+ fieldList.add(field);
+
+ return field;
+ }
+
+ public void addMethod(MethodConfig methodConfig) {
+ methodConfig.init();
+ methodList.add(methodConfig);
+ }
+
+ public void addMethod(String source) {
+ addMethod(source, null);
+ }
+
+ public void addMethod(String source, String genericSignature) {
+ MethodConfig methodConfig = new MethodConfig();
+ methodConfig.setSource(source);
+ methodConfig.setGenericSignature(genericSignature);
+ addMethod(methodConfig);
+ }
+
+ public List<MethodConfig> getMethodList() {
+ return methodList;
+ }
+}
diff --git a/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/FieldConfig.java b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/FieldConfig.java
new file mode 100644
index 0000000..c630b73
--- /dev/null
+++ b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/FieldConfig.java
@@ -0,0 +1,80 @@
+/*
+ * 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.common.javassist;
+
+import org.springframework.util.ClassUtils;
+
+import com.fasterxml.jackson.databind.JavaType;
+
+public class FieldConfig {
+ private String name;
+
+ // javassist的成员不支持int这样的类型,必须是Integer才行
+ private Class<?> rawType;
+
+ private JavaType type;
+
+ private boolean genGetter;
+
+ private boolean genSetter;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Class<?> getRawType() {
+ return rawType;
+ }
+
+ public JavaType getType() {
+ return type;
+ }
+
+ public void setType(JavaType type) {
+ this.rawType = ClassUtils.resolvePrimitiveIfNecessary(type.getRawClass());
+ this.type = type;
+ }
+
+ public boolean isGenGetter() {
+ return genGetter;
+ }
+
+ public void setGenGetter(boolean genGetter) {
+ this.genGetter = genGetter;
+ }
+
+ public boolean isGenSetter() {
+ return genSetter;
+ }
+
+ public void setGenSetter(boolean genSetter) {
+ this.genSetter = genSetter;
+ }
+
+ public String getGenericSignature() {
+ if (type.hasGenericTypes()) {
+ return type.getGenericSignature();
+ }
+
+ return null;
+ }
+}
diff --git a/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/JavassistUtils.java b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/JavassistUtils.java
new file mode 100644
index 0000000..41cd844
--- /dev/null
+++ b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/JavassistUtils.java
@@ -0,0 +1,352 @@
+/*
+ * 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.common.javassist;
+
+import static java.util.Locale.ENGLISH;
+
+import java.lang.reflect.Modifier;
+import java.util.Arrays;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.ClassUtils;
+
+import com.fasterxml.jackson.databind.JavaType;
+
+import javassist.CannotCompileException;
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.CtConstructor;
+import javassist.CtField;
+import javassist.CtMethod;
+import javassist.LoaderClassPath;
+import javassist.NotFoundException;
+
+public final class JavassistUtils {
+ private static final Logger LOGGER = LoggerFactory.getLogger(JavassistUtils.class);
+
+ private static final Map<ClassLoader, ClassPool> CLASSPOOLS = new IdentityHashMap<>();
+
+ private static final Object LOCK = new Object();
+
+ private static ClassPool getOrCreateClassPool(ClassLoader classLoader) {
+ ClassPool classPool = CLASSPOOLS.get(classLoader);
+ if (classPool == null) {
+ synchronized (LOCK) {
+ classPool = CLASSPOOLS.get(classLoader);
+ if (classPool == null) {
+ classPool = new ClassPool(null);
+ classPool.appendSystemPath();
+ classPool.appendClassPath(new LoaderClassPath(classLoader));
+
+ CLASSPOOLS.put(classLoader, classPool);
+ }
+ }
+ }
+
+ return classPool;
+ }
+
+ public static void clearByClassLoader(ClassLoader classLoader) {
+ CLASSPOOLS.remove(classLoader);
+ }
+
+ private JavassistUtils() {
+ }
+
+ @SuppressWarnings("rawtypes")
+ public static Class<? extends Enum> createEnum(String clsName, String... values) {
+ return createEnum(null, clsName, Arrays.asList(values));
+ }
+
+ @SuppressWarnings("rawtypes")
+ public static Class<? extends Enum> createEnum(String clsName, List<String> values) {
+ return createEnum(null, clsName, values);
+ }
+
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ public static Class<? extends Enum> createEnum(ClassLoader classLoader, String clsName, List<String> values) {
+ if (values == null || values.size() == 0) {
+ throw new Error("values is not allowed empty.");
+ }
+
+ if (classLoader == null) {
+ classLoader = Thread.currentThread().getContextClassLoader();
+ }
+
+ ClassPool classPool = getOrCreateClassPool(classLoader);
+ CtClass ctClass = classPool.makeClass(clsName);
+ ctClass.setModifiers(ctClass.getModifiers() | javassist.Modifier.ENUM);
+
+ try {
+ ctClass.setSuperclass(classPool.get(Enum.class.getName()));
+
+ addEnumConstructor(classPool, ctClass);
+ addEnumValuesMethod(ctClass, values);
+
+ return ctClass.toClass(classLoader, null);
+ } catch (Throwable e) {
+ throw new Error(e);
+ }
+ }
+
+ private static void addEnumConstructor(ClassPool classPool, CtClass ctClass) throws Exception {
+ String src = "super($1, $2);";
+ CtConstructor ctConstructor = new CtConstructor(
+ classPool.get(new String[] {String.class.getName(), int.class.getName()}), ctClass);
+ ctConstructor.setBody(src);
+
+ ctClass.addConstructor(ctConstructor);
+ }
+
+ private static void addEnumValuesMethod(CtClass ctClass, List<String> values) throws CannotCompileException {
+ StringBuilder sb = new StringBuilder();
+ sb.append("public static Enum[] values(){return new Enum[]{");
+ for (int idx = 0; idx < values.size(); idx++) {
+ String value = values.get(idx);
+
+ String line = String.format("new %s(\"%s\", %d),", ctClass.getName(), value, idx);
+ sb.append(line);
+ }
+ sb.setLength(sb.length() - 1);
+ sb.append("};}");
+
+ CtMethod valuesMethod = CtMethod.make(sb.toString(), ctClass);
+ ctClass.addMethod(valuesMethod);
+ }
+
+ public static Class<?> createClass(ClassConfig config) {
+ return createClass(null, config);
+ }
+
+ public static Class<?> createClass(ClassLoader classLoader, ClassConfig config) {
+ if (classLoader == null) {
+ classLoader = Thread.currentThread().getContextClassLoader();
+ }
+
+ ClassPool classPool = getOrCreateClassPool(classLoader);
+ CtClass ctClass = classPool.getOrNull(config.getClassName());
+ if (ctClass == null) {
+ if (config.isIntf()) {
+ ctClass = classPool.makeInterface(config.getClassName());
+ } else {
+
+ ctClass = classPool.makeClass(config.getClassName());
+ }
+ }
+
+ try {
+ for (String intfName : config.getIntfList()) {
+ ctClass.addInterface(classPool.get(intfName));
+ }
+
+ for (FieldConfig fieldConfig : config.getFieldList()) {
+ CtField field = createCtField(classPool, ctClass, fieldConfig);
+ ctClass.addField(field);
+
+ if (fieldConfig.isGenGetter()) {
+ addFieldGetter(config, fieldConfig);
+ }
+
+ if (fieldConfig.isGenSetter()) {
+ addFieldSetter(config, fieldConfig);
+ }
+ }
+
+ for (MethodConfig methodConfig : config.getMethodList()) {
+ CtMethod ctMethod = CtMethod.make(methodConfig.getSource(), ctClass);
+ if (methodConfig.getGenericSignature() != null) {
+ ctMethod.setGenericSignature(methodConfig.getGenericSignature());
+ }
+ ctClass.addMethod(ctMethod);
+ }
+
+ LOGGER.info("generate {} in classLoader {}.", config.getClassName(), classLoader);
+ return ctClass.toClass(classLoader, null);
+ } catch (Throwable e) {
+ throw new Error(String.format("Failed to create %s in classLoader %s.", config.getClassName(), classLoader), e);
+ }
+ }
+
+ public static String capitalize(String name) {
+ if (name == null || name.length() == 0) {
+ return name;
+ }
+ return name.substring(0, 1).toUpperCase(ENGLISH) + name.substring(1);
+ }
+
+ private static void addFieldGetter(ClassConfig config, FieldConfig fieldConfig) {
+ MethodConfig methodConfig = new MethodConfig();
+
+ Class<?> cls = fieldConfig.getRawType();
+ String prefix = "get";
+ if (cls.equals(Boolean.class) || cls.equals(boolean.class)) {
+ prefix = "is";
+ }
+ methodConfig.setName(prefix + capitalize(fieldConfig.getName()));
+ methodConfig.setResult(fieldConfig.getType());
+ methodConfig.setBodySource("return " + fieldConfig.getName() + ";");
+
+ config.addMethod(methodConfig);
+ }
+
+ private static void addFieldSetter(ClassConfig config, FieldConfig fieldConfig) {
+ MethodConfig methodConfig = new MethodConfig();
+ methodConfig.setName("set" + capitalize(fieldConfig.getName()));
+ methodConfig.addParameter(fieldConfig.getName(), fieldConfig.getType());
+ methodConfig.setBodySource(" this." + fieldConfig.getName() + " = " + fieldConfig.getName() + ";");
+
+ config.addMethod(methodConfig);
+ }
+
+ public static void genMultiWrapperInterface(ClassConfig config) {
+ try {
+ config.addInterface(MultiWrapper.class);
+
+ config.addMethod(genReadFieldsMethodSource(config.getFieldList()));
+ config.addMethod(genWriteFieldsMethodSource(config.getFieldList()));
+ } catch (Exception e) {
+ String msg = String.format("failed to genMultiWrapperInterface, name=%s", config.getClassName());
+ LOGGER.error(msg, e);
+
+ throw new Error(msg, e);
+ }
+ }
+
+ public static void genSingleWrapperInterface(ClassConfig config) {
+ try {
+ config.addInterface(SingleWrapper.class);
+
+ config.addMethod(genReadFieldMethodSource(config.getFieldList()));
+ config.addMethod(genWriteFieldMethodSource(config.getFieldList()));
+ } catch (Exception e) {
+ String msg = String.format("failed to genSingleWrapperMethod, name=%s", config.getClassName());
+ LOGGER.error(msg, e);
+
+ throw new Error(msg, e);
+ }
+ }
+
+ private static String genReadFieldsMethodSource(List<FieldConfig> fieldList) throws Exception {
+ StringBuilder sb = new StringBuilder();
+ sb.append("public Object[] readFields(){");
+ sb.append(String.format("Object values[] = new Object[%d];", fieldList.size()));
+
+ for (int idx = 0; idx < fieldList.size(); idx++) {
+ String fieldName = fieldList.get(idx).getName();
+ String code = String.format(" values[%d] = %s;",
+ idx,
+ fieldName);
+
+ sb.append(code);
+ }
+ sb.append("return values;");
+ sb.append("}");
+
+ return sb.toString();
+ }
+
+ private static String genWriteFieldsMethodSource(List<FieldConfig> fieldList) throws Exception {
+ StringBuilder sb = new StringBuilder();
+ sb.append("public void writeFields(Object[] values){");
+ for (int idx = 0; idx < fieldList.size(); idx++) {
+ FieldConfig fieldConfig = fieldList.get(idx);
+
+ String fieldName = fieldConfig.getName();
+ Class<?> type = fieldConfig.getRawType();
+ String code = String.format(" %s = (%s)values[%d];",
+ fieldName,
+ type.getTypeName(),
+ idx);
+
+ sb.append(code);
+ }
+ sb.append("}");
+
+ return sb.toString();
+ }
+
+ private static String genReadFieldMethodSource(List<FieldConfig> fieldList) throws Exception {
+ StringBuilder sb = new StringBuilder();
+ sb.append("public Object readField(){");
+
+ String fieldName = "null";
+ if (!fieldList.isEmpty()) {
+ fieldName = fieldList.get(0).getName();
+ }
+
+ sb.append(String.format(" return %s;", fieldName));
+ sb.append("}");
+
+ return sb.toString();
+ }
+
+ private static String genWriteFieldMethodSource(List<FieldConfig> fieldList) throws Exception {
+ StringBuilder sb = new StringBuilder();
+ sb.append("public void writeField(Object value){");
+
+ if (!fieldList.isEmpty()) {
+ FieldConfig fieldConfig = fieldList.get(0);
+ sb.append(
+ String.format(" %s=(%s)value;",
+ fieldConfig.getName(),
+ fieldConfig.getRawType().getTypeName()));
+ }
+
+ sb.append("}");
+
+ return sb.toString();
+ }
+
+ private static CtField createCtField(ClassPool pool, CtClass ctClass, FieldConfig field) throws Exception {
+ Class<?> fieldType = field.getRawType();
+
+ CtField ctField = new CtField(pool.getCtClass(fieldType.getName()), field.getName(), ctClass);
+ if (field.getGenericSignature() != null) {
+ ctField.setGenericSignature(field.getGenericSignature());
+ }
+ ctField.setModifiers(Modifier.PUBLIC);
+ return ctField;
+ }
+
+ public static String getNameForGenerateCode(JavaType javaType) {
+ if (byte[].class.equals(javaType.getRawClass())) {
+ return "byte[]";
+ }
+
+ if (!javaType.isArrayType()) {
+ Class<?> rawClass = ClassUtils.resolvePrimitiveIfNecessary(javaType.getRawClass());
+ return rawClass.getTypeName();
+ }
+
+ return javaType.getContentType().getRawClass().getName() + "[]";
+ }
+
+ // for test
+ public static void detach(String clsName) {
+ try {
+ ClassPool classPool = getOrCreateClassPool(Thread.currentThread().getContextClassLoader());
+ classPool.getCtClass(clsName).detach();
+ } catch (NotFoundException e) {
+ // do nothing.
+ }
+ }
+}
diff --git a/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/MethodConfig.java b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/MethodConfig.java
new file mode 100644
index 0000000..aa0b773
--- /dev/null
+++ b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/MethodConfig.java
@@ -0,0 +1,121 @@
+/*
+ * 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.common.javassist;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.databind.JavaType;
+
+public class MethodConfig {
+ private String name;
+
+ private JavaType result;
+
+ private List<ParameterConfig> parameterList = new ArrayList<>();
+
+ // 不包括前后的{}
+ private String bodySource;
+
+ // 根据上面的信息,生成下面两个字段
+ // 包括method声明和body
+ // 如果是接口,则只是method声明
+ private String source;
+
+ // 泛型声明,如果method参数及应答中没有泛型类型,则此字段应该为null
+ private String genericSignature;
+
+ public String getSource() {
+ return source;
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ public String getGenericSignature() {
+ return genericSignature;
+ }
+
+ public void setGenericSignature(String genericSignature) {
+ this.genericSignature = genericSignature;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setResult(JavaType result) {
+ this.result = result;
+ }
+
+ public void addParameter(String name, JavaType type) {
+ ParameterConfig parameterConfig = new ParameterConfig();
+ parameterConfig.setName(name);
+ parameterConfig.setType(type);
+ parameterList.add(parameterConfig);
+ }
+
+ public void setBodySource(String bodySource) {
+ this.bodySource = bodySource;
+ }
+
+ void init() {
+ if (source != null) {
+ return;
+ }
+
+ StringBuilder sbMethod = new StringBuilder();
+ StringBuilder sbMethodGenericSignature = new StringBuilder();
+
+ sbMethod.append("public ");
+ sbMethod.append(result == null ? "void" : JavassistUtils.getNameForGenerateCode(result));
+ sbMethod.append(" ")
+ .append(name)
+ .append("(");
+ sbMethodGenericSignature.append("(");
+
+ boolean hasGenericSignature = result == null ? false : result.hasGenericTypes();
+ for (ParameterConfig parameter : parameterList) {
+ hasGenericSignature = hasGenericSignature || parameter.getType().hasGenericTypes();
+
+ String paramTypeName = JavassistUtils.getNameForGenerateCode(parameter.getType());
+ String code = String.format("%s %s,", paramTypeName, parameter.getName());
+ sbMethod.append(code);
+ sbMethodGenericSignature.append(parameter.getType().getGenericSignature());
+ }
+
+ if (!parameterList.isEmpty()) {
+ sbMethod.setLength(sbMethod.length() - 1);
+ }
+ sbMethod.append(")");
+ sbMethodGenericSignature.append(")");
+ sbMethodGenericSignature.append(result == null ? "V" : result.getGenericSignature());
+
+ if (bodySource != null) {
+ sbMethod.append("{").append(bodySource).append("}");
+ } else {
+ sbMethod.append(";");
+ }
+
+ source = sbMethod.toString();
+ if (hasGenericSignature) {
+ genericSignature = sbMethodGenericSignature.toString();
+ }
+ }
+}
diff --git a/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/MultiWrapper.java b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/MultiWrapper.java
new file mode 100644
index 0000000..4449e04
--- /dev/null
+++ b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/MultiWrapper.java
@@ -0,0 +1,24 @@
+/*
+ * 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.common.javassist;
+
+public interface MultiWrapper {
+ void writeFields(Object[] values);
+
+ Object[] readFields();
+}
diff --git a/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/ParameterConfig.java b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/ParameterConfig.java
new file mode 100644
index 0000000..d7281e6
--- /dev/null
+++ b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/ParameterConfig.java
@@ -0,0 +1,41 @@
+/*
+ * 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.common.javassist;
+
+import com.fasterxml.jackson.databind.JavaType;
+
+public class ParameterConfig {
+ private String name;
+
+ private JavaType type;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public JavaType getType() {
+ return type;
+ }
+
+ public void setType(JavaType type) {
+ this.type = type;
+ }
+}
diff --git a/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/SingleWrapper.java b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/SingleWrapper.java
new file mode 100644
index 0000000..26590b0
--- /dev/null
+++ b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/SingleWrapper.java
@@ -0,0 +1,24 @@
+/*
+ * 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.common.javassist;
+
+public interface SingleWrapper {
+ void writeField(Object value);
+
+ Object readField();
+}
diff --git a/common/common-javassist/src/test/java/io/servicecomb/common/javassist/TestJavassistUtils.java b/common/common-javassist/src/test/java/io/servicecomb/common/javassist/TestJavassistUtils.java
deleted file mode 100644
index 8efb6e6..0000000
--- a/common/common-javassist/src/test/java/io/servicecomb/common/javassist/TestJavassistUtils.java
+++ /dev/null
@@ -1,206 +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.servicecomb.common.javassist;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import com.fasterxml.jackson.databind.JavaType;
-import com.fasterxml.jackson.databind.type.TypeFactory;
-
-import io.servicecomb.foundation.common.utils.ReflectUtils;
-import javassist.ClassPool;
-import mockit.Deencapsulation;
-
-public class TestJavassistUtils {
- @Test
- public void testField() throws Exception {
- ClassConfig classConfig = new ClassConfig();
- classConfig.setClassName("cse.ut.testField");
-
- FieldConfig fieldConfig = classConfig.addField("intField", int.class);
- fieldConfig.setGenGetter(true);
- fieldConfig.setGenSetter(true);
-
- fieldConfig = classConfig.addField("intArrayField", int[].class);
- fieldConfig.setGenGetter(true);
- fieldConfig.setGenSetter(true);
-
- fieldConfig = classConfig.addField("listStringField",
- TypeFactory.defaultInstance().constructCollectionType(List.class, String.class));
- fieldConfig.setGenGetter(true);
- fieldConfig.setGenSetter(true);
-
- Class<?> cls = JavassistUtils.createClass(classConfig);
-
- Field field = cls.getField("intField");
- Assert.assertEquals(Integer.class, field.getType());
-
- Method method = cls.getMethod("getIntField");
- Assert.assertEquals(Integer.class, method.getReturnType());
-
- field = cls.getField("intArrayField");
- Assert.assertEquals(int[].class, field.getType());
-
- method = cls.getMethod("getIntArrayField");
- Assert.assertEquals(int[].class, method.getReturnType());
-
- field = cls.getField("listStringField");
- Assert.assertEquals("java.util.List<java.lang.String>", field.getGenericType().getTypeName());
-
- method = cls.getMethod("getListStringField");
- Assert.assertEquals("java.util.List<java.lang.String>", method.getGenericReturnType().getTypeName());
- }
-
- @Test
- public void testAddParameter() {
- ClassConfig classConfig = new ClassConfig();
- classConfig.setIntf(true);
- String intfName = "cse.ut.TestAddParameter";
- classConfig.setClassName(intfName);
-
- MethodConfig methodConfig = new MethodConfig();
- methodConfig.setName("method");
- methodConfig.setResult(TypeFactory.defaultInstance().constructCollectionType(List.class, String.class));
- methodConfig.addParameter("map",
- TypeFactory.defaultInstance().constructMapType(Map.class, String.class, String.class));
- methodConfig.addParameter("set",
- TypeFactory.defaultInstance().constructCollectionType(Set.class, String.class));
- classConfig.addMethod(methodConfig);
-
- Class<?> intf = JavassistUtils.createClass(classConfig);
-
- Assert.assertEquals(intfName, intf.getName());
- Method method = ReflectUtils.findMethod(intf, "method");
- Assert.assertEquals("method", method.getName());
- Assert.assertEquals("java.util.List<java.lang.String>", method.getGenericReturnType().getTypeName());
-
- Type[] types = method.getGenericParameterTypes();
- Assert.assertEquals("java.util.Map<java.lang.String, java.lang.String>", types[0].getTypeName());
- Assert.assertEquals("java.util.Set<java.lang.String>", types[1].getTypeName());
- }
-
- @Test
- public void testInterface() throws Exception {
- ClassConfig classConfig = new ClassConfig();
- classConfig.setIntf(true);
- String intfName = "cse.ut.TestInterface";
- classConfig.setClassName(intfName);
-
- String source = "java.util.List method(java.util.Map map, java.util.Set set);";
- String genericSignature =
- "(Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;Ljava/util/Set<Ljava/lang/String;>;)Ljava/util/List<Ljava/lang/String;>;";
- classConfig.addMethod(source, genericSignature);
-
- Class<?> intf = JavassistUtils.createClass(classConfig);
-
- Assert.assertEquals(intfName, intf.getName());
- Method method = ReflectUtils.findMethod(intf, "method");
- Assert.assertEquals("method", method.getName());
- Assert.assertEquals("java.util.List<java.lang.String>", method.getGenericReturnType().getTypeName());
-
- Type[] types = method.getGenericParameterTypes();
- Assert.assertEquals("java.util.Map<java.lang.String, java.lang.String>", types[0].getTypeName());
- Assert.assertEquals("java.util.Set<java.lang.String>", types[1].getTypeName());
- }
-
- @Test
- public void singleWrapperInt() throws Exception {
- ClassConfig classConfig = new ClassConfig();
- classConfig.setClassName("cse.ut.single.IntWrapper");
- classConfig.addField("intField", TypeFactory.defaultInstance().constructType(int.class));
-
- JavassistUtils.genSingleWrapperInterface(classConfig);
-
- Class<?> wrapperClass = JavassistUtils.createClass(classConfig);
-
- SingleWrapper instance = (SingleWrapper) wrapperClass.newInstance();
- instance.writeField(100);
- int intFieldValue = (int) instance.readField();
- Assert.assertEquals(100, intFieldValue);
- }
-
- @Test
- public void multiWrapper() throws Exception {
- ClassConfig classConfig = new ClassConfig();
- classConfig.setClassName("cse.ut.multi.Wrapper");
- classConfig.addField("intField", (Type) int.class);
- classConfig.addField("strField", String.class);
-
- JavassistUtils.genMultiWrapperInterface(classConfig);
-
- Class<?> wrapperClass = JavassistUtils.createClass(classConfig);
-
- MultiWrapper instance = (MultiWrapper) wrapperClass.newInstance();
- instance.writeFields(new Object[] {100, "test"});
- Object[] fieldValues = (Object[]) instance.readFields();
- Assert.assertEquals(100, fieldValues[0]);
- Assert.assertEquals("test", fieldValues[1]);
- }
-
- @Test
- public void testEnum() throws Exception {
- @SuppressWarnings("rawtypes")
- Class<? extends Enum> cls = JavassistUtils.createEnum("cse.ut.EnumAbc", "a", "b");
- Method method = cls.getMethod("values");
- Enum<?>[] values = (Enum<?>[]) method.invoke(null);
-
- Assert.assertEquals("cse.ut.EnumAbc", cls.getName());
- Assert.assertEquals(2, values.length);
- Assert.assertEquals("a", values[0].name());
- Assert.assertEquals(0, values[0].ordinal());
- Assert.assertEquals("b", values[1].name());
- Assert.assertEquals(1, values[1].ordinal());
- }
-
- @Test
- public void testGetNameForGenerateCode() {
- JavaType jt = TypeFactory.defaultInstance().constructType(byte[].class);
- String name = JavassistUtils.getNameForGenerateCode(jt);
- Assert.assertEquals("byte[]", name);
-
- jt = TypeFactory.defaultInstance().constructType(Byte[].class);
- name = JavassistUtils.getNameForGenerateCode(jt);
- Assert.assertEquals("java.lang.Byte[]", name);
-
- jt = TypeFactory.defaultInstance().constructType(Object[].class);
- name = JavassistUtils.getNameForGenerateCode(jt);
- Assert.assertEquals("java.lang.Object[]", name);
- }
-
- @Test
- public void managerClassPool() {
- ClassLoader classLoader1 = new ClassLoader() { };
- ClassLoader classLoader2 = new ClassLoader() { };
-
- ClassPool p1 = Deencapsulation.invoke(JavassistUtils.class, "getOrCreateClassPool", classLoader1);
- ClassPool p2 = Deencapsulation.invoke(JavassistUtils.class, "getOrCreateClassPool", classLoader2);
- Assert.assertNotSame(p1, p2);
-
- Map<ClassLoader, ClassPool> CLASSPOOLS = Deencapsulation.getField(JavassistUtils.class, "CLASSPOOLS");
- JavassistUtils.clearByClassLoader(classLoader1);
- Assert.assertNull(CLASSPOOLS.get(classLoader1));
- }
-}
diff --git a/common/common-javassist/src/test/java/org/apache/servicecomb/common/javassist/TestJavassistUtils.java b/common/common-javassist/src/test/java/org/apache/servicecomb/common/javassist/TestJavassistUtils.java
new file mode 100644
index 0000000..f7f11bb
--- /dev/null
+++ b/common/common-javassist/src/test/java/org/apache/servicecomb/common/javassist/TestJavassistUtils.java
@@ -0,0 +1,206 @@
+/*
+ * 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.common.javassist;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.servicecomb.foundation.common.utils.ReflectUtils;
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+
+import javassist.ClassPool;
+import mockit.Deencapsulation;
+
+public class TestJavassistUtils {
+ @Test
+ public void testField() throws Exception {
+ ClassConfig classConfig = new ClassConfig();
+ classConfig.setClassName("cse.ut.testField");
+
+ FieldConfig fieldConfig = classConfig.addField("intField", int.class);
+ fieldConfig.setGenGetter(true);
+ fieldConfig.setGenSetter(true);
+
+ fieldConfig = classConfig.addField("intArrayField", int[].class);
+ fieldConfig.setGenGetter(true);
+ fieldConfig.setGenSetter(true);
+
+ fieldConfig = classConfig.addField("listStringField",
+ TypeFactory.defaultInstance().constructCollectionType(List.class, String.class));
+ fieldConfig.setGenGetter(true);
+ fieldConfig.setGenSetter(true);
+
+ Class<?> cls = JavassistUtils.createClass(classConfig);
+
+ Field field = cls.getField("intField");
+ Assert.assertEquals(Integer.class, field.getType());
+
+ Method method = cls.getMethod("getIntField");
+ Assert.assertEquals(Integer.class, method.getReturnType());
+
+ field = cls.getField("intArrayField");
+ Assert.assertEquals(int[].class, field.getType());
+
+ method = cls.getMethod("getIntArrayField");
+ Assert.assertEquals(int[].class, method.getReturnType());
+
+ field = cls.getField("listStringField");
+ Assert.assertEquals("java.util.List<java.lang.String>", field.getGenericType().getTypeName());
+
+ method = cls.getMethod("getListStringField");
+ Assert.assertEquals("java.util.List<java.lang.String>", method.getGenericReturnType().getTypeName());
+ }
+
+ @Test
+ public void testAddParameter() {
+ ClassConfig classConfig = new ClassConfig();
+ classConfig.setIntf(true);
+ String intfName = "cse.ut.TestAddParameter";
+ classConfig.setClassName(intfName);
+
+ MethodConfig methodConfig = new MethodConfig();
+ methodConfig.setName("method");
+ methodConfig.setResult(TypeFactory.defaultInstance().constructCollectionType(List.class, String.class));
+ methodConfig.addParameter("map",
+ TypeFactory.defaultInstance().constructMapType(Map.class, String.class, String.class));
+ methodConfig.addParameter("set",
+ TypeFactory.defaultInstance().constructCollectionType(Set.class, String.class));
+ classConfig.addMethod(methodConfig);
+
+ Class<?> intf = JavassistUtils.createClass(classConfig);
+
+ Assert.assertEquals(intfName, intf.getName());
+ Method method = ReflectUtils.findMethod(intf, "method");
+ Assert.assertEquals("method", method.getName());
+ Assert.assertEquals("java.util.List<java.lang.String>", method.getGenericReturnType().getTypeName());
+
+ Type[] types = method.getGenericParameterTypes();
+ Assert.assertEquals("java.util.Map<java.lang.String, java.lang.String>", types[0].getTypeName());
+ Assert.assertEquals("java.util.Set<java.lang.String>", types[1].getTypeName());
+ }
+
+ @Test
+ public void testInterface() throws Exception {
+ ClassConfig classConfig = new ClassConfig();
+ classConfig.setIntf(true);
+ String intfName = "cse.ut.TestInterface";
+ classConfig.setClassName(intfName);
+
+ String source = "java.util.List method(java.util.Map map, java.util.Set set);";
+ String genericSignature =
+ "(Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;Ljava/util/Set<Ljava/lang/String;>;)Ljava/util/List<Ljava/lang/String;>;";
+ classConfig.addMethod(source, genericSignature);
+
+ Class<?> intf = JavassistUtils.createClass(classConfig);
+
+ Assert.assertEquals(intfName, intf.getName());
+ Method method = ReflectUtils.findMethod(intf, "method");
+ Assert.assertEquals("method", method.getName());
+ Assert.assertEquals("java.util.List<java.lang.String>", method.getGenericReturnType().getTypeName());
+
+ Type[] types = method.getGenericParameterTypes();
+ Assert.assertEquals("java.util.Map<java.lang.String, java.lang.String>", types[0].getTypeName());
+ Assert.assertEquals("java.util.Set<java.lang.String>", types[1].getTypeName());
+ }
+
+ @Test
+ public void singleWrapperInt() throws Exception {
+ ClassConfig classConfig = new ClassConfig();
+ classConfig.setClassName("cse.ut.single.IntWrapper");
+ classConfig.addField("intField", TypeFactory.defaultInstance().constructType(int.class));
+
+ JavassistUtils.genSingleWrapperInterface(classConfig);
+
+ Class<?> wrapperClass = JavassistUtils.createClass(classConfig);
+
+ SingleWrapper instance = (SingleWrapper) wrapperClass.newInstance();
+ instance.writeField(100);
+ int intFieldValue = (int) instance.readField();
+ Assert.assertEquals(100, intFieldValue);
+ }
+
+ @Test
+ public void multiWrapper() throws Exception {
+ ClassConfig classConfig = new ClassConfig();
+ classConfig.setClassName("cse.ut.multi.Wrapper");
+ classConfig.addField("intField", (Type) int.class);
+ classConfig.addField("strField", String.class);
+
+ JavassistUtils.genMultiWrapperInterface(classConfig);
+
+ Class<?> wrapperClass = JavassistUtils.createClass(classConfig);
+
+ MultiWrapper instance = (MultiWrapper) wrapperClass.newInstance();
+ instance.writeFields(new Object[] {100, "test"});
+ Object[] fieldValues = (Object[]) instance.readFields();
+ Assert.assertEquals(100, fieldValues[0]);
+ Assert.assertEquals("test", fieldValues[1]);
+ }
+
+ @Test
+ public void testEnum() throws Exception {
+ @SuppressWarnings("rawtypes")
+ Class<? extends Enum> cls = JavassistUtils.createEnum("cse.ut.EnumAbc", "a", "b");
+ Method method = cls.getMethod("values");
+ Enum<?>[] values = (Enum<?>[]) method.invoke(null);
+
+ Assert.assertEquals("cse.ut.EnumAbc", cls.getName());
+ Assert.assertEquals(2, values.length);
+ Assert.assertEquals("a", values[0].name());
+ Assert.assertEquals(0, values[0].ordinal());
+ Assert.assertEquals("b", values[1].name());
+ Assert.assertEquals(1, values[1].ordinal());
+ }
+
+ @Test
+ public void testGetNameForGenerateCode() {
+ JavaType jt = TypeFactory.defaultInstance().constructType(byte[].class);
+ String name = JavassistUtils.getNameForGenerateCode(jt);
+ Assert.assertEquals("byte[]", name);
+
+ jt = TypeFactory.defaultInstance().constructType(Byte[].class);
+ name = JavassistUtils.getNameForGenerateCode(jt);
+ Assert.assertEquals("java.lang.Byte[]", name);
+
+ jt = TypeFactory.defaultInstance().constructType(Object[].class);
+ name = JavassistUtils.getNameForGenerateCode(jt);
+ Assert.assertEquals("java.lang.Object[]", name);
+ }
+
+ @Test
+ public void managerClassPool() {
+ ClassLoader classLoader1 = new ClassLoader() { };
+ ClassLoader classLoader2 = new ClassLoader() { };
+
+ ClassPool p1 = Deencapsulation.invoke(JavassistUtils.class, "getOrCreateClassPool", classLoader1);
+ ClassPool p2 = Deencapsulation.invoke(JavassistUtils.class, "getOrCreateClassPool", classLoader2);
+ Assert.assertNotSame(p1, p2);
+
+ Map<ClassLoader, ClassPool> CLASSPOOLS = Deencapsulation.getField(JavassistUtils.class, "CLASSPOOLS");
+ JavassistUtils.clearByClassLoader(classLoader1);
+ Assert.assertNull(CLASSPOOLS.get(classLoader1));
+ }
+}
diff --git a/common/common-protobuf/pom.xml b/common/common-protobuf/pom.xml
index ed1b333..f9f1026 100644
--- a/common/common-protobuf/pom.xml
+++ b/common/common-protobuf/pom.xml
@@ -16,53 +16,53 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>io.servicecomb</groupId>
- <artifactId>common</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- </parent>
- <artifactId>common-protobuf</artifactId>
- <name>Java Chassis::Common::Protobuf</name>
-
- <dependencies>
- <dependency>
- <groupId>io.servicecomb</groupId>
- <artifactId>java-chassis-core</artifactId>
- </dependency>
- <dependency>
- <groupId>io.protostuff</groupId>
- <artifactId>protostuff-core</artifactId>
- </dependency>
- <dependency>
- <groupId>io.protostuff</groupId>
- <artifactId>protostuff-runtime</artifactId>
- </dependency>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>io.servicecomb</groupId>
+ <artifactId>common</artifactId>
+ <version>0.6.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>common-protobuf</artifactId>
+ <name>Java Chassis::Common::Protobuf</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.servicecomb</groupId>
+ <artifactId>java-chassis-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.protostuff</groupId>
+ <artifactId>protostuff-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.protostuff</groupId>
+ <artifactId>protostuff-runtime</artifactId>
+ </dependency>
<!-- 当前没作用,但是后续还是要改回jackson插件机制的,相关代码先保留吧 -->
- <dependency>
- <groupId>com.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-protobuf</artifactId>
- </dependency>
- <dependency>
- <groupId>io.servicecomb</groupId>
- <artifactId>common-javassist</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java</artifactId>
- <version>3.3.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-protobuf</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.servicecomb</groupId>
+ <artifactId>common-javassist</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ <version>3.3.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
diff --git a/common/common-protobuf/src/main/java/io/protostuff/runtime/ProtobufCompatibleUtils.java b/common/common-protobuf/src/main/java/io/protostuff/runtime/ProtobufCompatibleUtils.java
index c9c5cc3..ac625b7 100644
--- a/common/common-protobuf/src/main/java/io/protostuff/runtime/ProtobufCompatibleUtils.java
+++ b/common/common-protobuf/src/main/java/io/protostuff/runtime/ProtobufCompatibleUtils.java
@@ -19,11 +19,12 @@ package io.protostuff.runtime;
import java.io.IOException;
import java.util.Map;
+import org.apache.servicecomb.foundation.common.utils.ReflectUtils;
+
import io.protostuff.Input;
import io.protostuff.Output;
import io.protostuff.Pipe;
import io.protostuff.WireFormat.FieldType;
-import io.servicecomb.foundation.common.utils.ReflectUtils;
/**
* protostuff实现protobuf逻辑时,关于map的编码与protobuf不兼容
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/AbstractCodec.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/AbstractCodec.java
deleted file mode 100644
index c4ddeea..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/AbstractCodec.java
+++ /dev/null
@@ -1,40 +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.servicecomb.codec.protobuf.codec;
-
-import java.lang.reflect.Type;
-
-import com.fasterxml.jackson.databind.ObjectReader;
-import com.fasterxml.jackson.databind.ObjectWriter;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
-
-public abstract class AbstractCodec {
- protected ObjectWriter writer;
-
- protected ObjectReader reader;
-
- public ObjectWriter getWriter() {
- return writer;
- }
-
- public ObjectReader getReader() {
- return reader;
- }
-
- public abstract void init(ProtobufSchema schema, Type... types);
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/AbstractFieldCodec.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/AbstractFieldCodec.java
deleted file mode 100644
index 7cfbaaf..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/AbstractFieldCodec.java
+++ /dev/null
@@ -1,82 +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.servicecomb.codec.protobuf.codec;
-
-import java.lang.reflect.Type;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import com.fasterxml.jackson.databind.JavaType;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.type.TypeFactory;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufField;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
-
-import io.servicecomb.codec.protobuf.jackson.CseObjectReader;
-
-public class AbstractFieldCodec extends AbstractCodec {
- public static class ReaderHelpData {
- // 在reader返回的Object[]中的下标
- private int index;
-
- private JsonDeserializer<Object> deser;
-
- public int getIndex() {
- return index;
- }
-
- public void setIndex(int index) {
- this.index = index;
- }
-
- public JsonDeserializer<Object> getDeser() {
- return deser;
- }
-
- public void setDeser(JsonDeserializer<Object> deser) {
- this.deser = deser;
- }
- }
-
- // key为field name
- protected Map<String, ReaderHelpData> readerHelpDataMap = new HashMap<>();
-
- @Override
- public void init(ProtobufSchema schema, Type... types) {
- initFieldMap(schema, types);
- }
-
- private void initFieldMap(ProtobufSchema schema, Type[] types) {
- Iterator<ProtobufField> fieldIter = schema.getRootType().fields().iterator();
- for (int idx = 0; idx < schema.getRootType().getFieldCount(); idx++) {
- JavaType type = TypeFactory.defaultInstance().constructType(types[idx]);
- ProtobufField field = fieldIter.next();
-
- ReaderHelpData helpData = new ReaderHelpData();
- helpData.index = idx;
- helpData.deser = ((CseObjectReader) reader).findDeserializer(type);
-
- readerHelpDataMap.put(field.name, helpData);
- }
- }
-
- public ReaderHelpData findInfo(String name) {
- return readerHelpDataMap.get(name);
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/ParamFieldCodec.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/ParamFieldCodec.java
deleted file mode 100644
index 7a00c05..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/ParamFieldCodec.java
+++ /dev/null
@@ -1,39 +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.servicecomb.codec.protobuf.codec;
-
-import java.lang.reflect.Type;
-
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
-
-import io.servicecomb.codec.protobuf.definition.ProtobufManager;
-import io.servicecomb.codec.protobuf.jackson.CseObjectReader;
-import io.servicecomb.codec.protobuf.jackson.CseObjectWriter;
-import io.servicecomb.codec.protobuf.jackson.ParamDeserializer;
-import io.servicecomb.codec.protobuf.jackson.ParamSerializer;
-
-public class ParamFieldCodec extends AbstractFieldCodec {
- @Override
- public void init(ProtobufSchema schema, Type... types) {
- writer = new CseObjectWriter(ProtobufManager.getWriter(), schema, new ParamSerializer());
- reader =
- new CseObjectReader(ProtobufManager.getReader(), schema, new ParamDeserializer(readerHelpDataMap));
-
- super.init(schema, types);
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/ResultFieldCodec.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/ResultFieldCodec.java
deleted file mode 100644
index d9a998a..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/ResultFieldCodec.java
+++ /dev/null
@@ -1,39 +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.servicecomb.codec.protobuf.codec;
-
-import java.lang.reflect.Type;
-
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
-
-import io.servicecomb.codec.protobuf.definition.ProtobufManager;
-import io.servicecomb.codec.protobuf.jackson.CseObjectReader;
-import io.servicecomb.codec.protobuf.jackson.CseObjectWriter;
-import io.servicecomb.codec.protobuf.jackson.ResultDeserializer;
-import io.servicecomb.codec.protobuf.jackson.ResultSerializer;
-
-public class ResultFieldCodec extends AbstractFieldCodec {
- @Override
- public void init(ProtobufSchema schema, Type... types) {
- writer = new CseObjectWriter(ProtobufManager.getWriter(), schema, new ResultSerializer());
- reader =
- new CseObjectReader(ProtobufManager.getReader(), schema, new ResultDeserializer(readerHelpDataMap));
-
- super.init(schema, types);
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/StandardParamCodec.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/StandardParamCodec.java
deleted file mode 100644
index c96cf9a..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/StandardParamCodec.java
+++ /dev/null
@@ -1,43 +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.servicecomb.codec.protobuf.codec;
-
-import java.lang.reflect.Type;
-
-import com.fasterxml.jackson.databind.JavaType;
-import com.fasterxml.jackson.databind.type.TypeFactory;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
-
-import io.servicecomb.codec.protobuf.definition.ProtobufManager;
-import io.servicecomb.codec.protobuf.jackson.StandardObjectReader;
-import io.servicecomb.codec.protobuf.jackson.StandardObjectWriter;
-
-public class StandardParamCodec extends AbstractCodec {
- @Override
- public void init(ProtobufSchema schema, Type... types) {
- writer = ProtobufManager.getMapper().writer(schema);
- reader = ProtobufManager.getMapper().reader(schema);
-
- // 需要考虑没参数的场景
- if (types.length == 1) {
- JavaType javaType = TypeFactory.defaultInstance().constructType(types[0]);
- writer = new StandardObjectWriter(writer.forType(javaType));
- reader = new StandardObjectReader(reader.forType(javaType));
- }
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/StandardResultCodec.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/StandardResultCodec.java
deleted file mode 100644
index c477c28..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/codec/StandardResultCodec.java
+++ /dev/null
@@ -1,41 +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.servicecomb.codec.protobuf.codec;
-
-import java.lang.reflect.Type;
-
-import com.fasterxml.jackson.databind.JavaType;
-import com.fasterxml.jackson.databind.type.TypeFactory;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
-
-import io.servicecomb.codec.protobuf.definition.ProtobufManager;
-
-public class StandardResultCodec extends AbstractCodec {
- @Override
- public void init(ProtobufSchema schema, Type... types) {
- writer = ProtobufManager.getMapper().writer(schema);
- reader = ProtobufManager.getMapper().reader(schema);
-
- // 需要考虑void场景
- if (types.length == 1) {
- JavaType javaType = TypeFactory.defaultInstance().constructType(types[0]);
- writer = writer.forType(javaType);
- reader = reader.forType(javaType);
- }
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/definition/OperationProtobuf.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/definition/OperationProtobuf.java
deleted file mode 100644
index bd21aa5..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/definition/OperationProtobuf.java
+++ /dev/null
@@ -1,66 +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.servicecomb.codec.protobuf.definition;
-
-import java.lang.reflect.Method;
-
-import javax.ws.rs.core.Response.Status.Family;
-
-import io.servicecomb.codec.protobuf.utils.ProtobufSchemaUtils;
-import io.servicecomb.codec.protobuf.utils.WrapSchema;
-import io.servicecomb.core.definition.OperationMeta;
-import io.servicecomb.swagger.invocation.response.ResponseMeta;
-
-public class OperationProtobuf {
- private OperationMeta operationMeta;
-
- private WrapSchema requestSchema;
-
- private WrapSchema responseSchema;
-
- public OperationProtobuf(OperationMeta operationMeta)
- throws Exception {
- this.operationMeta = operationMeta;
-
- requestSchema = ProtobufSchemaUtils.getOrCreateArgsSchema(operationMeta);
-
- Method method = operationMeta.getMethod();
- responseSchema = ProtobufSchemaUtils.getOrCreateSchema(method.getGenericReturnType());
- }
-
- public OperationMeta getOperationMeta() {
- return operationMeta;
- }
-
- public WrapSchema getRequestSchema() {
- return requestSchema;
- }
-
- public WrapSchema getResponseSchema() {
- return responseSchema;
- }
-
- public WrapSchema findResponseSchema(int statusCode) {
- if (Family.SUCCESSFUL.equals(Family.familyOf(statusCode))) {
- return responseSchema;
- }
-
- ResponseMeta responseMeta = operationMeta.findResponseMeta(statusCode);
- return ProtobufSchemaUtils.getOrCreateSchema(responseMeta.getJavaType());
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/definition/ProtobufManager.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/definition/ProtobufManager.java
deleted file mode 100644
index 834c3f0..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/definition/ProtobufManager.java
+++ /dev/null
@@ -1,78 +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.servicecomb.codec.protobuf.definition;
-
-import com.fasterxml.jackson.databind.ObjectReader;
-import com.fasterxml.jackson.databind.ObjectWriter;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.dataformat.protobuf.ProtobufMapper;
-
-import io.servicecomb.core.definition.OperationMeta;
-
-public final class ProtobufManager {
- private static ProtobufManager instance = new ProtobufManager();
-
- private static ProtobufMapper mapper = new ProtobufMapper();
-
- private static ObjectWriter writer = mapper.writer();
-
- private static ObjectReader reader = mapper.reader();
-
- public static final String EXT_ID = "protobuf";
-
- private static final Object LOCK = new Object();
-
- static {
- // 支持在idl中定义empty message
- mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
- }
-
- private ProtobufManager() {
- }
-
- public static OperationProtobuf getOrCreateOperation(OperationMeta operationMeta) throws Exception {
- OperationProtobuf operationProtobuf = operationMeta.getExtData(ProtobufManager.EXT_ID);
- if (operationProtobuf == null) {
- synchronized (LOCK) {
- operationProtobuf = operationMeta.getExtData(ProtobufManager.EXT_ID);
- if (operationProtobuf == null) {
- operationProtobuf = new OperationProtobuf(operationMeta);
- operationMeta.putExtData(EXT_ID, operationProtobuf);
- }
- }
- }
-
- return operationProtobuf;
- }
-
- public static ProtobufManager getInstance() {
- return instance;
- }
-
- public static ProtobufMapper getMapper() {
- return mapper;
- }
-
- public static ObjectWriter getWriter() {
- return writer;
- }
-
- public static ObjectReader getReader() {
- return reader;
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/AbstractDeserializer.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/AbstractDeserializer.java
deleted file mode 100644
index bcf089b..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/AbstractDeserializer.java
+++ /dev/null
@@ -1,67 +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.servicecomb.codec.protobuf.jackson;
-
-import java.io.IOException;
-import java.util.Map;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-
-import io.servicecomb.codec.protobuf.codec.AbstractFieldCodec.ReaderHelpData;
-
-public abstract class AbstractDeserializer extends JsonDeserializer<Object> {
- protected Map<String, ReaderHelpData> readerHelpDataMap;
-
- public AbstractDeserializer(Map<String, ReaderHelpData> readerHelpDataMap) {
- this.readerHelpDataMap = readerHelpDataMap;
- }
-
- @Override
- public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
- Object result = createResult();
- for (String fieldName = p.nextFieldName(); fieldName != null; fieldName = p.nextFieldName()) {
- // p实际是ProtobufParser,其内部是可以直接取到proto field的,理论上可以根据id来索引
- // 可是field默认没暴露出来,所以,直接用name索引了
- ReaderHelpData helpData = readerHelpDataMap.get(fieldName);
- if (helpData == null) {
- continue;
- }
-
- JsonToken t = p.nextToken();
- // Note: must handle null explicitly here; value deserializers won't
- Object value = null;
- if (t == JsonToken.VALUE_NULL) {
- value = helpData.getDeser().getNullValue(ctxt);
- } else {
- value = helpData.getDeser().deserialize(p, ctxt);
- }
-
- result = updateResult(result, value, helpData);
- }
-
- return result;
- }
-
- protected abstract Object createResult();
-
- protected abstract Object updateResult(Object result, Object value, ReaderHelpData helpData);
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/CseObjectReader.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/CseObjectReader.java
deleted file mode 100644
index b397ca6..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/CseObjectReader.java
+++ /dev/null
@@ -1,35 +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.servicecomb.codec.protobuf.jackson;
-
-import com.fasterxml.jackson.core.FormatSchema;
-import com.fasterxml.jackson.databind.JavaType;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.ObjectReader;
-
-public class CseObjectReader extends ObjectReader {
- private static final long serialVersionUID = -4154834940923475928L;
-
- public CseObjectReader(ObjectReader base, FormatSchema schema, JsonDeserializer<Object> rootDeser) {
- super(base, base.getConfig(), null, rootDeser, null, schema, null, null);
- }
-
- public JsonDeserializer<Object> findDeserializer(JavaType valueType) {
- return _prefetchRootDeserializer(valueType);
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/CseObjectWriter.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/CseObjectWriter.java
deleted file mode 100644
index 4cbda8d..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/CseObjectWriter.java
+++ /dev/null
@@ -1,57 +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.servicecomb.codec.protobuf.jackson;
-
-import java.lang.reflect.Constructor;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.core.FormatSchema;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.ObjectWriter;
-
-@SuppressWarnings("unchecked")
-public class CseObjectWriter extends ObjectWriter {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(CseObjectWriter.class);
-
- private static final long serialVersionUID = -6435897284942268001L;
-
- private static Constructor<Prefetch> prefetchConstructor;
-
- static {
- prefetchConstructor = (Constructor<Prefetch>) Prefetch.class.getDeclaredConstructors()[0];
- prefetchConstructor.setAccessible(true);
- }
-
- private static Prefetch createPrefetch(JsonSerializer<Object> valueSerializer) {
- try {
- return prefetchConstructor.newInstance(null, valueSerializer, null);
- } catch (Exception e) {
- LOGGER.error("create prefetch error:", e);
- }
- return null;
- }
-
- public CseObjectWriter(ObjectWriter base, FormatSchema schema, JsonSerializer<Object> valueSerializer) {
-
- super(base, base.getConfig(), new GeneratorSettings(null, schema, null, null),
- createPrefetch(valueSerializer));
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/ParamDeserializer.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/ParamDeserializer.java
deleted file mode 100644
index f373de4..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/ParamDeserializer.java
+++ /dev/null
@@ -1,40 +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.servicecomb.codec.protobuf.jackson;
-
-import java.util.Map;
-
-import io.servicecomb.codec.protobuf.codec.AbstractFieldCodec.ReaderHelpData;
-
-public class ParamDeserializer extends AbstractDeserializer {
-
- public ParamDeserializer(Map<String, ReaderHelpData> readerHelpDataMap) {
- super(readerHelpDataMap);
- }
-
- @Override
- protected Object createResult() {
- return new Object[readerHelpDataMap.size()];
- }
-
- @Override
- protected Object updateResult(Object result, Object value, ReaderHelpData helpData) {
- ((Object[]) result)[helpData.getIndex()] = value;
- return result;
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/ParamSerializer.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/ParamSerializer.java
deleted file mode 100644
index 1311f47..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/ParamSerializer.java
+++ /dev/null
@@ -1,45 +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.servicecomb.codec.protobuf.jackson;
-
-import java.io.IOException;
-import java.util.Iterator;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.dataformat.protobuf.ProtobufGenerator;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufField;
-
-public class ParamSerializer extends JsonSerializer<Object> {
- @Override
- public void serialize(Object value, JsonGenerator gen,
- SerializerProvider serializers) throws IOException, JsonProcessingException {
- gen.writeStartObject();
-
- ProtobufGenerator protobufGenerator = (ProtobufGenerator) gen;
- Iterator<ProtobufField> iter = protobufGenerator.getSchema().getRootType().fields().iterator();
- Object[] values = (Object[]) value;
- for (Object value1 : values) {
- gen.writeObjectField(iter.next().name, value1);
- }
-
- gen.writeEndObject();
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/ResultDeserializer.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/ResultDeserializer.java
deleted file mode 100644
index 9174ada..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/ResultDeserializer.java
+++ /dev/null
@@ -1,39 +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.servicecomb.codec.protobuf.jackson;
-
-import java.util.Map;
-
-import io.servicecomb.codec.protobuf.codec.AbstractFieldCodec.ReaderHelpData;
-
-public class ResultDeserializer extends AbstractDeserializer {
-
- public ResultDeserializer(Map<String, ReaderHelpData> readerHelpDataMap) {
- super(readerHelpDataMap);
- }
-
- @Override
- protected Object createResult() {
- return null;
- }
-
- @Override
- protected Object updateResult(Object result, Object value, ReaderHelpData helpData) {
- return value;
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/ResultSerializer.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/ResultSerializer.java
deleted file mode 100644
index 8b864be..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/ResultSerializer.java
+++ /dev/null
@@ -1,41 +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.servicecomb.codec.protobuf.jackson;
-
-import java.io.IOException;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.dataformat.protobuf.ProtobufGenerator;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufField;
-
-public class ResultSerializer extends JsonSerializer<Object> {
- @Override
- public void serialize(Object value, JsonGenerator gen,
- SerializerProvider serializers) throws IOException, JsonProcessingException {
- gen.writeStartObject();
-
- ProtobufGenerator protobufGenerator = (ProtobufGenerator) gen;
- ProtobufField field = protobufGenerator.getSchema().getRootType().firstField();
- gen.writeObjectField(field.name, value);
-
- gen.writeEndObject();
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/StandardObjectReader.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/StandardObjectReader.java
deleted file mode 100644
index 755fcd2..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/StandardObjectReader.java
+++ /dev/null
@@ -1,39 +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.servicecomb.codec.protobuf.jackson;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectReader;
-
-public class StandardObjectReader extends ObjectReader {
- private static final long serialVersionUID = -8162644250351645123L;
-
- public StandardObjectReader(ObjectReader base) {
- super(base, base.getConfig());
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> T readValue(InputStream src) throws IOException, JsonProcessingException {
- T result = super.readValue(src);
- return (T) new Object[] {result};
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/StandardObjectWriter.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/StandardObjectWriter.java
deleted file mode 100644
index bad0675..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/jackson/StandardObjectWriter.java
+++ /dev/null
@@ -1,40 +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.servicecomb.codec.protobuf.jackson;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectWriter;
-
-public class StandardObjectWriter extends ObjectWriter {
- private static final long serialVersionUID = -8162644250351645123L;
-
- public StandardObjectWriter(ObjectWriter base) {
- super(base, base.getConfig());
- }
-
- @Override
- public void writeValue(OutputStream out,
- Object value) throws IOException, JsonGenerationException, JsonMappingException {
- Object[] values = (Object[]) value;
- super.writeValue(out, values[0]);
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/ProtobufSchemaUtils.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/ProtobufSchemaUtils.java
deleted file mode 100644
index cf3f9e5..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/ProtobufSchemaUtils.java
+++ /dev/null
@@ -1,160 +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.servicecomb.codec.protobuf.utils;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Parameter;
-import java.lang.reflect.Type;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.springframework.util.ClassUtils;
-
-import com.fasterxml.jackson.databind.JavaType;
-import com.fasterxml.jackson.databind.type.TypeFactory;
-
-import io.protostuff.Schema;
-import io.protostuff.runtime.ProtobufCompatibleUtils;
-import io.protostuff.runtime.RuntimeSchema;
-import io.servicecomb.codec.protobuf.utils.schema.WrapSchemaFactory;
-import io.servicecomb.common.javassist.JavassistUtils;
-import io.servicecomb.core.definition.OperationMeta;
-
-public final class ProtobufSchemaUtils {
- private static volatile Map<String, WrapSchema> schemaCache = new ConcurrentHashMap<>();
-
- static {
- ProtobufCompatibleUtils.init();
- }
-
- private interface SchemaCreator {
- WrapSchema create() throws Exception;
- }
-
- private ProtobufSchemaUtils() {
- }
-
- private static WrapSchema getOrCreateSchema(String className, SchemaCreator creator) {
- WrapSchema schema = schemaCache.get(className);
- if (schema != null) {
- return schema;
- }
-
- synchronized (ProtobufSchemaUtils.class) {
- schema = schemaCache.get(className);
- if (schema != null) {
- return schema;
- }
-
- try {
- schema = creator.create();
- } catch (Exception e) {
- throw new Error(e);
- }
- schemaCache.put(className, schema);
- return schema;
- }
- }
-
- private static boolean isArgsNeedWrap(Method method) {
- if (method.getParameterCount() != 1) {
- return true;
- }
-
- // 单参数时,需要根据实际情况判断
- return isNeedWrap(method.getParameterTypes()[0]);
- }
-
- private static boolean isNeedWrap(Class<?> cls) {
- // protobuf不支持原子类型、enum、string、数组、collection等等作为msg,只有Object类型才可以
- return ClassUtils.isPrimitiveOrWrapper(cls) || cls.isArray() || cls.isEnum()
- || String.class.isAssignableFrom(cls)
- || Collection.class.isAssignableFrom(cls)
- || Map.class.isAssignableFrom(cls)
- || Date.class.isAssignableFrom(cls);
- }
-
- // 为了支持method args的场景,全部实现ProtobufMessageWrapper接口,有的场景有点浪费,不过无关紧要
- private static WrapSchema createWrapSchema(WrapClassConfig config) throws Exception {
- Class<?> cls = JavassistUtils.createClass(config);
- Schema<?> schema = RuntimeSchema.createFrom(cls);
- return WrapSchemaFactory.createSchema(schema, config.getType());
- }
-
- // 适用于将单个类型包装的场景
- // 比如return
- public static WrapSchema getOrCreateSchema(Type type) {
- JavaType javaType = TypeFactory.defaultInstance().constructType(type);
- // List<String> -> java.util.List<java.lang.String>
- // List<List<String>> -> java.util.List<java.util.List<java.lang.String>>
- String key = javaType.toCanonical();
- return getOrCreateSchema(key, () -> {
- if (!isNeedWrap(javaType.getRawClass())) {
- // 可以直接使用
- Schema<?> schema = RuntimeSchema.createFrom(javaType.getRawClass());
- return WrapSchemaFactory.createSchema(schema, WrapType.NOT_WRAP);
- }
-
- // 需要包装
- WrapClassConfig config = new WrapClassConfig();
- config.setType(WrapType.NORMAL_WRAP);
-
- config.setClassName("gen.wrap.protobuf." + key.replaceAll("[<>]", "_").replace("[", "array_"));
- if (!Void.TYPE.isAssignableFrom(javaType.getRawClass())) {
- config.addField("field0", javaType);
- }
-
- JavassistUtils.genSingleWrapperInterface(config);
-
- return createWrapSchema(config);
- });
- }
-
- public static WrapSchema getOrCreateArgsSchema(OperationMeta operationMeta) {
- Method method = operationMeta.getMethod();
- String type = "gen." + method.getDeclaringClass().getName() + "." + method.getName() + ".Args";
-
- return getOrCreateSchema(type, () -> {
- if (!isArgsNeedWrap(method)) {
- // 可以直接使用
- Class<?> cls = (Class<?>) method.getParameterTypes()[0];
- Schema<?> schema = RuntimeSchema.createFrom(cls);
- return WrapSchemaFactory.createSchema(schema, WrapType.ARGS_NOT_WRAP);
- }
-
- // 需要包装
- WrapClassConfig config = new WrapClassConfig();
- config.setType(WrapType.ARGS_WRAP);
- config.setClassName(type);
-
- Parameter[] params = method.getParameters();
- for (int idx = 0; idx < params.length; idx++) {
- Parameter param = params[idx];
- String paramName = io.servicecomb.swagger.generator.core.utils.ClassUtils
- .correctMethodParameterName(operationMeta.getParamName(idx));
- config.addField(paramName, param.getParameterizedType());
- }
-
- JavassistUtils.genMultiWrapperInterface(config);
-
- return createWrapSchema(config);
- });
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/WrapClassConfig.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/WrapClassConfig.java
deleted file mode 100644
index 6a56a8c..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/WrapClassConfig.java
+++ /dev/null
@@ -1,32 +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.servicecomb.codec.protobuf.utils;
-
-import io.servicecomb.common.javassist.ClassConfig;
-
-public class WrapClassConfig extends ClassConfig {
- private WrapType type;
-
- public WrapType getType() {
- return type;
- }
-
- public void setType(WrapType type) {
- this.type = type;
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/WrapSchema.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/WrapSchema.java
deleted file mode 100644
index 40a05f8..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/WrapSchema.java
+++ /dev/null
@@ -1,63 +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.servicecomb.codec.protobuf.utils;
-
-import java.nio.ByteBuffer;
-
-import io.protostuff.ByteBufferInput;
-import io.protostuff.Input;
-import io.protostuff.Output;
-import io.protostuff.runtime.ProtobufFeature;
-import io.protostuff.runtime.ProtobufFeatureUtils;
-import io.vertx.core.buffer.Buffer;
-
-public interface WrapSchema {
- @SuppressWarnings("unchecked")
- default <T> T readObject(Buffer buffer, ProtobufFeature protobufFeature) throws Exception {
- if (buffer == null || buffer.length() == 0) {
- // void以及函数入参为null的场景
- // 空串时,protobuf至少为编码为1字节
- return (T) readFromEmpty();
- }
-
- ByteBuffer nioBuffer = buffer.getByteBuf().nioBuffer();
- Input input = new ByteBufferInput(nioBuffer, false);
-
- ProtobufFeatureUtils.setProtobufFeature(protobufFeature);
- try {
- return (T) readObject(input);
- } finally {
- ProtobufFeatureUtils.removeProtobufFeature();
- }
- }
-
- default void writeObject(Output output, Object value, ProtobufFeature protobufFeature) throws Exception {
- ProtobufFeatureUtils.setProtobufFeature(protobufFeature);
- try {
- writeObject(output, value);
- } finally {
- ProtobufFeatureUtils.removeProtobufFeature();
- }
- }
-
- Object readFromEmpty();
-
- Object readObject(Input input) throws Exception;
-
- void writeObject(Output output, Object value) throws Exception;
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/WrapType.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/WrapType.java
deleted file mode 100644
index 0224772..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/WrapType.java
+++ /dev/null
@@ -1,25 +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.servicecomb.codec.protobuf.utils;
-
-public enum WrapType {
- NOT_WRAP,
- NORMAL_WRAP,
- ARGS_NOT_WRAP,
- ARGS_WRAP
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/AbstractWrapSchema.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/AbstractWrapSchema.java
deleted file mode 100644
index 658ec48..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/AbstractWrapSchema.java
+++ /dev/null
@@ -1,25 +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.servicecomb.codec.protobuf.utils.schema;
-
-import io.protostuff.Schema;
-import io.servicecomb.codec.protobuf.utils.WrapSchema;
-
-public abstract class AbstractWrapSchema implements WrapSchema {
- protected Schema<Object> schema;
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/ArgsNotWrapSchema.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/ArgsNotWrapSchema.java
deleted file mode 100644
index a25f74a..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/ArgsNotWrapSchema.java
+++ /dev/null
@@ -1,53 +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.servicecomb.codec.protobuf.utils.schema;
-
-import java.io.IOException;
-
-import io.protostuff.Input;
-import io.protostuff.Output;
-import io.protostuff.Schema;
-
-public class ArgsNotWrapSchema extends AbstractWrapSchema {
-
- @SuppressWarnings("unchecked")
- public ArgsNotWrapSchema(Schema<?> schema) {
- this.schema = (Schema<Object>) schema;
- }
-
- @Override
- public Object readFromEmpty() {
- return new Object[] {null};
- }
-
- public Object readObject(Input input) throws IOException {
- Object readValue = schema.newMessage();
- schema.mergeFrom(input, readValue);
-
- return new Object[] {readValue};
- }
-
- public void writeObject(Output output, Object value) throws IOException {
- Object writeValue = ((Object[]) value)[0];
- if (writeValue == null) {
- return;
- }
-
- schema.writeTo(output, writeValue);
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/ArgsWrapSchema.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/ArgsWrapSchema.java
deleted file mode 100644
index 0c5abae..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/ArgsWrapSchema.java
+++ /dev/null
@@ -1,53 +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.servicecomb.codec.protobuf.utils.schema;
-
-import java.io.IOException;
-
-import io.protostuff.Input;
-import io.protostuff.Output;
-import io.protostuff.Schema;
-import io.servicecomb.common.javassist.MultiWrapper;
-
-public class ArgsWrapSchema extends AbstractWrapSchema {
-
- @SuppressWarnings("unchecked")
- public ArgsWrapSchema(Schema<?> schema) {
- this.schema = (Schema<Object>) schema;
- }
-
- @Override
- public Object readFromEmpty() {
- MultiWrapper wrapper = (MultiWrapper) schema.newMessage();
- return wrapper.readFields();
- }
-
- public Object readObject(Input input) throws IOException {
- MultiWrapper wrapper = (MultiWrapper) schema.newMessage();
- schema.mergeFrom(input, wrapper);
-
- return wrapper.readFields();
- }
-
- public void writeObject(Output output, Object value) throws IOException {
- MultiWrapper wrapper = (MultiWrapper) schema.newMessage();
- wrapper.writeFields((Object[]) value);
-
- schema.writeTo(output, wrapper);
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/NormalWrapSchema.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/NormalWrapSchema.java
deleted file mode 100644
index fcc58e6..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/NormalWrapSchema.java
+++ /dev/null
@@ -1,57 +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.servicecomb.codec.protobuf.utils.schema;
-
-import java.io.IOException;
-
-import io.protostuff.Input;
-import io.protostuff.Output;
-import io.protostuff.Schema;
-import io.servicecomb.common.javassist.SingleWrapper;
-
-public class NormalWrapSchema extends AbstractWrapSchema {
-
- @SuppressWarnings("unchecked")
- public NormalWrapSchema(Schema<?> schema) {
- this.schema = (Schema<Object>) schema;
- }
-
- @Override
- public Object readFromEmpty() {
- SingleWrapper wrapper = (SingleWrapper) schema.newMessage();
- return wrapper.readField();
- }
-
- public Object readObject(Input input) throws IOException {
- SingleWrapper wrapper = (SingleWrapper) schema.newMessage();
- schema.mergeFrom(input, wrapper);
-
- return wrapper.readField();
- }
-
- public void writeObject(Output output, Object value) throws IOException {
- if (value == null) {
- return;
- }
-
- SingleWrapper wrapper = (SingleWrapper) schema.newMessage();
- wrapper.writeField(value);
-
- schema.writeTo(output, wrapper);
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/NotWrapSchema.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/NotWrapSchema.java
deleted file mode 100644
index 4252f59..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/NotWrapSchema.java
+++ /dev/null
@@ -1,52 +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.servicecomb.codec.protobuf.utils.schema;
-
-import java.io.IOException;
-
-import io.protostuff.Input;
-import io.protostuff.Output;
-import io.protostuff.Schema;
-
-public class NotWrapSchema extends AbstractWrapSchema {
-
- @SuppressWarnings("unchecked")
- public NotWrapSchema(Schema<?> schema) {
- this.schema = (Schema<Object>) schema;
- }
-
- @Override
- public Object readFromEmpty() {
- return null;
- }
-
- public Object readObject(Input input) throws IOException {
- Object value = schema.newMessage();
- schema.mergeFrom(input, value);
-
- return value;
- }
-
- public void writeObject(Output output, Object value) throws IOException {
- if (value == null) {
- return;
- }
-
- schema.writeTo(output, value);
- }
-}
diff --git a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/WrapSchemaFactory.java b/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/WrapSchemaFactory.java
deleted file mode 100644
index 9707094..0000000
--- a/common/common-protobuf/src/main/java/io/servicecomb/codec/protobuf/utils/schema/WrapSchemaFactory.java
+++ /dev/null
@@ -1,42 +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.servicecomb.codec.protobuf.utils.schema;
-
-import io.protostuff.Schema;
-import io.servicecomb.codec.protobuf.utils.WrapSchema;
-import io.servicecomb.codec.protobuf.utils.WrapType;
-
-public final class WrapSchemaFactory {
- public static WrapSchema createSchema(Schema<?> schema, WrapType type) {
- switch (type) {
- case NOT_WRAP:
- return new NotWrapSchema(schema);
- case NORMAL_WRAP:
- return new NormalWrapSchema(schema);
- case ARGS_NOT_WRAP:
- return new ArgsNotWrapSchema(schema);
- case ARGS_WRAP:
- return new ArgsWrapSchema(schema);
- default:
- throw new Error("impossible");
- }
- }
-
- private WrapSchemaFactory() {
- }
-}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/AbstractCodec.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/AbstractCodec.java
new file mode 100644
index 0000000..3098b19
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/AbstractCodec.java
@@ -0,0 +1,40 @@
+/*
+ * 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.codec.protobuf.codec;
+
+import java.lang.reflect.Type;
+
+import com.fasterxml.jackson.databind.ObjectReader;
+import com.fasterxml.jackson.databind.ObjectWriter;
+import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
+
+public abstract class AbstractCodec {
+ protected ObjectWriter writer;
+
+ protected ObjectReader reader;
+
+ public ObjectWriter getWriter() {
+ return writer;
+ }
+
+ public ObjectReader getReader() {
+ return reader;
+ }
+
+ public abstract void init(ProtobufSchema schema, Type... types);
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/AbstractFieldCodec.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/AbstractFieldCodec.java
new file mode 100644
index 0000000..be664e3
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/AbstractFieldCodec.java
@@ -0,0 +1,82 @@
+/*
+ * 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.codec.protobuf.codec;
+
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.servicecomb.codec.protobuf.jackson.CseObjectReader;
+
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufField;
+import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
+
+public class AbstractFieldCodec extends AbstractCodec {
+ public static class ReaderHelpData {
+ // 在reader返回的Object[]中的下标
+ private int index;
+
+ private JsonDeserializer<Object> deser;
+
+ public int getIndex() {
+ return index;
+ }
+
+ public void setIndex(int index) {
+ this.index = index;
+ }
+
+ public JsonDeserializer<Object> getDeser() {
+ return deser;
+ }
+
+ public void setDeser(JsonDeserializer<Object> deser) {
+ this.deser = deser;
+ }
+ }
+
+ // key为field name
+ protected Map<String, ReaderHelpData> readerHelpDataMap = new HashMap<>();
+
+ @Override
+ public void init(ProtobufSchema schema, Type... types) {
+ initFieldMap(schema, types);
+ }
+
+ private void initFieldMap(ProtobufSchema schema, Type[] types) {
+ Iterator<ProtobufField> fieldIter = schema.getRootType().fields().iterator();
+ for (int idx = 0; idx < schema.getRootType().getFieldCount(); idx++) {
+ JavaType type = TypeFactory.defaultInstance().constructType(types[idx]);
+ ProtobufField field = fieldIter.next();
+
+ ReaderHelpData helpData = new ReaderHelpData();
+ helpData.index = idx;
+ helpData.deser = ((CseObjectReader) reader).findDeserializer(type);
+
+ readerHelpDataMap.put(field.name, helpData);
+ }
+ }
+
+ public ReaderHelpData findInfo(String name) {
+ return readerHelpDataMap.get(name);
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/ParamFieldCodec.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/ParamFieldCodec.java
new file mode 100644
index 0000000..356e01a
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/ParamFieldCodec.java
@@ -0,0 +1,39 @@
+/*
+ * 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.codec.protobuf.codec;
+
+import java.lang.reflect.Type;
+
+import org.apache.servicecomb.codec.protobuf.definition.ProtobufManager;
+import org.apache.servicecomb.codec.protobuf.jackson.CseObjectReader;
+import org.apache.servicecomb.codec.protobuf.jackson.CseObjectWriter;
+import org.apache.servicecomb.codec.protobuf.jackson.ParamDeserializer;
+import org.apache.servicecomb.codec.protobuf.jackson.ParamSerializer;
+
+import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
+
+public class ParamFieldCodec extends AbstractFieldCodec {
+ @Override
+ public void init(ProtobufSchema schema, Type... types) {
+ writer = new CseObjectWriter(ProtobufManager.getWriter(), schema, new ParamSerializer());
+ reader =
+ new CseObjectReader(ProtobufManager.getReader(), schema, new ParamDeserializer(readerHelpDataMap));
+
+ super.init(schema, types);
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/ResultFieldCodec.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/ResultFieldCodec.java
new file mode 100644
index 0000000..819c8c9
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/ResultFieldCodec.java
@@ -0,0 +1,39 @@
+/*
+ * 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.codec.protobuf.codec;
+
+import java.lang.reflect.Type;
+
+import org.apache.servicecomb.codec.protobuf.definition.ProtobufManager;
+import org.apache.servicecomb.codec.protobuf.jackson.CseObjectReader;
+import org.apache.servicecomb.codec.protobuf.jackson.CseObjectWriter;
+import org.apache.servicecomb.codec.protobuf.jackson.ResultDeserializer;
+import org.apache.servicecomb.codec.protobuf.jackson.ResultSerializer;
+
+import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
+
+public class ResultFieldCodec extends AbstractFieldCodec {
+ @Override
+ public void init(ProtobufSchema schema, Type... types) {
+ writer = new CseObjectWriter(ProtobufManager.getWriter(), schema, new ResultSerializer());
+ reader =
+ new CseObjectReader(ProtobufManager.getReader(), schema, new ResultDeserializer(readerHelpDataMap));
+
+ super.init(schema, types);
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/StandardParamCodec.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/StandardParamCodec.java
new file mode 100644
index 0000000..a62a408
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/StandardParamCodec.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.codec.protobuf.codec;
+
+import java.lang.reflect.Type;
+
+import org.apache.servicecomb.codec.protobuf.definition.ProtobufManager;
+import org.apache.servicecomb.codec.protobuf.jackson.StandardObjectReader;
+import org.apache.servicecomb.codec.protobuf.jackson.StandardObjectWriter;
+
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
+
+public class StandardParamCodec extends AbstractCodec {
+ @Override
+ public void init(ProtobufSchema schema, Type... types) {
+ writer = ProtobufManager.getMapper().writer(schema);
+ reader = ProtobufManager.getMapper().reader(schema);
+
+ // 需要考虑没参数的场景
+ if (types.length == 1) {
+ JavaType javaType = TypeFactory.defaultInstance().constructType(types[0]);
+ writer = new StandardObjectWriter(writer.forType(javaType));
+ reader = new StandardObjectReader(reader.forType(javaType));
+ }
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/StandardResultCodec.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/StandardResultCodec.java
new file mode 100644
index 0000000..bffb135
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/codec/StandardResultCodec.java
@@ -0,0 +1,41 @@
+/*
+ * 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.codec.protobuf.codec;
+
+import java.lang.reflect.Type;
+
+import org.apache.servicecomb.codec.protobuf.definition.ProtobufManager;
+
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
+
+public class StandardResultCodec extends AbstractCodec {
+ @Override
+ public void init(ProtobufSchema schema, Type... types) {
+ writer = ProtobufManager.getMapper().writer(schema);
+ reader = ProtobufManager.getMapper().reader(schema);
+
+ // 需要考虑void场景
+ if (types.length == 1) {
+ JavaType javaType = TypeFactory.defaultInstance().constructType(types[0]);
+ writer = writer.forType(javaType);
+ reader = reader.forType(javaType);
+ }
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/OperationProtobuf.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/OperationProtobuf.java
new file mode 100644
index 0000000..fe97a7a
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/OperationProtobuf.java
@@ -0,0 +1,66 @@
+/*
+ * 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.codec.protobuf.definition;
+
+import java.lang.reflect.Method;
+
+import javax.ws.rs.core.Response.Status.Family;
+
+import org.apache.servicecomb.codec.protobuf.utils.ProtobufSchemaUtils;
+import org.apache.servicecomb.codec.protobuf.utils.WrapSchema;
+import org.apache.servicecomb.core.definition.OperationMeta;
+import org.apache.servicecomb.swagger.invocation.response.ResponseMeta;
+
+public class OperationProtobuf {
+ private OperationMeta operationMeta;
+
+ private WrapSchema requestSchema;
+
+ private WrapSchema responseSchema;
+
+ public OperationProtobuf(OperationMeta operationMeta)
+ throws Exception {
+ this.operationMeta = operationMeta;
+
+ requestSchema = ProtobufSchemaUtils.getOrCreateArgsSchema(operationMeta);
+
+ Method method = operationMeta.getMethod();
+ responseSchema = ProtobufSchemaUtils.getOrCreateSchema(method.getGenericReturnType());
+ }
+
+ public OperationMeta getOperationMeta() {
+ return operationMeta;
+ }
+
+ public WrapSchema getRequestSchema() {
+ return requestSchema;
+ }
+
+ public WrapSchema getResponseSchema() {
+ return responseSchema;
+ }
+
+ public WrapSchema findResponseSchema(int statusCode) {
+ if (Family.SUCCESSFUL.equals(Family.familyOf(statusCode))) {
+ return responseSchema;
+ }
+
+ ResponseMeta responseMeta = operationMeta.findResponseMeta(statusCode);
+ return ProtobufSchemaUtils.getOrCreateSchema(responseMeta.getJavaType());
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/ProtobufManager.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/ProtobufManager.java
new file mode 100644
index 0000000..92ce73a
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/ProtobufManager.java
@@ -0,0 +1,78 @@
+/*
+ * 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.codec.protobuf.definition;
+
+import org.apache.servicecomb.core.definition.OperationMeta;
+
+import com.fasterxml.jackson.databind.ObjectReader;
+import com.fasterxml.jackson.databind.ObjectWriter;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.dataformat.protobuf.ProtobufMapper;
+
+public final class ProtobufManager {
+ private static ProtobufManager instance = new ProtobufManager();
+
+ private static ProtobufMapper mapper = new ProtobufMapper();
+
+ private static ObjectWriter writer = mapper.writer();
+
+ private static ObjectReader reader = mapper.reader();
+
+ public static final String EXT_ID = "protobuf";
+
+ private static final Object LOCK = new Object();
+
+ static {
+ // 支持在idl中定义empty message
+ mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
+ }
+
+ private ProtobufManager() {
+ }
+
+ public static OperationProtobuf getOrCreateOperation(OperationMeta operationMeta) throws Exception {
+ OperationProtobuf operationProtobuf = operationMeta.getExtData(ProtobufManager.EXT_ID);
+ if (operationProtobuf == null) {
+ synchronized (LOCK) {
+ operationProtobuf = operationMeta.getExtData(ProtobufManager.EXT_ID);
+ if (operationProtobuf == null) {
+ operationProtobuf = new OperationProtobuf(operationMeta);
+ operationMeta.putExtData(EXT_ID, operationProtobuf);
+ }
+ }
+ }
+
+ return operationProtobuf;
+ }
+
+ public static ProtobufManager getInstance() {
+ return instance;
+ }
+
+ public static ProtobufMapper getMapper() {
+ return mapper;
+ }
+
+ public static ObjectWriter getWriter() {
+ return writer;
+ }
+
+ public static ObjectReader getReader() {
+ return reader;
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/AbstractDeserializer.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/AbstractDeserializer.java
new file mode 100644
index 0000000..591aee5
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/AbstractDeserializer.java
@@ -0,0 +1,67 @@
+/*
+ * 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.codec.protobuf.jackson;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.apache.servicecomb.codec.protobuf.codec.AbstractFieldCodec.ReaderHelpData;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+
+public abstract class AbstractDeserializer extends JsonDeserializer<Object> {
+ protected Map<String, ReaderHelpData> readerHelpDataMap;
+
+ public AbstractDeserializer(Map<String, ReaderHelpData> readerHelpDataMap) {
+ this.readerHelpDataMap = readerHelpDataMap;
+ }
+
+ @Override
+ public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
+ Object result = createResult();
+ for (String fieldName = p.nextFieldName(); fieldName != null; fieldName = p.nextFieldName()) {
+ // p实际是ProtobufParser,其内部是可以直接取到proto field的,理论上可以根据id来索引
+ // 可是field默认没暴露出来,所以,直接用name索引了
+ ReaderHelpData helpData = readerHelpDataMap.get(fieldName);
+ if (helpData == null) {
+ continue;
+ }
+
+ JsonToken t = p.nextToken();
+ // Note: must handle null explicitly here; value deserializers won't
+ Object value = null;
+ if (t == JsonToken.VALUE_NULL) {
+ value = helpData.getDeser().getNullValue(ctxt);
+ } else {
+ value = helpData.getDeser().deserialize(p, ctxt);
+ }
+
+ result = updateResult(result, value, helpData);
+ }
+
+ return result;
+ }
+
+ protected abstract Object createResult();
+
+ protected abstract Object updateResult(Object result, Object value, ReaderHelpData helpData);
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/CseObjectReader.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/CseObjectReader.java
new file mode 100644
index 0000000..9e1d6cf
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/CseObjectReader.java
@@ -0,0 +1,35 @@
+/*
+ * 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.codec.protobuf.jackson;
+
+import com.fasterxml.jackson.core.FormatSchema;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.databind.ObjectReader;
+
+public class CseObjectReader extends ObjectReader {
+ private static final long serialVersionUID = -4154834940923475928L;
+
+ public CseObjectReader(ObjectReader base, FormatSchema schema, JsonDeserializer<Object> rootDeser) {
+ super(base, base.getConfig(), null, rootDeser, null, schema, null, null);
+ }
+
+ public JsonDeserializer<Object> findDeserializer(JavaType valueType) {
+ return _prefetchRootDeserializer(valueType);
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/CseObjectWriter.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/CseObjectWriter.java
new file mode 100644
index 0000000..c2c1330
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/CseObjectWriter.java
@@ -0,0 +1,57 @@
+/*
+ * 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.codec.protobuf.jackson;
+
+import java.lang.reflect.Constructor;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.core.FormatSchema;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.ObjectWriter;
+
+@SuppressWarnings("unchecked")
+public class CseObjectWriter extends ObjectWriter {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(CseObjectWriter.class);
+
+ private static final long serialVersionUID = -6435897284942268001L;
+
+ private static Constructor<Prefetch> prefetchConstructor;
+
+ static {
+ prefetchConstructor = (Constructor<Prefetch>) Prefetch.class.getDeclaredConstructors()[0];
+ prefetchConstructor.setAccessible(true);
+ }
+
+ private static Prefetch createPrefetch(JsonSerializer<Object> valueSerializer) {
+ try {
+ return prefetchConstructor.newInstance(null, valueSerializer, null);
+ } catch (Exception e) {
+ LOGGER.error("create prefetch error:", e);
+ }
+ return null;
+ }
+
+ public CseObjectWriter(ObjectWriter base, FormatSchema schema, JsonSerializer<Object> valueSerializer) {
+
+ super(base, base.getConfig(), new GeneratorSettings(null, schema, null, null),
+ createPrefetch(valueSerializer));
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/ParamDeserializer.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/ParamDeserializer.java
new file mode 100644
index 0000000..34c9997
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/ParamDeserializer.java
@@ -0,0 +1,40 @@
+/*
+ * 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.codec.protobuf.jackson;
+
+import java.util.Map;
+
+import org.apache.servicecomb.codec.protobuf.codec.AbstractFieldCodec.ReaderHelpData;
+
+public class ParamDeserializer extends AbstractDeserializer {
+
+ public ParamDeserializer(Map<String, ReaderHelpData> readerHelpDataMap) {
+ super(readerHelpDataMap);
+ }
+
+ @Override
+ protected Object createResult() {
+ return new Object[readerHelpDataMap.size()];
+ }
+
+ @Override
+ protected Object updateResult(Object result, Object value, ReaderHelpData helpData) {
+ ((Object[]) result)[helpData.getIndex()] = value;
+ return result;
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/ParamSerializer.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/ParamSerializer.java
new file mode 100644
index 0000000..4e959b6
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/ParamSerializer.java
@@ -0,0 +1,45 @@
+/*
+ * 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.codec.protobuf.jackson;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.dataformat.protobuf.ProtobufGenerator;
+import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufField;
+
+public class ParamSerializer extends JsonSerializer<Object> {
+ @Override
+ public void serialize(Object value, JsonGenerator gen,
+ SerializerProvider serializers) throws IOException, JsonProcessingException {
+ gen.writeStartObject();
+
+ ProtobufGenerator protobufGenerator = (ProtobufGenerator) gen;
+ Iterator<ProtobufField> iter = protobufGenerator.getSchema().getRootType().fields().iterator();
+ Object[] values = (Object[]) value;
+ for (Object value1 : values) {
+ gen.writeObjectField(iter.next().name, value1);
+ }
+
+ gen.writeEndObject();
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/ResultDeserializer.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/ResultDeserializer.java
new file mode 100644
index 0000000..a5e261f
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/ResultDeserializer.java
@@ -0,0 +1,39 @@
+/*
+ * 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.codec.protobuf.jackson;
+
+import java.util.Map;
+
+import org.apache.servicecomb.codec.protobuf.codec.AbstractFieldCodec.ReaderHelpData;
+
+public class ResultDeserializer extends AbstractDeserializer {
+
+ public ResultDeserializer(Map<String, ReaderHelpData> readerHelpDataMap) {
+ super(readerHelpDataMap);
+ }
+
+ @Override
+ protected Object createResult() {
+ return null;
+ }
+
+ @Override
+ protected Object updateResult(Object result, Object value, ReaderHelpData helpData) {
+ return value;
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/ResultSerializer.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/ResultSerializer.java
new file mode 100644
index 0000000..8bdf231
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/ResultSerializer.java
@@ -0,0 +1,41 @@
+/*
+ * 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.codec.protobuf.jackson;
+
+import java.io.IOException;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.dataformat.protobuf.ProtobufGenerator;
+import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufField;
+
+public class ResultSerializer extends JsonSerializer<Object> {
+ @Override
+ public void serialize(Object value, JsonGenerator gen,
+ SerializerProvider serializers) throws IOException, JsonProcessingException {
+ gen.writeStartObject();
+
+ ProtobufGenerator protobufGenerator = (ProtobufGenerator) gen;
+ ProtobufField field = protobufGenerator.getSchema().getRootType().firstField();
+ gen.writeObjectField(field.name, value);
+
+ gen.writeEndObject();
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/StandardObjectReader.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/StandardObjectReader.java
new file mode 100644
index 0000000..bc11834
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/StandardObjectReader.java
@@ -0,0 +1,39 @@
+/*
+ * 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.codec.protobuf.jackson;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectReader;
+
+public class StandardObjectReader extends ObjectReader {
+ private static final long serialVersionUID = -8162644250351645123L;
+
+ public StandardObjectReader(ObjectReader base) {
+ super(base, base.getConfig());
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T readValue(InputStream src) throws IOException, JsonProcessingException {
+ T result = super.readValue(src);
+ return (T) new Object[] {result};
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/StandardObjectWriter.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/StandardObjectWriter.java
new file mode 100644
index 0000000..59d5d6e
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/jackson/StandardObjectWriter.java
@@ -0,0 +1,40 @@
+/*
+ * 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.codec.protobuf.jackson;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectWriter;
+
+public class StandardObjectWriter extends ObjectWriter {
+ private static final long serialVersionUID = -8162644250351645123L;
+
+ public StandardObjectWriter(ObjectWriter base) {
+ super(base, base.getConfig());
+ }
+
+ @Override
+ public void writeValue(OutputStream out,
+ Object value) throws IOException, JsonGenerationException, JsonMappingException {
+ Object[] values = (Object[]) value;
+ super.writeValue(out, values[0]);
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/ProtobufSchemaUtils.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/ProtobufSchemaUtils.java
new file mode 100644
index 0000000..9006354
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/ProtobufSchemaUtils.java
@@ -0,0 +1,160 @@
+/*
+ * 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.codec.protobuf.utils;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Parameter;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.servicecomb.codec.protobuf.utils.schema.WrapSchemaFactory;
+import org.apache.servicecomb.common.javassist.JavassistUtils;
+import org.apache.servicecomb.core.definition.OperationMeta;
+import org.springframework.util.ClassUtils;
+
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+
+import io.protostuff.Schema;
+import io.protostuff.runtime.ProtobufCompatibleUtils;
+import io.protostuff.runtime.RuntimeSchema;
+
+public final class ProtobufSchemaUtils {
+ private static volatile Map<String, WrapSchema> schemaCache = new ConcurrentHashMap<>();
+
+ static {
+ ProtobufCompatibleUtils.init();
+ }
+
+ private interface SchemaCreator {
+ WrapSchema create() throws Exception;
+ }
+
+ private ProtobufSchemaUtils() {
+ }
+
+ private static WrapSchema getOrCreateSchema(String className, SchemaCreator creator) {
+ WrapSchema schema = schemaCache.get(className);
+ if (schema != null) {
+ return schema;
+ }
+
+ synchronized (ProtobufSchemaUtils.class) {
+ schema = schemaCache.get(className);
+ if (schema != null) {
+ return schema;
+ }
+
+ try {
+ schema = creator.create();
+ } catch (Exception e) {
+ throw new Error(e);
+ }
+ schemaCache.put(className, schema);
+ return schema;
+ }
+ }
+
+ private static boolean isArgsNeedWrap(Method method) {
+ if (method.getParameterCount() != 1) {
+ return true;
+ }
+
+ // 单参数时,需要根据实际情况判断
+ return isNeedWrap(method.getParameterTypes()[0]);
+ }
+
+ private static boolean isNeedWrap(Class<?> cls) {
+ // protobuf不支持原子类型、enum、string、数组、collection等等作为msg,只有Object类型才可以
+ return ClassUtils.isPrimitiveOrWrapper(cls) || cls.isArray() || cls.isEnum()
+ || String.class.isAssignableFrom(cls)
+ || Collection.class.isAssignableFrom(cls)
+ || Map.class.isAssignableFrom(cls)
+ || Date.class.isAssignableFrom(cls);
+ }
+
+ // 为了支持method args的场景,全部实现ProtobufMessageWrapper接口,有的场景有点浪费,不过无关紧要
+ private static WrapSchema createWrapSchema(WrapClassConfig config) throws Exception {
+ Class<?> cls = JavassistUtils.createClass(config);
+ Schema<?> schema = RuntimeSchema.createFrom(cls);
+ return WrapSchemaFactory.createSchema(schema, config.getType());
+ }
+
+ // 适用于将单个类型包装的场景
+ // 比如return
+ public static WrapSchema getOrCreateSchema(Type type) {
+ JavaType javaType = TypeFactory.defaultInstance().constructType(type);
+ // List<String> -> java.util.List<java.lang.String>
+ // List<List<String>> -> java.util.List<java.util.List<java.lang.String>>
+ String key = javaType.toCanonical();
+ return getOrCreateSchema(key, () -> {
+ if (!isNeedWrap(javaType.getRawClass())) {
+ // 可以直接使用
+ Schema<?> schema = RuntimeSchema.createFrom(javaType.getRawClass());
+ return WrapSchemaFactory.createSchema(schema, WrapType.NOT_WRAP);
+ }
+
+ // 需要包装
+ WrapClassConfig config = new WrapClassConfig();
+ config.setType(WrapType.NORMAL_WRAP);
+
+ config.setClassName("gen.wrap.protobuf." + key.replaceAll("[<>]", "_").replace("[", "array_"));
+ if (!Void.TYPE.isAssignableFrom(javaType.getRawClass())) {
+ config.addField("field0", javaType);
+ }
+
+ JavassistUtils.genSingleWrapperInterface(config);
+
+ return createWrapSchema(config);
+ });
+ }
+
+ public static WrapSchema getOrCreateArgsSchema(OperationMeta operationMeta) {
+ Method method = operationMeta.getMethod();
+ String type = "gen." + method.getDeclaringClass().getName() + "." + method.getName() + ".Args";
+
+ return getOrCreateSchema(type, () -> {
+ if (!isArgsNeedWrap(method)) {
+ // 可以直接使用
+ Class<?> cls = (Class<?>) method.getParameterTypes()[0];
+ Schema<?> schema = RuntimeSchema.createFrom(cls);
+ return WrapSchemaFactory.createSchema(schema, WrapType.ARGS_NOT_WRAP);
+ }
+
+ // 需要包装
+ WrapClassConfig config = new WrapClassConfig();
+ config.setType(WrapType.ARGS_WRAP);
+ config.setClassName(type);
+
+ Parameter[] params = method.getParameters();
+ for (int idx = 0; idx < params.length; idx++) {
+ Parameter param = params[idx];
+ String paramName = org.apache.servicecomb.swagger.generator.core.utils.ClassUtils
+ .correctMethodParameterName(operationMeta.getParamName(idx));
+ config.addField(paramName, param.getParameterizedType());
+ }
+
+ JavassistUtils.genMultiWrapperInterface(config);
+
+ return createWrapSchema(config);
+ });
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/WrapClassConfig.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/WrapClassConfig.java
new file mode 100644
index 0000000..3c1b536
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/WrapClassConfig.java
@@ -0,0 +1,32 @@
+/*
+ * 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.codec.protobuf.utils;
+
+import org.apache.servicecomb.common.javassist.ClassConfig;
+
+public class WrapClassConfig extends ClassConfig {
+ private WrapType type;
+
+ public WrapType getType() {
+ return type;
+ }
+
+ public void setType(WrapType type) {
+ this.type = type;
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/WrapSchema.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/WrapSchema.java
new file mode 100644
index 0000000..c24b5c2
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/WrapSchema.java
@@ -0,0 +1,63 @@
+/*
+ * 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.codec.protobuf.utils;
+
+import java.nio.ByteBuffer;
+
+import io.protostuff.ByteBufferInput;
+import io.protostuff.Input;
+import io.protostuff.Output;
+import io.protostuff.runtime.ProtobufFeature;
+import io.protostuff.runtime.ProtobufFeatureUtils;
+import io.vertx.core.buffer.Buffer;
+
+public interface WrapSchema {
+ @SuppressWarnings("unchecked")
+ default <T> T readObject(Buffer buffer, ProtobufFeature protobufFeature) throws Exception {
+ if (buffer == null || buffer.length() == 0) {
+ // void以及函数入参为null的场景
+ // 空串时,protobuf至少为编码为1字节
+ return (T) readFromEmpty();
+ }
+
+ ByteBuffer nioBuffer = buffer.getByteBuf().nioBuffer();
+ Input input = new ByteBufferInput(nioBuffer, false);
+
+ ProtobufFeatureUtils.setProtobufFeature(protobufFeature);
+ try {
+ return (T) readObject(input);
+ } finally {
+ ProtobufFeatureUtils.removeProtobufFeature();
+ }
+ }
+
+ default void writeObject(Output output, Object value, ProtobufFeature protobufFeature) throws Exception {
+ ProtobufFeatureUtils.setProtobufFeature(protobufFeature);
+ try {
+ writeObject(output, value);
+ } finally {
+ ProtobufFeatureUtils.removeProtobufFeature();
+ }
+ }
+
+ Object readFromEmpty();
+
+ Object readObject(Input input) throws Exception;
+
+ void writeObject(Output output, Object value) throws Exception;
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/WrapType.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/WrapType.java
new file mode 100644
index 0000000..7d049ed
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/WrapType.java
@@ -0,0 +1,25 @@
+/*
+ * 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.codec.protobuf.utils;
+
+public enum WrapType {
+ NOT_WRAP,
+ NORMAL_WRAP,
+ ARGS_NOT_WRAP,
+ ARGS_WRAP
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/AbstractWrapSchema.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/AbstractWrapSchema.java
new file mode 100644
index 0000000..b8f5ed3
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/AbstractWrapSchema.java
@@ -0,0 +1,26 @@
+/*
+ * 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.codec.protobuf.utils.schema;
+
+import org.apache.servicecomb.codec.protobuf.utils.WrapSchema;
+
+import io.protostuff.Schema;
+
+public abstract class AbstractWrapSchema implements WrapSchema {
+ protected Schema<Object> schema;
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/ArgsNotWrapSchema.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/ArgsNotWrapSchema.java
new file mode 100644
index 0000000..5d76039
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/ArgsNotWrapSchema.java
@@ -0,0 +1,53 @@
+/*
+ * 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.codec.protobuf.utils.schema;
+
+import java.io.IOException;
+
+import io.protostuff.Input;
+import io.protostuff.Output;
+import io.protostuff.Schema;
+
+public class ArgsNotWrapSchema extends AbstractWrapSchema {
+
+ @SuppressWarnings("unchecked")
+ public ArgsNotWrapSchema(Schema<?> schema) {
+ this.schema = (Schema<Object>) schema;
+ }
+
+ @Override
+ public Object readFromEmpty() {
+ return new Object[] {null};
+ }
+
+ public Object readObject(Input input) throws IOException {
+ Object readValue = schema.newMessage();
+ schema.mergeFrom(input, readValue);
+
+ return new Object[] {readValue};
+ }
+
+ public void writeObject(Output output, Object value) throws IOException {
+ Object writeValue = ((Object[]) value)[0];
+ if (writeValue == null) {
+ return;
+ }
+
+ schema.writeTo(output, writeValue);
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/ArgsWrapSchema.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/ArgsWrapSchema.java
new file mode 100644
index 0000000..16360a3
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/ArgsWrapSchema.java
@@ -0,0 +1,54 @@
+/*
+ * 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.codec.protobuf.utils.schema;
+
+import java.io.IOException;
+
+import org.apache.servicecomb.common.javassist.MultiWrapper;
+
+import io.protostuff.Input;
+import io.protostuff.Output;
+import io.protostuff.Schema;
+
+public class ArgsWrapSchema extends AbstractWrapSchema {
+
+ @SuppressWarnings("unchecked")
+ public ArgsWrapSchema(Schema<?> schema) {
+ this.schema = (Schema<Object>) schema;
+ }
+
+ @Override
+ public Object readFromEmpty() {
+ MultiWrapper wrapper = (MultiWrapper) schema.newMessage();
+ return wrapper.readFields();
+ }
+
+ public Object readObject(Input input) throws IOException {
+ MultiWrapper wrapper = (MultiWrapper) schema.newMessage();
+ schema.mergeFrom(input, wrapper);
+
+ return wrapper.readFields();
+ }
+
+ public void writeObject(Output output, Object value) throws IOException {
+ MultiWrapper wrapper = (MultiWrapper) schema.newMessage();
+ wrapper.writeFields((Object[]) value);
+
+ schema.writeTo(output, wrapper);
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/NormalWrapSchema.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/NormalWrapSchema.java
new file mode 100644
index 0000000..f69f8e9
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/NormalWrapSchema.java
@@ -0,0 +1,58 @@
+/*
+ * 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.codec.protobuf.utils.schema;
+
+import java.io.IOException;
+
+import org.apache.servicecomb.common.javassist.SingleWrapper;
+
+import io.protostuff.Input;
+import io.protostuff.Output;
+import io.protostuff.Schema;
+
+public class NormalWrapSchema extends AbstractWrapSchema {
+
+ @SuppressWarnings("unchecked")
+ public NormalWrapSchema(Schema<?> schema) {
+ this.schema = (Schema<Object>) schema;
+ }
+
+ @Override
+ public Object readFromEmpty() {
+ SingleWrapper wrapper = (SingleWrapper) schema.newMessage();
+ return wrapper.readField();
+ }
+
+ public Object readObject(Input input) throws IOException {
+ SingleWrapper wrapper = (SingleWrapper) schema.newMessage();
+ schema.mergeFrom(input, wrapper);
+
+ return wrapper.readField();
+ }
+
+ public void writeObject(Output output, Object value) throws IOException {
+ if (value == null) {
+ return;
+ }
+
+ SingleWrapper wrapper = (SingleWrapper) schema.newMessage();
+ wrapper.writeField(value);
+
+ schema.writeTo(output, wrapper);
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/NotWrapSchema.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/NotWrapSchema.java
new file mode 100644
index 0000000..697fe98
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/NotWrapSchema.java
@@ -0,0 +1,52 @@
+/*
+ * 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.codec.protobuf.utils.schema;
+
+import java.io.IOException;
+
+import io.protostuff.Input;
+import io.protostuff.Output;
+import io.protostuff.Schema;
+
+public class NotWrapSchema extends AbstractWrapSchema {
+
+ @SuppressWarnings("unchecked")
+ public NotWrapSchema(Schema<?> schema) {
+ this.schema = (Schema<Object>) schema;
+ }
+
+ @Override
+ public Object readFromEmpty() {
+ return null;
+ }
+
+ public Object readObject(Input input) throws IOException {
+ Object value = schema.newMessage();
+ schema.mergeFrom(input, value);
+
+ return value;
+ }
+
+ public void writeObject(Output output, Object value) throws IOException {
+ if (value == null) {
+ return;
+ }
+
+ schema.writeTo(output, value);
+ }
+}
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/WrapSchemaFactory.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/WrapSchemaFactory.java
new file mode 100644
index 0000000..30923aa
--- /dev/null
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/schema/WrapSchemaFactory.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.codec.protobuf.utils.schema;
+
+import org.apache.servicecomb.codec.protobuf.utils.WrapSchema;
+import org.apache.servicecomb.codec.protobuf.utils.WrapType;
+
+import io.protostuff.Schema;
+
+public final class WrapSchemaFactory {
+ public static WrapSchema createSchema(Schema<?> schema, WrapType type) {
+ switch (type) {
+ case NOT_WRAP:
+ return new NotWrapSchema(schema);
+ case NORMAL_WRAP:
+ return new NormalWrapSchema(schema);
+ case ARGS_NOT_WRAP:
+ return new ArgsNotWrapSchema(schema);
+ case ARGS_WRAP:
+ return new ArgsWrapSchema(schema);
+ default:
+ throw new Error("impossible");
+ }
+ }
+
+ private WrapSchemaFactory() {
+ }
+}
diff --git a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestAbstractCodec.java b/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestAbstractCodec.java
deleted file mode 100644
index eae94d9..0000000
--- a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestAbstractCodec.java
+++ /dev/null
@@ -1,57 +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.servicecomb.codec.protobuf.codec;
-
-import java.lang.reflect.Type;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
-
-public class TestAbstractCodec extends AbstractCodec {
-
- private AbstractCodec abstractCodecTest = null;
-
- @Before
- public void setUp() throws Exception {
- abstractCodecTest = new TestAbstractCodec();
- }
-
- @After
- public void tearDown() throws Exception {
- abstractCodecTest = null;
- }
-
- @Test
- public void testGetWriter() {
- Assert.assertNull(abstractCodecTest.getWriter());
- }
-
- @Test
- public void testGetReader() {
- Assert.assertNull(abstractCodecTest.getReader());
- }
-
- @Override
- public void init(ProtobufSchema schema, Type... types) {
- /* Do not worry, overridden method*/
- }
-}
diff --git a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestAbstractFieldCodec.java b/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestAbstractFieldCodec.java
deleted file mode 100644
index 539e650..0000000
--- a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestAbstractFieldCodec.java
+++ /dev/null
@@ -1,111 +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.servicecomb.codec.protobuf.codec;
-
-import java.lang.reflect.Type;
-import java.util.Arrays;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.ObjectReader;
-import com.fasterxml.jackson.databind.ObjectWriter;
-import com.fasterxml.jackson.dataformat.protobuf.protoparser.protoparser.FieldElement;
-import com.fasterxml.jackson.dataformat.protobuf.schema.FieldType;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufField;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufMessage;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
-
-import io.servicecomb.codec.protobuf.definition.ProtobufManager;
-import io.servicecomb.codec.protobuf.jackson.CseObjectReader;
-import io.servicecomb.codec.protobuf.jackson.CseObjectWriter;
-import io.servicecomb.codec.protobuf.jackson.ParamDeserializer;
-import io.servicecomb.codec.protobuf.jackson.ParamSerializer;
-
-public class TestAbstractFieldCodec extends AbstractFieldCodec {
-
- private AbstractFieldCodec abstractFieldCodec = null;
-
- private ProtobufSchema schema = null;
-
- @Before
- public void setUp() throws Exception {
- abstractFieldCodec = new TestAbstractFieldCodec();
- schema = Mockito.mock(ProtobufSchema.class);
- }
-
- @After
- public void tearDown() throws Exception {
- abstractFieldCodec = null;
- schema = null;
- }
-
- @Override
- public ObjectWriter getWriter() {
- return writer;
- }
-
- @Override
- public ObjectReader getReader() {
- return reader;
- }
-
- @Test
- public void testInit() {
- ProtobufField[] protobufFieldArray = new ProtobufField[5];
- FieldElement rawType = null;
- FieldType type = FieldType.STRING;
- ProtobufField p = new ProtobufField(rawType, type);
- protobufFieldArray[0] = p;
- Type[] types = new Type[1];
- types[0] = Integer.TYPE;
-
- Mockito.when(schema.getRootType()).thenReturn(Mockito.mock(ProtobufMessage.class));
- Mockito.when(schema.getRootType().getFieldCount()).thenReturn(1);
- Mockito.when(schema.getRootType().fields()).thenReturn(Arrays.asList(protobufFieldArray));
- abstractFieldCodec.init(schema, types);
- Assert.assertNotNull(abstractFieldCodec.readerHelpDataMap.get("UNKNOWN"));
- }
-
- @Test
- public void testFindInfo() {
- Assert.assertNull(abstractFieldCodec.findInfo("name"));
- }
-
- @Override
- public void init(ProtobufSchema schema, Type... types) {
- writer = new CseObjectWriter(ProtobufManager.getWriter(), schema, new ParamSerializer());
- reader = new CseObjectReader(ProtobufManager.getReader(), schema, new ParamDeserializer(readerHelpDataMap));
- super.init(schema, types);
- }
-
- @Test
- public void testReaderHelpData() {
- ReaderHelpData ReaderHelpData = new ReaderHelpData();
- ReaderHelpData.setIndex(10);
- ReaderHelpData.getDeser();
- @SuppressWarnings("unchecked")
- JsonDeserializer<Object> j = Mockito.mock(JsonDeserializer.class);
- ReaderHelpData.setDeser(j);
- Assert.assertEquals(10, ReaderHelpData.getIndex());
- }
-}
diff --git a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestParamFieldCodec.java b/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestParamFieldCodec.java
deleted file mode 100644
index f2db8ba..0000000
--- a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestParamFieldCodec.java
+++ /dev/null
@@ -1,74 +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.servicecomb.codec.protobuf.codec;
-
-import java.lang.reflect.Type;
-import java.util.Arrays;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.fasterxml.jackson.dataformat.protobuf.protoparser.protoparser.FieldElement;
-import com.fasterxml.jackson.dataformat.protobuf.schema.FieldType;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufField;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufMessage;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
-
-public class TestParamFieldCodec {
-
- private ParamFieldCodec paramFieldCodec = null;
-
- private ProtobufSchema schema = null;
-
- @Before
- public void setUp() throws Exception {
- paramFieldCodec = new ParamFieldCodec();
- schema = Mockito.mock(ProtobufSchema.class);
- }
-
- @After
- public void tearDown() throws Exception {
- paramFieldCodec = null;
- schema = null;
- }
-
- @Test
- public void testInit() {
- Assert.assertNotNull(paramFieldCodec);
-
- ProtobufField[] protobufFieldArray = new ProtobufField[5];
- FieldElement rawType = null;
- FieldType type = FieldType.STRING;
- ProtobufField p = new ProtobufField(rawType, type);
- protobufFieldArray[0] = p;
- Type[] types = new Type[10];
- types[0] = Integer.TYPE;
-
- Mockito.when(schema.getRootType()).thenReturn(Mockito.mock(ProtobufMessage.class));
- Mockito.when(schema.getRootType().getFieldCount()).thenReturn(1);
- Mockito.when(schema.getRootType().fields()).thenReturn(Arrays.asList(protobufFieldArray));
- Assert.assertNull(paramFieldCodec.reader);
- Assert.assertNull(paramFieldCodec.writer);
- paramFieldCodec.init(schema, types);
- Assert.assertNotNull(paramFieldCodec.reader);
- Assert.assertNotNull(paramFieldCodec.writer);
- }
-}
diff --git a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestResultFieldCodec.java b/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestResultFieldCodec.java
deleted file mode 100644
index 539cca2..0000000
--- a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestResultFieldCodec.java
+++ /dev/null
@@ -1,73 +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.servicecomb.codec.protobuf.codec;
-
-import java.lang.reflect.Type;
-import java.util.Arrays;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.fasterxml.jackson.dataformat.protobuf.protoparser.protoparser.FieldElement;
-import com.fasterxml.jackson.dataformat.protobuf.schema.FieldType;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufField;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufMessage;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
-
-public class TestResultFieldCodec {
- private ResultFieldCodec resultFieldCodec = null;
-
- private ProtobufSchema schema = null;
-
- @Before
- public void setUp() throws Exception {
- resultFieldCodec = new ResultFieldCodec();
- schema = Mockito.mock(ProtobufSchema.class);
- }
-
- @After
- public void tearDown() throws Exception {
- resultFieldCodec = null;
- schema = null;
- }
-
- @Test
- public void testInit() {
- Assert.assertNotNull(resultFieldCodec);
-
- ProtobufField[] protobufFieldArray = new ProtobufField[5];
- FieldElement rawType = null;
- FieldType type = FieldType.STRING;
- ProtobufField p = new ProtobufField(rawType, type);
- protobufFieldArray[0] = p;
- Type[] types = new Type[10];
- types[0] = Integer.TYPE;
-
- Mockito.when(schema.getRootType()).thenReturn(Mockito.mock(ProtobufMessage.class));
- Mockito.when(schema.getRootType().getFieldCount()).thenReturn(1);
- Mockito.when(schema.getRootType().fields()).thenReturn(Arrays.asList(protobufFieldArray));
- Assert.assertNull(resultFieldCodec.reader);
- Assert.assertNull(resultFieldCodec.writer);
- resultFieldCodec.init(schema, types);
- Assert.assertNotNull(resultFieldCodec.reader);
- Assert.assertNotNull(resultFieldCodec.writer);
- }
-}
diff --git a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestStandardParamCodec.java b/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestStandardParamCodec.java
deleted file mode 100644
index 10e0879..0000000
--- a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestStandardParamCodec.java
+++ /dev/null
@@ -1,75 +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.servicecomb.codec.protobuf.codec;
-
-import java.lang.reflect.Type;
-import java.util.Arrays;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.fasterxml.jackson.dataformat.protobuf.protoparser.protoparser.FieldElement;
-import com.fasterxml.jackson.dataformat.protobuf.schema.FieldType;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufField;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufMessage;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
-
-public class TestStandardParamCodec {
- public final static String FORMAT_NAME_PROTOBUF = "protobuf";
-
- private StandardParamCodec standardParamCodec = null;
-
- private ProtobufSchema schema = null;
-
- @Before
- public void setUp() throws Exception {
- standardParamCodec = new StandardParamCodec();
- schema = Mockito.mock(ProtobufSchema.class);
- }
-
- @After
- public void tearDown() throws Exception {
- standardParamCodec = null;
- schema = null;
- }
-
- @Test
- public void testInit() {
- Assert.assertNotNull(standardParamCodec);
- ProtobufField[] protobufFieldArray = new ProtobufField[5];
- FieldElement rawType = null;
- FieldType type = FieldType.STRING;
- ProtobufField p = new ProtobufField(rawType, type);
- protobufFieldArray[0] = p;
- Type[] types = new Type[1];
- types[0] = Integer.TYPE;
-
- Mockito.when(schema.getSchemaType()).thenReturn(FORMAT_NAME_PROTOBUF);
- Mockito.when(schema.getRootType()).thenReturn(Mockito.mock(ProtobufMessage.class));
- Mockito.when(schema.getRootType().getFieldCount()).thenReturn(1);
- Mockito.when(schema.getRootType().fields()).thenReturn(Arrays.asList(protobufFieldArray));
- Assert.assertNull(standardParamCodec.writer);
- Assert.assertNull(standardParamCodec.reader);
- standardParamCodec.init(schema, types);
- Assert.assertNotNull(standardParamCodec.writer);
- Assert.assertNotNull(standardParamCodec.reader);
- }
-}
diff --git a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestStandardResultCodec.java b/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestStandardResultCodec.java
deleted file mode 100644
index d5c7a64..0000000
--- a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/codec/TestStandardResultCodec.java
+++ /dev/null
@@ -1,77 +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.servicecomb.codec.protobuf.codec;
-
-import java.lang.reflect.Type;
-import java.util.Arrays;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.fasterxml.jackson.dataformat.protobuf.protoparser.protoparser.FieldElement;
-import com.fasterxml.jackson.dataformat.protobuf.schema.FieldType;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufField;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufMessage;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
-
-public class TestStandardResultCodec {
-
- private StandardResultCodec standardResultCodec = null;
-
- private ProtobufSchema schema = null;
-
- public final static String FORMAT_NAME_PROTOBUF = "protobuf";
-
- @Before
- public void setUp() throws Exception {
- standardResultCodec = new StandardResultCodec();
- schema = Mockito.mock(ProtobufSchema.class);
- }
-
- @After
- public void tearDown() throws Exception {
- standardResultCodec = null;
- schema = null;
- }
-
- @Test
- public void testInit() {
- Assert.assertNotNull(standardResultCodec);
-
- ProtobufField[] protobufFieldArray = new ProtobufField[5];
- FieldElement rawType = null;
- FieldType type = FieldType.STRING;
- ProtobufField p = new ProtobufField(rawType, type);
- protobufFieldArray[0] = p;
- Type[] types = new Type[1];
- types[0] = Integer.TYPE;
-
- Mockito.when(schema.getSchemaType()).thenReturn(FORMAT_NAME_PROTOBUF);
- Mockito.when(schema.getRootType()).thenReturn(Mockito.mock(ProtobufMessage.class));
- Mockito.when(schema.getRootType().getFieldCount()).thenReturn(1);
- Mockito.when(schema.getRootType().fields()).thenReturn(Arrays.asList(protobufFieldArray));
- Assert.assertNull(standardResultCodec.reader);
- Assert.assertNull(standardResultCodec.writer);
- standardResultCodec.init(schema, types);
- Assert.assertNotNull(standardResultCodec.reader);
- Assert.assertNotNull(standardResultCodec.writer);
- }
-}
diff --git a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/definition/TestOperationProtobuf.java b/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/definition/TestOperationProtobuf.java
deleted file mode 100644
index 330126a..0000000
--- a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/definition/TestOperationProtobuf.java
+++ /dev/null
@@ -1,57 +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.servicecomb.codec.protobuf.definition;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import io.servicecomb.codec.protobuf.utils.WrapSchema;
-import io.servicecomb.codec.protobuf.utils.schema.ArgsNotWrapSchema;
-import io.servicecomb.codec.protobuf.utils.schema.NormalWrapSchema;
-import io.servicecomb.core.definition.OperationMeta;
-import io.servicecomb.core.definition.SchemaMeta;
-import io.servicecomb.core.unittest.UnitTestMeta;
-import io.swagger.annotations.ApiResponse;
-
-public class TestOperationProtobuf {
- class Impl {
- @ApiResponse(code = 300, response = String.class, message = "")
- public int test(int x) {
- return 100;
- }
- }
-
- @Test
- public void testOperationProtobuf() throws Exception {
- UnitTestMeta meta = new UnitTestMeta();
- SchemaMeta schemaMeta = meta.getOrCreateSchemaMeta(Impl.class);
- OperationMeta operationMeta = schemaMeta.findOperation("test");
-
- OperationProtobuf operationProtobuf = ProtobufManager.getOrCreateOperation(operationMeta);
- Assert.assertEquals(operationMeta, operationProtobuf.getOperationMeta());
- Assert.assertEquals(ArgsNotWrapSchema.class, operationProtobuf.getRequestSchema().getClass());
- Assert.assertEquals(NormalWrapSchema.class, operationProtobuf.getResponseSchema().getClass());
-
- WrapSchema responseSchema = operationProtobuf.findResponseSchema(200);
- Assert.assertEquals(operationProtobuf.getResponseSchema(), responseSchema);
-
- responseSchema = operationProtobuf.findResponseSchema(300);
- Assert.assertNotNull(responseSchema);
- Assert.assertNotEquals(operationProtobuf.getResponseSchema(), responseSchema);
- }
-}
diff --git a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/jackson/TestAbstractDeserializer.java b/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/jackson/TestAbstractDeserializer.java
deleted file mode 100644
index 582fdd6..0000000
--- a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/jackson/TestAbstractDeserializer.java
+++ /dev/null
@@ -1,105 +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.servicecomb.codec.protobuf.jackson;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-
-import io.servicecomb.codec.protobuf.codec.AbstractFieldCodec.ReaderHelpData;
-
-public class TestAbstractDeserializer extends AbstractDeserializer {
-
- private AbstractDeserializer abstractDeserializer = null;
-
- private JsonParser jsonParser = Mockito.mock(JsonParser.class);
-
- static ReaderHelpData readerHelpData = Mockito.mock(ReaderHelpData.class);
-
- static Map<String, ReaderHelpData> readerHelpDataMap = new HashMap<>();
-
- public static void setReaderHelpDataMap(Map<String, ReaderHelpData> readerHelpDataMap) {
- TestAbstractDeserializer.readerHelpDataMap = readerHelpDataMap;
- readerHelpDataMap.put("abc", readerHelpData);
- readerHelpDataMap.put("null", readerHelpData);
- }
-
- static {
- TestAbstractDeserializer.setReaderHelpDataMap(readerHelpDataMap);
- }
-
- public TestAbstractDeserializer() {
- super(readerHelpDataMap);
- }
-
- @Before
- public void setUp() throws Exception {
- abstractDeserializer = new TestAbstractDeserializer();
- }
-
- @After
- public void tearDown() throws Exception {
- abstractDeserializer = null;
- jsonParser = null;
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testDeserialize() {
- boolean status = false;
- try {
- DeserializationContext ctxt = Mockito.mock(DeserializationContext.class);
- @SuppressWarnings("rawtypes")
- JsonDeserializer JsonDeserializer = Mockito.mock(JsonDeserializer.class);
- Object object = null;
- Mockito.when(jsonParser.nextFieldName()).thenReturn("abc", (String) null);
- Mockito.when(readerHelpData.getDeser()).thenReturn(JsonDeserializer);
- Mockito.when(JsonDeserializer.deserialize(jsonParser, ctxt)).thenReturn(object);
- Object deserializeObject = abstractDeserializer.deserialize(jsonParser, ctxt);
- Assert.assertNotNull(deserializeObject);
- } catch (Exception e) {
- status = true;
- }
- Assert.assertFalse(status);
- }
-
- @Override
- protected Object createResult() {
- return null;
- }
-
- @Override
- protected Object updateResult(Object result, Object value, ReaderHelpData helpData) {
- /* Do not worry, overridden method*/
- try {
- Mockito.when(jsonParser.nextToken()).thenReturn(JsonToken.VALUE_NULL);
- } catch (Exception e) {
- }
- return new Object();
- }
-}
diff --git a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/jackson/TestParamDeserializer.java b/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/jackson/TestParamDeserializer.java
deleted file mode 100644
index fa9c365..0000000
--- a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/jackson/TestParamDeserializer.java
+++ /dev/null
@@ -1,62 +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.servicecomb.codec.protobuf.jackson;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import io.servicecomb.codec.protobuf.codec.AbstractFieldCodec.ReaderHelpData;
-
-public class TestParamDeserializer {
-
- private ParamDeserializer paramDeserializer = null;
-
- private Map<String, ReaderHelpData> readerHelpDataMap = new HashMap<>();
-
- @Before
- public void setUp() throws Exception {
- paramDeserializer = new ParamDeserializer(readerHelpDataMap);
- }
-
- @After
- public void tearDown() throws Exception {
- paramDeserializer = null;
- }
-
- @Test
- public void testCreateResult() {
- Object object = paramDeserializer.createResult();
- Assert.assertNotNull(object);
- // object is created but no values inside to assert
- }
-
- @Test
- public void testUpdateResult() {
- String[] stringArray = new String[1];
- stringArray[0] = "abc";
- Object[] object = new Object[1];
- Object paramObject = paramDeserializer.updateResult(object, stringArray, new ReaderHelpData());
- Assert.assertNotNull(paramObject);
- Assert.assertEquals(paramObject, object);
- }
-}
diff --git a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/jackson/TestParamSerializer.java b/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/jackson/TestParamSerializer.java
deleted file mode 100644
index 272a0b7..0000000
--- a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/jackson/TestParamSerializer.java
+++ /dev/null
@@ -1,130 +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.servicecomb.codec.protobuf.jackson;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.ObjectCodec;
-import com.fasterxml.jackson.core.io.IOContext;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.dataformat.protobuf.ProtobufGenerator;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufField;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufMessage;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
-
-import mockit.Mock;
-import mockit.MockUp;
-
-public class TestParamSerializer {
-
- private ParamSerializer paramSerializer = null;
-
- @Before
- public void setUp() throws Exception {
- paramSerializer = new ParamSerializer();
- }
-
- @After
- public void tearDown() throws Exception {
- paramSerializer = null;
- }
-
- @Test
- public void testSerialize() {
- boolean status = true;
- Assert.assertNotNull(paramSerializer);
- String[] stringArray = new String[1];
- stringArray[0] = "abc";
-
- ProtobufGenerator obj = null;
- try {
- obj = new ProtobufGenerator(Mockito.mock(IOContext.class), 2, Mockito.mock(ObjectCodec.class),
- Mockito.mock(OutputStream.class));
- } catch (IOException exce) {
- }
-
- Assert.assertNotNull(obj);
- new MockUp<ProtobufGenerator>() {
-
- @Mock
- public void writeStartObject() throws IOException {
-
- }
-
- ProtobufSchema protobufSchema = new ProtobufSchema(null, null);
-
- @Mock
- public ProtobufSchema getSchema() {
- return protobufSchema;
- }
- };
-
- ProtobufMessage protobufMessage = new ProtobufMessage(null, null);
- new MockUp<ProtobufSchema>() {
- @Mock
- public ProtobufMessage getRootType() {
- return protobufMessage;
- }
- };
-
- List<ProtobufField> listProtobufField = new ArrayList<>();
- listProtobufField.add(Mockito.mock(ProtobufField.class));
-
- new MockUp<ProtobufMessage>() {
- @Mock
- public Iterable<ProtobufField> fields() {
- return listProtobufField;
- }
- };
-
- new MockUp<JsonGenerator>() {
- @Mock
- public void writeObjectField(String fieldName, Object pojo) throws IOException {
-
- }
- };
-
- new MockUp<ProtobufGenerator>() {
-
- @Mock
- public void writeEndObject() throws IOException {
-
- }
- };
-
- try {
- paramSerializer.serialize(stringArray,
- obj,
- Mockito.mock(SerializerProvider.class));
- } catch (IOException e) {
- status = false;
- }
-
- Assert.assertTrue(status);
- }
-}
diff --git a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/jackson/TestResultSerializer.java b/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/jackson/TestResultSerializer.java
deleted file mode 100644
index e2e8d72..0000000
--- a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/jackson/TestResultSerializer.java
+++ /dev/null
@@ -1,130 +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.servicecomb.codec.protobuf.jackson;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.ObjectCodec;
-import com.fasterxml.jackson.core.io.IOContext;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.dataformat.protobuf.ProtobufGenerator;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufField;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufMessage;
-import com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchema;
-
-import io.servicecomb.foundation.vertx.stream.BufferOutputStream;
-import mockit.Mock;
-import mockit.MockUp;
-
-public class TestResultSerializer {
-
- private ResultSerializer resultSerializer = null;
-
- OutputStream outputStream = null;
-
- @Before
- public void setUp() throws Exception {
- resultSerializer = new ResultSerializer();
- outputStream = new BufferOutputStream();
- }
-
- @After
- public void tearDown() throws Exception {
- resultSerializer = null;
- outputStream = null;
- }
-
- @Test
- public void testSerialize() {
- boolean status = true;
- Assert.assertNotNull(resultSerializer);
- String[] stringArray = new String[1];
- stringArray[0] = "abc";
-
- ProtobufGenerator obj = null;
- try {
- obj = new ProtobufGenerator(Mockito.mock(IOContext.class), 2, Mockito.mock(ObjectCodec.class),
- outputStream);
- } catch (IOException exce) {
- }
-
- Assert.assertNotNull(obj);
-
- new MockUp<ProtobufGenerator>() {
-
- @Mock
- public void writeStartObject() throws IOException {
-
- }
-
- ProtobufSchema protobufSchema = new ProtobufSchema(null, null);
-
- @Mock
- public ProtobufSchema getSchema() {
- return protobufSchema;
- }
- };
- ProtobufMessage protobufMessage = new ProtobufMessage(null, null);
- new MockUp<ProtobufSchema>() {
- @Mock
- public ProtobufMessage getRootType() {
- return protobufMessage;
- }
- };
-
- new MockUp<ProtobufMessage>() {
- @Mock
- public ProtobufField firstField() {
- return Mockito.mock(ProtobufField.class);
- }
- };
-
- new MockUp<JsonGenerator>() {
- @Mock
- public void writeObjectField(String fieldName, Object pojo) throws IOException {
-
- }
- };
-
- new MockUp<ProtobufGenerator>() {
-
- @Mock
- public void writeEndObject() throws IOException {
-
- }
- };
-
- try {
- resultSerializer.serialize(stringArray,
- obj,
- Mockito.mock(SerializerProvider.class));
- } catch (IOException e) {
- status = false;
- }
-
- Assert.assertTrue(status);
- }
-}
diff --git a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/jackson/TestStandardObjectWriter.java b/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/jackson/TestStandardObjectWriter.java
deleted file mode 100644
index 9b04d6b..0000000
--- a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/jackson/TestStandardObjectWriter.java
+++ /dev/null
@@ -1,77 +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.servicecomb.codec.protobuf.jackson;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectWriter;
-
-import io.servicecomb.foundation.vertx.stream.BufferOutputStream;
-import mockit.Mock;
-import mockit.MockUp;
-
-public class TestStandardObjectWriter {
-
- private StandardObjectWriter StandardObjectWriter = null;
-
- private OutputStream outputStream = null;
-
- @Before
- public void setUp() throws Exception {
- StandardObjectWriter = new StandardObjectWriter(Mockito.mock(ObjectWriter.class));
- outputStream = new BufferOutputStream();
- }
-
- @After
- public void tearDown() throws Exception {
- StandardObjectWriter = null;
- outputStream = null;
- }
-
- @Test
- public void testWriteValueOutputStreamObject() {
- boolean status = true;
- String[] stringArray = new String[1];
- stringArray[0] = "abc";
-
- new MockUp<ObjectWriter>() {
- @Mock
- public void writeValue(OutputStream out,
- Object value) throws IOException, JsonGenerationException, JsonMappingException {
-
- }
- };
- try {
- StandardObjectWriter.writeValue(outputStream,
- stringArray);
- } catch (IOException e) {
- status = false;
- }
-
- Assert.assertTrue(status);
- }
-}
diff --git a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/utils/TestProtobufSchemaUtils.java b/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/utils/TestProtobufSchemaUtils.java
deleted file mode 100644
index 1045195..0000000
--- a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/utils/TestProtobufSchemaUtils.java
+++ /dev/null
@@ -1,120 +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.servicecomb.codec.protobuf.utils;
-
-import java.lang.reflect.Array;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import io.protostuff.ByteArrayInput;
-import io.protostuff.Input;
-import io.protostuff.LinkedBuffer;
-import io.protostuff.ProtobufOutput;
-import io.servicecomb.common.javassist.FieldConfig;
-
-public class TestProtobufSchemaUtils {
- public static class TestMap {
- public Map<String, String> map = new HashMap<>();
-
- public TestMap() {
- map.put("asdf", "jjj");
- }
- }
-
- @Test
- public void testMap() throws Exception {
- TestMap tm = new TestMap();
- TestMap tmResult = writeThenRead(tm);
- Assert.assertEquals(tm.map, tmResult.map);
-
- Map<String, String> map = new HashMap<>();
- map.put("aaa", "bbb");
- testSchema(map);
- }
-
- @Test
- public void wrapPrimitive() throws Exception {
- Assert.assertNotNull(WrapType.ARGS_WRAP);
- Assert.assertNotNull(WrapType.NORMAL_WRAP);
- testSchema((int) 1);
- testSchema("test");
- testSchema(WrapType.ARGS_WRAP);
- Assert.assertTrue(true);
- }
-
- @Test
- public void wrapArray() throws Exception {
- Assert.assertNotNull(WrapType.ARGS_WRAP);
- Assert.assertNotNull(WrapType.NORMAL_WRAP);
- testArraySchema(new byte[] {0, 1, 2});
- testArraySchema(new int[] {0, 1, 2});
- testArraySchema(new String[] {"a", "b"});
- testArraySchema(new WrapType[] {WrapType.ARGS_WRAP, WrapType.NORMAL_WRAP});
- Assert.assertTrue(true);
- }
-
- @Test
- public void notWrap() throws Exception {
- FieldConfig expect = new FieldConfig();
- expect.setName("test");
-
- FieldConfig result = (FieldConfig) writeThenRead(expect);
- Assert.assertEquals(expect.getName(), result.getName());
- }
-
- private void testSchema(Object expect) throws Exception {
- Object result = writeThenRead(expect);
- Assert.assertEquals(expect, result);
- }
-
- private void testArraySchema(Object expect) throws Exception {
- Object result = writeThenRead(expect);
-
- int expectLen = Array.getLength(expect);
- Assert.assertEquals(expectLen, Array.getLength(result));
- for (int idx = 0; idx < expectLen; idx++) {
- Assert.assertEquals(Array.get(expect, idx), Array.get(result, idx));
- }
- }
-
- @SuppressWarnings("unchecked")
- private <T> T writeThenRead(T value) throws Exception {
- WrapSchema schema = ProtobufSchemaUtils.getOrCreateSchema(value.getClass());
-
- byte[] bytes = toByteArray(schema, value);
- Object result = toObject(schema, bytes);
- return (T) result;
- }
-
- private byte[] toByteArray(WrapSchema schema, Object value) throws Exception {
- LinkedBuffer linkedBuffer = LinkedBuffer.allocate();
- ProtobufOutput output = new ProtobufOutput(linkedBuffer);
-
- schema.writeObject(output, value);
- return output.toByteArray();
- }
-
- private Object toObject(WrapSchema schema, byte[] bytes) throws Exception {
- Input input = new ByteArrayInput(bytes, false);
-
- return schema.readObject(input);
- }
-}
diff --git a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/utils/schema/TestArgsNotWrapSchema.java b/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/utils/schema/TestArgsNotWrapSchema.java
deleted file mode 100644
index 5dda6e7..0000000
--- a/common/common-protobuf/src/test/java/io/servicecomb/codec/protobuf/utils/schema/TestArgsNotWrapSchema.java
+++ /dev/null
@@ -1,95 +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.servicecomb.codec.protobuf.utils.schema;
... 265543 lines suppressed ...
--
To stop receiving notification emails like this one, please contact
"commits@servicecomb.apache.org" <co...@servicecomb.apache.org>.