refactor dubbo module (#12276)
* refactor:extract MergeableCluster as a single module * fix:add license header * fix:add dubbo-plugin-cluster-mergeable to .artifacts * refactor:extract module from dubbo-cluster * refactor:extract dubbo-plugin-router-condition module * refactor:extract dubbo-plugin-router-tag module * refactor:move metric filter out from dubbo-cluster * refactor:add pom dependency * fix:ut and dependency * fix:ut * refactor:extract dubbo-plugin-loadbalance-adaptive * refactor:extract dubbo-remoting-zookeeper-api module * refactor:extract dubbo-configcenter-file module * refactor:extract dubbo-metadata-rest module * refactor:extract dubbo-monitor-common module * refactor: extrace dubbo-plugin-access-log module * refactor: extrace dubbo-plugin-tps module * refactor: extrace dubbo-plugin-token module * refactor: extract dubbo-plugin-generic-invoke module * refactor: extract dubbo-plugin-context module * refactor: extract dubbo-plugin-classloader-filter module * refactor: extract dubbo-plugin-proxy-bytebuddy module * refactor: extract dubbo-plugin-qos-trace module * refactor: extract FutureFilter from dubbo protocol module * refactor: add modules to pom * ut:fix ut dependency
This commit is contained in:
parent
48cc5b24de
commit
0d4e8304bc
19
.artifacts
19
.artifacts
|
|
@ -30,6 +30,7 @@ dubbo-config-api
|
|||
dubbo-config-spring
|
||||
dubbo-config-spring6
|
||||
dubbo-configcenter
|
||||
dubbo-configcenter-file
|
||||
dubbo-configcenter-apollo
|
||||
dubbo-configcenter-nacos
|
||||
dubbo-configcenter-zookeeper
|
||||
|
|
@ -50,6 +51,7 @@ dubbo-kubernetes
|
|||
dubbo-maven-plugin
|
||||
dubbo-metadata
|
||||
dubbo-metadata-api
|
||||
dubbo-metadata-rest
|
||||
dubbo-metadata-definition-protobuf
|
||||
dubbo-metadata-processor
|
||||
dubbo-metadata-report-nacos
|
||||
|
|
@ -64,6 +66,7 @@ dubbo-metrics-registry
|
|||
dubbo-metrics-config-center
|
||||
dubbo-monitor
|
||||
dubbo-monitor-api
|
||||
dubbo-monitor-common
|
||||
dubbo-monitor-default
|
||||
dubbo-native
|
||||
dubbo-parent
|
||||
|
|
@ -82,6 +85,7 @@ dubbo-remoting-api
|
|||
dubbo-remoting-http
|
||||
dubbo-remoting-netty
|
||||
dubbo-remoting-netty4
|
||||
dubbo-remoting-zookeeper-api
|
||||
dubbo-remoting-zookeeper
|
||||
dubbo-remoting-zookeeper-curator5
|
||||
dubbo-rpc
|
||||
|
|
@ -117,3 +121,18 @@ dubbo-zookeeper-curator5-spring-boot-starter
|
|||
dubbo-spring-security
|
||||
dubbo-tracing
|
||||
dubbo-xds
|
||||
dubbo-plugin-cluster-mergeable
|
||||
dubbo-plugin-mock
|
||||
dubbo-plugin-router-script
|
||||
dubbo-plugin-router-mesh
|
||||
dubbo-plugin-router-condition
|
||||
dubbo-plugin-router-tag
|
||||
dubbo-plugin-loadbalance-adaptive
|
||||
dubbo-plugin-access-log
|
||||
dubbo-plugin-tps
|
||||
dubbo-plugin-token
|
||||
dubbo-plugin-generic-invoke
|
||||
dubbo-plugin-context
|
||||
dubbo-plugin-classloader-filter
|
||||
dubbo-plugin-proxy-bytebuddy
|
||||
dubbo-plugin-qos-trace
|
||||
|
|
|
|||
|
|
@ -17,10 +17,7 @@
|
|||
package org.apache.dubbo.rpc.cluster;
|
||||
|
||||
import org.apache.dubbo.common.beans.factory.ScopeBeanFactory;
|
||||
import org.apache.dubbo.rpc.AdaptiveMetrics;
|
||||
import org.apache.dubbo.rpc.cluster.merger.MergerFactory;
|
||||
import org.apache.dubbo.rpc.cluster.router.RouterSnapshotSwitcher;
|
||||
import org.apache.dubbo.rpc.cluster.router.mesh.route.MeshRuleManager;
|
||||
import org.apache.dubbo.rpc.cluster.support.ClusterUtils;
|
||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||
import org.apache.dubbo.rpc.model.FrameworkModel;
|
||||
|
|
@ -37,14 +34,10 @@ public class ClusterScopeModelInitializer implements ScopeModelInitializer {
|
|||
@Override
|
||||
public void initializeApplicationModel(ApplicationModel applicationModel) {
|
||||
ScopeBeanFactory beanFactory = applicationModel.getBeanFactory();
|
||||
beanFactory.registerBean(MergerFactory.class);
|
||||
beanFactory.registerBean(ClusterUtils.class);
|
||||
beanFactory.registerBean(AdaptiveMetrics.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeModuleModel(ModuleModel moduleModel) {
|
||||
ScopeBeanFactory beanFactory = moduleModel.getBeanFactory();
|
||||
beanFactory.registerBean(MeshRuleManager.class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
mock=org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterWrapper
|
||||
scope=org.apache.dubbo.rpc.cluster.support.wrapper.ScopeClusterWrapper
|
||||
failover=org.apache.dubbo.rpc.cluster.support.FailoverCluster
|
||||
failfast=org.apache.dubbo.rpc.cluster.support.FailfastCluster
|
||||
|
|
@ -6,6 +5,5 @@ failsafe=org.apache.dubbo.rpc.cluster.support.FailsafeCluster
|
|||
failback=org.apache.dubbo.rpc.cluster.support.FailbackCluster
|
||||
forking=org.apache.dubbo.rpc.cluster.support.ForkingCluster
|
||||
available=org.apache.dubbo.rpc.cluster.support.AvailableCluster
|
||||
mergeable=org.apache.dubbo.rpc.cluster.support.MergeableCluster
|
||||
broadcast=org.apache.dubbo.rpc.cluster.support.BroadcastCluster
|
||||
zone-aware=org.apache.dubbo.rpc.cluster.support.registry.ZoneAwareCluster
|
||||
zone-aware=org.apache.dubbo.rpc.cluster.support.registry.ZoneAwareCluster
|
||||
|
|
|
|||
|
|
@ -3,4 +3,3 @@ roundrobin=org.apache.dubbo.rpc.cluster.loadbalance.RoundRobinLoadBalance
|
|||
leastactive=org.apache.dubbo.rpc.cluster.loadbalance.LeastActiveLoadBalance
|
||||
consistenthash=org.apache.dubbo.rpc.cluster.loadbalance.ConsistentHashLoadBalance
|
||||
shortestresponse=org.apache.dubbo.rpc.cluster.loadbalance.ShortestResponseLoadBalance
|
||||
adaptive=org.apache.dubbo.rpc.cluster.loadbalance.AdaptiveLoadBalance
|
||||
|
|
|
|||
|
|
@ -1,4 +1 @@
|
|||
consumercontext=org.apache.dubbo.rpc.cluster.filter.support.ConsumerContextFilter
|
||||
consumer-classloader=org.apache.dubbo.rpc.cluster.filter.support.ConsumerClassLoaderFilter
|
||||
router-snapshot=org.apache.dubbo.rpc.cluster.router.RouterSnapshotFilter
|
||||
metricsClusterFilter=org.apache.dubbo.rpc.cluster.filter.support.MetricsClusterFilter
|
||||
|
|
@ -1,253 +1,253 @@
|
|||
/*
|
||||
* 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.dubbo.rpc.cluster;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.common.config.configcenter.ConfigChangeType;
|
||||
import org.apache.dubbo.common.config.configcenter.ConfigChangedEvent;
|
||||
import org.apache.dubbo.common.config.configcenter.DynamicConfiguration;
|
||||
import org.apache.dubbo.common.url.component.ServiceConfigURL;
|
||||
import org.apache.dubbo.common.utils.CollectionUtils;
|
||||
import org.apache.dubbo.rpc.Invoker;
|
||||
import org.apache.dubbo.rpc.RpcContext;
|
||||
import org.apache.dubbo.rpc.RpcInvocation;
|
||||
import org.apache.dubbo.rpc.cluster.filter.DemoService;
|
||||
import org.apache.dubbo.rpc.cluster.router.RouterSnapshotSwitcher;
|
||||
import org.apache.dubbo.rpc.cluster.router.condition.config.AppStateRouter;
|
||||
import org.apache.dubbo.rpc.cluster.router.condition.config.ListenableStateRouter;
|
||||
import org.apache.dubbo.rpc.cluster.router.condition.config.ServiceStateRouter;
|
||||
import org.apache.dubbo.rpc.cluster.router.mesh.route.MeshAppRuleListener;
|
||||
import org.apache.dubbo.rpc.cluster.router.mesh.route.MeshRuleManager;
|
||||
import org.apache.dubbo.rpc.cluster.router.state.BitList;
|
||||
import org.apache.dubbo.rpc.model.FrameworkModel;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY;
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.TAG_KEY;
|
||||
import static org.apache.dubbo.rpc.cluster.router.mesh.route.MeshRuleConstants.MESH_RULE_DATA_ID_SUFFIX;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
class RouterChainTest {
|
||||
|
||||
/**
|
||||
* verify the router and state router loaded by default
|
||||
*/
|
||||
@Test
|
||||
void testBuildRouterChain() {
|
||||
RouterChain<DemoService> routerChain = createRouterChanin();
|
||||
Assertions.assertEquals(0, routerChain.getRouters().size());
|
||||
Assertions.assertEquals(7, routerChain.getStateRouters().size());
|
||||
}
|
||||
|
||||
private RouterChain<DemoService> createRouterChanin() {
|
||||
Map<String, String> parameters = new HashMap<>();
|
||||
parameters.put(INTERFACE_KEY, DemoService.class.getName());
|
||||
parameters.put("registry", "zookeeper");
|
||||
URL url = new ServiceConfigURL("dubbo",
|
||||
"127.0.0.1",
|
||||
20881,
|
||||
DemoService.class.getName(),
|
||||
parameters);
|
||||
|
||||
RouterChain<DemoService> routerChain = RouterChain.buildChain(DemoService.class, url);
|
||||
return routerChain;
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRoute() {
|
||||
RouterChain<DemoService> routerChain = createRouterChanin();
|
||||
|
||||
// mockInvoker will be filtered out by MockInvokersSelector
|
||||
Invoker<DemoService> mockInvoker = createMockInvoker();
|
||||
|
||||
// invoker1 will be filtered out by MeshStateRouter
|
||||
Map<String, String> map1 = new HashMap<>();
|
||||
map1.put("env-sign", "yyyyyyy");
|
||||
Invoker<DemoService> invoker1 = createNormalInvoker(map1);
|
||||
|
||||
// invoker2 will be filtered out by TagStateRouter
|
||||
Map<String, String> map2 = new HashMap<>();
|
||||
map2.put("env-sign", "xxx");
|
||||
map2.put("tag1", "hello");
|
||||
Invoker<DemoService> invoker2 = createNormalInvoker(map2);
|
||||
|
||||
// invoker3 will be filtered out by AppStateRouter
|
||||
Map<String, String> map3 = new HashMap<>();
|
||||
map3.put("env-sign", "xxx");
|
||||
map3.put("tag1", "hello");
|
||||
map3.put(TAG_KEY, "TAG_");
|
||||
Invoker<DemoService> invoker3 = createNormalInvoker(map3);
|
||||
|
||||
// invoker4 will be filtered out by ServiceStateRouter
|
||||
Map<String, String> map4 = new HashMap<>();
|
||||
map4.put("env-sign", "xxx");
|
||||
map4.put("tag1", "hello");
|
||||
map4.put(TAG_KEY, "TAG_");
|
||||
map4.put("timeout", "5000");
|
||||
Invoker<DemoService> invoker4 = createNormalInvoker(map4);
|
||||
|
||||
// invoker5 is the only one returned at the end that is not filtered out
|
||||
Map<String, String> map5 = new HashMap<>();
|
||||
map5.put("env-sign", "xxx");
|
||||
map5.put("tag1", "hello");
|
||||
map5.put(TAG_KEY, "TAG_");
|
||||
map5.put("timeout", "5000");
|
||||
map5.put("serialization", "hessian2");
|
||||
Invoker<DemoService> invoker5 = createNormalInvoker(map5);
|
||||
|
||||
BitList<Invoker<DemoService>> invokers = new BitList<>(Arrays.asList(mockInvoker, invoker1, invoker2, invoker3, invoker4, invoker5));
|
||||
routerChain.setInvokers(invokers, () -> {});
|
||||
|
||||
// mesh rule for MeshStateRouter
|
||||
MeshRuleManager meshRuleManager = mockInvoker.getUrl().getOrDefaultModuleModel().getBeanFactory().getBean(MeshRuleManager.class);
|
||||
ConcurrentHashMap<String, MeshAppRuleListener> appRuleListeners = meshRuleManager.getAppRuleListeners();
|
||||
MeshAppRuleListener meshAppRuleListener = appRuleListeners.get(invoker1.getUrl().getRemoteApplication());
|
||||
ConfigChangedEvent configChangedEvent = new ConfigChangedEvent("demo-route" + MESH_RULE_DATA_ID_SUFFIX, DynamicConfiguration.DEFAULT_GROUP,
|
||||
MESH_RULE1 + "---\n" + MESH_RULE2, ConfigChangeType.ADDED);
|
||||
meshAppRuleListener.process(configChangedEvent);
|
||||
|
||||
|
||||
// condition rule for AppStateRouter&ServiceStateRouter
|
||||
ListenableStateRouter serviceRouter = routerChain.getStateRouters().stream().filter(s -> s instanceof ServiceStateRouter).map(s -> (ListenableStateRouter) s).findAny().orElse(null);
|
||||
ConfigChangedEvent serviceConditionEvent = new ConfigChangedEvent(DynamicConfiguration.getRuleKey(mockInvoker.getUrl()) + ".condition-router", DynamicConfiguration.DEFAULT_GROUP,
|
||||
SERVICE_CONDITION_RULE, ConfigChangeType.ADDED);
|
||||
serviceRouter.process(serviceConditionEvent);
|
||||
|
||||
ListenableStateRouter appRouter = routerChain.getStateRouters().stream().filter(s -> s instanceof AppStateRouter).map(s -> (ListenableStateRouter) s).findAny().orElse(null);
|
||||
ConfigChangedEvent appConditionEvent = new ConfigChangedEvent("app.condition-router", DynamicConfiguration.DEFAULT_GROUP,
|
||||
APP_CONDITION_RULE, ConfigChangeType.ADDED);
|
||||
appRouter.process(appConditionEvent);
|
||||
|
||||
// prepare consumerUrl and RpcInvocation
|
||||
URL consumerUrl = URL.valueOf("consumer://localhost/DemoInterface?remote.application=app1");
|
||||
RpcInvocation rpcInvocation = new RpcInvocation();
|
||||
rpcInvocation.setServiceName("DemoService");
|
||||
rpcInvocation.setObjectAttachment("trafficLabel", "xxx");
|
||||
rpcInvocation.setObjectAttachment(TAG_KEY, "TAG_");
|
||||
|
||||
RpcContext.getServiceContext().setNeedPrintRouterSnapshot(true);
|
||||
RouterSnapshotSwitcher routerSnapshotSwitcher = FrameworkModel.defaultModel().getBeanFactory().getBean(RouterSnapshotSwitcher.class);
|
||||
routerSnapshotSwitcher.addEnabledService("org.apache.dubbo.demo.DemoService");
|
||||
// route
|
||||
List<Invoker<DemoService>> result = routerChain.getSingleChain(consumerUrl, invokers, rpcInvocation)
|
||||
.route(consumerUrl, invokers, rpcInvocation);
|
||||
Assertions.assertEquals(result.size(), 1);
|
||||
Assertions.assertTrue(result.contains(invoker5));
|
||||
|
||||
String snapshotLog =
|
||||
"[ Parent (Input: 6) (Current Node Output: 6) (Chain Node Output: 1) ] Input: localhost:9103,localhost:9103,localhost:9103,localhost:9103,localhost:9103 -> Chain Node Output: localhost:9103...\n" +
|
||||
" [ MockInvokersSelector (Input: 6) (Current Node Output: 5) (Chain Node Output: 1) Router message: invocation.need.mock not set. Return normal Invokers. ] Current Node Output: localhost:9103,localhost:9103,localhost:9103,localhost:9103,localhost:9103\n" +
|
||||
" [ StandardMeshRuleRouter (Input: 5) (Current Node Output: 4) (Chain Node Output: 1) Router message: Match App: app Subset: isolation ] Current Node Output: localhost:9103,localhost:9103,localhost:9103,localhost:9103\n" +
|
||||
" [ TagStateRouter (Input: 4) (Current Node Output: 3) (Chain Node Output: 1) Router message: Disable Tag Router. Reason: tagRouterRule is invalid or disabled ] Current Node Output: localhost:9103,localhost:9103,localhost:9103\n" +
|
||||
" [ ServiceStateRouter (Input: 3) (Current Node Output: 3) (Chain Node Output: 1) Router message: null ] Current Node Output: localhost:9103,localhost:9103,localhost:9103\n" +
|
||||
" [ ConditionStateRouter (Input: 3) (Current Node Output: 2) (Chain Node Output: 2) Router message: Match return. ] Current Node Output: localhost:9103,localhost:9103\n" +
|
||||
" [ ProviderAppStateRouter (Input: 2) (Current Node Output: 2) (Chain Node Output: 1) Router message: Directly return. Reason: Invokers from previous router is empty or conditionRouters is empty. ] Current Node Output: localhost:9103,localhost:9103\n" +
|
||||
" [ AppStateRouter (Input: 2) (Current Node Output: 2) (Chain Node Output: 1) Router message: null ] Current Node Output: localhost:9103,localhost:9103\n" +
|
||||
" [ ConditionStateRouter (Input: 2) (Current Node Output: 1) (Chain Node Output: 1) Router message: Match return. ] Current Node Output: localhost:9103\n" +
|
||||
" [ AppScriptStateRouter (Input: 1) (Current Node Output: 1) (Chain Node Output: 1) Router message: Directly return from script router. Reason: Invokers from previous router is empty or script is not enabled. Script rule is: null ] Current Node Output: localhost:9103";
|
||||
String[] snapshot = routerSnapshotSwitcher.cloneSnapshot();
|
||||
Assertions.assertTrue(snapshot[0].contains(snapshotLog));
|
||||
|
||||
RpcContext.getServiceContext().setNeedPrintRouterSnapshot(false);
|
||||
result = routerChain.getSingleChain(consumerUrl, invokers, rpcInvocation)
|
||||
.route(consumerUrl, invokers, rpcInvocation);
|
||||
Assertions.assertEquals(result.size(), 1);
|
||||
Assertions.assertTrue(result.contains(invoker5));
|
||||
|
||||
routerChain.destroy();
|
||||
Assertions.assertEquals(routerChain.getRouters().size(), 0);
|
||||
Assertions.assertEquals(routerChain.getStateRouters().size(), 0);
|
||||
|
||||
}
|
||||
|
||||
private Invoker<DemoService> createMockInvoker() {
|
||||
URL url = URL.valueOf("mock://localhost:9103/DemoInterface?remote.application=app");
|
||||
Invoker<DemoService> invoker = Mockito.mock(Invoker.class);
|
||||
when(invoker.getUrl()).thenReturn(url);
|
||||
return invoker;
|
||||
}
|
||||
|
||||
private Invoker<DemoService> createNormalInvoker(Map<String, String> parameters) {
|
||||
URL url = URL.valueOf("dubbo://localhost:9103/DemoInterface?remote.application=app");
|
||||
if (CollectionUtils.isNotEmptyMap(parameters)) {
|
||||
url = url.addParameters(parameters);
|
||||
}
|
||||
Invoker<DemoService> invoker = Mockito.mock(Invoker.class);
|
||||
when(invoker.getUrl()).thenReturn(url);
|
||||
return invoker;
|
||||
}
|
||||
|
||||
|
||||
private final static String MESH_RULE1 = "apiVersion: service.dubbo.apache.org/v1alpha1\n" +
|
||||
"kind: DestinationRule\n" +
|
||||
"metadata: { name: demo-route }\n" +
|
||||
"spec:\n" +
|
||||
" host: demo\n" +
|
||||
" subsets:\n" +
|
||||
" - labels: { env-sign: xxx, tag1: hello }\n" +
|
||||
" name: isolation\n" +
|
||||
" - labels: { env-sign: yyy }\n" +
|
||||
" name: testing-trunk\n" +
|
||||
" - labels: { env-sign: zzz }\n" +
|
||||
" name: testing\n" +
|
||||
" trafficPolicy:\n" +
|
||||
" loadBalancer: { simple: ROUND_ROBIN }\n" +
|
||||
"\n";
|
||||
|
||||
private final static String MESH_RULE2 = "apiVersion: service.dubbo.apache.org/v1alpha1\n" +
|
||||
"kind: VirtualService\n" +
|
||||
"metadata: { name: demo-route }\n" +
|
||||
"spec:\n" +
|
||||
" dubbo:\n" +
|
||||
" - routedetail:\n" +
|
||||
" - match:\n" +
|
||||
" - attachments: \n" +
|
||||
" dubboContext: {trafficLabel: {regex: xxx}}\n" +
|
||||
" name: xxx-project\n" +
|
||||
" route:\n" +
|
||||
" - destination: {host: demo, subset: isolation}\n" +
|
||||
" services:\n" +
|
||||
" - {regex: DemoService}\n" +
|
||||
" hosts: [demo]\n";
|
||||
|
||||
private static final String APP_CONDITION_RULE = "scope: application\n" +
|
||||
"force: true\n" +
|
||||
"runtime: false\n" +
|
||||
"enabled: true\n" +
|
||||
"priority: 1\n" +
|
||||
"key: demo-consumer\n" +
|
||||
"conditions:\n" +
|
||||
"- => serialization=hessian2";
|
||||
|
||||
private static final String SERVICE_CONDITION_RULE = "scope: service\n" +
|
||||
"force: true\n" +
|
||||
"runtime: false\n" +
|
||||
"enabled: true\n" +
|
||||
"priority: 1\n" +
|
||||
"key: org.apache.dubbo.demo.DemoService\n" +
|
||||
"conditions:\n" +
|
||||
"- => timeout=5000";
|
||||
}
|
||||
///*
|
||||
// * 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.dubbo.rpc.cluster;
|
||||
//
|
||||
//
|
||||
//import java.util.Arrays;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//import java.util.concurrent.ConcurrentHashMap;
|
||||
//
|
||||
//import org.apache.dubbo.common.URL;
|
||||
//import org.apache.dubbo.common.config.configcenter.ConfigChangeType;
|
||||
//import org.apache.dubbo.common.config.configcenter.ConfigChangedEvent;
|
||||
//import org.apache.dubbo.common.config.configcenter.DynamicConfiguration;
|
||||
//import org.apache.dubbo.common.url.component.ServiceConfigURL;
|
||||
//import org.apache.dubbo.common.utils.CollectionUtils;
|
||||
//import org.apache.dubbo.rpc.Invoker;
|
||||
//import org.apache.dubbo.rpc.RpcContext;
|
||||
//import org.apache.dubbo.rpc.RpcInvocation;
|
||||
//import org.apache.dubbo.rpc.cluster.filter.DemoService;
|
||||
//import org.apache.dubbo.rpc.cluster.router.RouterSnapshotSwitcher;
|
||||
//import org.apache.dubbo.rpc.cluster.router.condition.config.AppStateRouter;
|
||||
//import org.apache.dubbo.rpc.cluster.router.condition.config.ListenableStateRouter;
|
||||
//import org.apache.dubbo.rpc.cluster.router.condition.config.ServiceStateRouter;
|
||||
//import org.apache.dubbo.rpc.cluster.router.mesh.route.MeshAppRuleListener;
|
||||
//import org.apache.dubbo.rpc.cluster.router.mesh.route.MeshRuleManager;
|
||||
//import org.apache.dubbo.rpc.cluster.router.state.BitList;
|
||||
//import org.apache.dubbo.rpc.model.FrameworkModel;
|
||||
//import org.junit.jupiter.api.Assertions;
|
||||
//import org.junit.jupiter.api.Test;
|
||||
//import org.mockito.Mockito;
|
||||
//
|
||||
//import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY;
|
||||
//import static org.apache.dubbo.common.constants.CommonConstants.TAG_KEY;
|
||||
//import static org.apache.dubbo.rpc.cluster.router.mesh.route.MeshRuleConstants.MESH_RULE_DATA_ID_SUFFIX;
|
||||
//import static org.mockito.Mockito.when;
|
||||
//
|
||||
//class RouterChainTest {
|
||||
//
|
||||
// /**
|
||||
// * verify the router and state router loaded by default
|
||||
// */
|
||||
// @Test
|
||||
// void testBuildRouterChain() {
|
||||
// RouterChain<DemoService> routerChain = createRouterChanin();
|
||||
// Assertions.assertEquals(0, routerChain.getRouters().size());
|
||||
// Assertions.assertEquals(7, routerChain.getStateRouters().size());
|
||||
// }
|
||||
//
|
||||
// private RouterChain<DemoService> createRouterChanin() {
|
||||
// Map<String, String> parameters = new HashMap<>();
|
||||
// parameters.put(INTERFACE_KEY, DemoService.class.getName());
|
||||
// parameters.put("registry", "zookeeper");
|
||||
// URL url = new ServiceConfigURL("dubbo",
|
||||
// "127.0.0.1",
|
||||
// 20881,
|
||||
// DemoService.class.getName(),
|
||||
// parameters);
|
||||
//
|
||||
// RouterChain<DemoService> routerChain = RouterChain.buildChain(DemoService.class, url);
|
||||
// return routerChain;
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// void testRoute() {
|
||||
// RouterChain<DemoService> routerChain = createRouterChanin();
|
||||
//
|
||||
// // mockInvoker will be filtered out by MockInvokersSelector
|
||||
// Invoker<DemoService> mockInvoker = createMockInvoker();
|
||||
//
|
||||
// // invoker1 will be filtered out by MeshStateRouter
|
||||
// Map<String, String> map1 = new HashMap<>();
|
||||
// map1.put("env-sign", "yyyyyyy");
|
||||
// Invoker<DemoService> invoker1 = createNormalInvoker(map1);
|
||||
//
|
||||
// // invoker2 will be filtered out by TagStateRouter
|
||||
// Map<String, String> map2 = new HashMap<>();
|
||||
// map2.put("env-sign", "xxx");
|
||||
// map2.put("tag1", "hello");
|
||||
// Invoker<DemoService> invoker2 = createNormalInvoker(map2);
|
||||
//
|
||||
// // invoker3 will be filtered out by AppStateRouter
|
||||
// Map<String, String> map3 = new HashMap<>();
|
||||
// map3.put("env-sign", "xxx");
|
||||
// map3.put("tag1", "hello");
|
||||
// map3.put(TAG_KEY, "TAG_");
|
||||
// Invoker<DemoService> invoker3 = createNormalInvoker(map3);
|
||||
//
|
||||
// // invoker4 will be filtered out by ServiceStateRouter
|
||||
// Map<String, String> map4 = new HashMap<>();
|
||||
// map4.put("env-sign", "xxx");
|
||||
// map4.put("tag1", "hello");
|
||||
// map4.put(TAG_KEY, "TAG_");
|
||||
// map4.put("timeout", "5000");
|
||||
// Invoker<DemoService> invoker4 = createNormalInvoker(map4);
|
||||
//
|
||||
// // invoker5 is the only one returned at the end that is not filtered out
|
||||
// Map<String, String> map5 = new HashMap<>();
|
||||
// map5.put("env-sign", "xxx");
|
||||
// map5.put("tag1", "hello");
|
||||
// map5.put(TAG_KEY, "TAG_");
|
||||
// map5.put("timeout", "5000");
|
||||
// map5.put("serialization", "hessian2");
|
||||
// Invoker<DemoService> invoker5 = createNormalInvoker(map5);
|
||||
//
|
||||
// BitList<Invoker<DemoService>> invokers = new BitList<>(Arrays.asList(mockInvoker, invoker1, invoker2, invoker3, invoker4, invoker5));
|
||||
// routerChain.setInvokers(invokers, () -> {});
|
||||
//
|
||||
// // mesh rule for MeshStateRouter
|
||||
// MeshRuleManager meshRuleManager = mockInvoker.getUrl().getOrDefaultModuleModel().getBeanFactory().getBean(MeshRuleManager.class);
|
||||
// ConcurrentHashMap<String, MeshAppRuleListener> appRuleListeners = meshRuleManager.getAppRuleListeners();
|
||||
// MeshAppRuleListener meshAppRuleListener = appRuleListeners.get(invoker1.getUrl().getRemoteApplication());
|
||||
// ConfigChangedEvent configChangedEvent = new ConfigChangedEvent("demo-route" + MESH_RULE_DATA_ID_SUFFIX, DynamicConfiguration.DEFAULT_GROUP,
|
||||
// MESH_RULE1 + "---\n" + MESH_RULE2, ConfigChangeType.ADDED);
|
||||
// meshAppRuleListener.process(configChangedEvent);
|
||||
//
|
||||
//
|
||||
// // condition rule for AppStateRouter&ServiceStateRouter
|
||||
// ListenableStateRouter serviceRouter = routerChain.getStateRouters().stream().filter(s -> s instanceof ServiceStateRouter).map(s -> (ListenableStateRouter) s).findAny().orElse(null);
|
||||
// ConfigChangedEvent serviceConditionEvent = new ConfigChangedEvent(DynamicConfiguration.getRuleKey(mockInvoker.getUrl()) + ".condition-router", DynamicConfiguration.DEFAULT_GROUP,
|
||||
// SERVICE_CONDITION_RULE, ConfigChangeType.ADDED);
|
||||
// serviceRouter.process(serviceConditionEvent);
|
||||
//
|
||||
// ListenableStateRouter appRouter = routerChain.getStateRouters().stream().filter(s -> s instanceof AppStateRouter).map(s -> (ListenableStateRouter) s).findAny().orElse(null);
|
||||
// ConfigChangedEvent appConditionEvent = new ConfigChangedEvent("app.condition-router", DynamicConfiguration.DEFAULT_GROUP,
|
||||
// APP_CONDITION_RULE, ConfigChangeType.ADDED);
|
||||
// appRouter.process(appConditionEvent);
|
||||
//
|
||||
// // prepare consumerUrl and RpcInvocation
|
||||
// URL consumerUrl = URL.valueOf("consumer://localhost/DemoInterface?remote.application=app1");
|
||||
// RpcInvocation rpcInvocation = new RpcInvocation();
|
||||
// rpcInvocation.setServiceName("DemoService");
|
||||
// rpcInvocation.setObjectAttachment("trafficLabel", "xxx");
|
||||
// rpcInvocation.setObjectAttachment(TAG_KEY, "TAG_");
|
||||
//
|
||||
// RpcContext.getServiceContext().setNeedPrintRouterSnapshot(true);
|
||||
// RouterSnapshotSwitcher routerSnapshotSwitcher = FrameworkModel.defaultModel().getBeanFactory().getBean(RouterSnapshotSwitcher.class);
|
||||
// routerSnapshotSwitcher.addEnabledService("org.apache.dubbo.demo.DemoService");
|
||||
// // route
|
||||
// List<Invoker<DemoService>> result = routerChain.getSingleChain(consumerUrl, invokers, rpcInvocation)
|
||||
// .route(consumerUrl, invokers, rpcInvocation);
|
||||
// Assertions.assertEquals(result.size(), 1);
|
||||
// Assertions.assertTrue(result.contains(invoker5));
|
||||
//
|
||||
// String snapshotLog =
|
||||
// "[ Parent (Input: 6) (Current Node Output: 6) (Chain Node Output: 1) ] Input: localhost:9103,localhost:9103,localhost:9103,localhost:9103,localhost:9103 -> Chain Node Output: localhost:9103...\n" +
|
||||
// " [ MockInvokersSelector (Input: 6) (Current Node Output: 5) (Chain Node Output: 1) Router message: invocation.need.mock not set. Return normal Invokers. ] Current Node Output: localhost:9103,localhost:9103,localhost:9103,localhost:9103,localhost:9103\n" +
|
||||
// " [ StandardMeshRuleRouter (Input: 5) (Current Node Output: 4) (Chain Node Output: 1) Router message: Match App: app Subset: isolation ] Current Node Output: localhost:9103,localhost:9103,localhost:9103,localhost:9103\n" +
|
||||
// " [ TagStateRouter (Input: 4) (Current Node Output: 3) (Chain Node Output: 1) Router message: Disable Tag Router. Reason: tagRouterRule is invalid or disabled ] Current Node Output: localhost:9103,localhost:9103,localhost:9103\n" +
|
||||
// " [ ServiceStateRouter (Input: 3) (Current Node Output: 3) (Chain Node Output: 1) Router message: null ] Current Node Output: localhost:9103,localhost:9103,localhost:9103\n" +
|
||||
// " [ ConditionStateRouter (Input: 3) (Current Node Output: 2) (Chain Node Output: 2) Router message: Match return. ] Current Node Output: localhost:9103,localhost:9103\n" +
|
||||
// " [ ProviderAppStateRouter (Input: 2) (Current Node Output: 2) (Chain Node Output: 1) Router message: Directly return. Reason: Invokers from previous router is empty or conditionRouters is empty. ] Current Node Output: localhost:9103,localhost:9103\n" +
|
||||
// " [ AppStateRouter (Input: 2) (Current Node Output: 2) (Chain Node Output: 1) Router message: null ] Current Node Output: localhost:9103,localhost:9103\n" +
|
||||
// " [ ConditionStateRouter (Input: 2) (Current Node Output: 1) (Chain Node Output: 1) Router message: Match return. ] Current Node Output: localhost:9103\n" +
|
||||
// " [ AppScriptStateRouter (Input: 1) (Current Node Output: 1) (Chain Node Output: 1) Router message: Directly return from script router. Reason: Invokers from previous router is empty or script is not enabled. Script rule is: null ] Current Node Output: localhost:9103";
|
||||
// String[] snapshot = routerSnapshotSwitcher.cloneSnapshot();
|
||||
// Assertions.assertTrue(snapshot[0].contains(snapshotLog));
|
||||
//
|
||||
// RpcContext.getServiceContext().setNeedPrintRouterSnapshot(false);
|
||||
// result = routerChain.getSingleChain(consumerUrl, invokers, rpcInvocation)
|
||||
// .route(consumerUrl, invokers, rpcInvocation);
|
||||
// Assertions.assertEquals(result.size(), 1);
|
||||
// Assertions.assertTrue(result.contains(invoker5));
|
||||
//
|
||||
// routerChain.destroy();
|
||||
// Assertions.assertEquals(routerChain.getRouters().size(), 0);
|
||||
// Assertions.assertEquals(routerChain.getStateRouters().size(), 0);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// private Invoker<DemoService> createMockInvoker() {
|
||||
// URL url = URL.valueOf("mock://localhost:9103/DemoInterface?remote.application=app");
|
||||
// Invoker<DemoService> invoker = Mockito.mock(Invoker.class);
|
||||
// when(invoker.getUrl()).thenReturn(url);
|
||||
// return invoker;
|
||||
// }
|
||||
//
|
||||
// private Invoker<DemoService> createNormalInvoker(Map<String, String> parameters) {
|
||||
// URL url = URL.valueOf("dubbo://localhost:9103/DemoInterface?remote.application=app");
|
||||
// if (CollectionUtils.isNotEmptyMap(parameters)) {
|
||||
// url = url.addParameters(parameters);
|
||||
// }
|
||||
// Invoker<DemoService> invoker = Mockito.mock(Invoker.class);
|
||||
// when(invoker.getUrl()).thenReturn(url);
|
||||
// return invoker;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private final static String MESH_RULE1 = "apiVersion: service.dubbo.apache.org/v1alpha1\n" +
|
||||
// "kind: DestinationRule\n" +
|
||||
// "metadata: { name: demo-route }\n" +
|
||||
// "spec:\n" +
|
||||
// " host: demo\n" +
|
||||
// " subsets:\n" +
|
||||
// " - labels: { env-sign: xxx, tag1: hello }\n" +
|
||||
// " name: isolation\n" +
|
||||
// " - labels: { env-sign: yyy }\n" +
|
||||
// " name: testing-trunk\n" +
|
||||
// " - labels: { env-sign: zzz }\n" +
|
||||
// " name: testing\n" +
|
||||
// " trafficPolicy:\n" +
|
||||
// " loadBalancer: { simple: ROUND_ROBIN }\n" +
|
||||
// "\n";
|
||||
//
|
||||
// private final static String MESH_RULE2 = "apiVersion: service.dubbo.apache.org/v1alpha1\n" +
|
||||
// "kind: VirtualService\n" +
|
||||
// "metadata: { name: demo-route }\n" +
|
||||
// "spec:\n" +
|
||||
// " dubbo:\n" +
|
||||
// " - routedetail:\n" +
|
||||
// " - match:\n" +
|
||||
// " - attachments: \n" +
|
||||
// " dubboContext: {trafficLabel: {regex: xxx}}\n" +
|
||||
// " name: xxx-project\n" +
|
||||
// " route:\n" +
|
||||
// " - destination: {host: demo, subset: isolation}\n" +
|
||||
// " services:\n" +
|
||||
// " - {regex: DemoService}\n" +
|
||||
// " hosts: [demo]\n";
|
||||
//
|
||||
// private static final String APP_CONDITION_RULE = "scope: application\n" +
|
||||
// "force: true\n" +
|
||||
// "runtime: false\n" +
|
||||
// "enabled: true\n" +
|
||||
// "priority: 1\n" +
|
||||
// "key: demo-consumer\n" +
|
||||
// "conditions:\n" +
|
||||
// "- => serialization=hessian2";
|
||||
//
|
||||
// private static final String SERVICE_CONDITION_RULE = "scope: service\n" +
|
||||
// "force: true\n" +
|
||||
// "runtime: false\n" +
|
||||
// "enabled: true\n" +
|
||||
// "priority: 1\n" +
|
||||
// "key: org.apache.dubbo.demo.DemoService\n" +
|
||||
// "conditions:\n" +
|
||||
// "- => timeout=5000";
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -576,26 +576,6 @@ class AbstractClusterInvokerTest {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test mock invoker selector works as expected
|
||||
*/
|
||||
@Test
|
||||
void testMockedInvokerSelect() {
|
||||
initlistsize5();
|
||||
invokers.add(mockedInvoker1);
|
||||
|
||||
initDic();
|
||||
|
||||
RpcInvocation mockedInvocation = new RpcInvocation();
|
||||
mockedInvocation.setMethodName("sayHello");
|
||||
mockedInvocation.setAttachment(INVOCATION_NEED_MOCK, "true");
|
||||
List<Invoker<IHelloService>> mockedInvokers = dic.list(mockedInvocation);
|
||||
Assertions.assertEquals(1, mockedInvokers.size());
|
||||
|
||||
List<Invoker<IHelloService>> invokers = dic.list(invocation);
|
||||
Assertions.assertEquals(5, invokers.size());
|
||||
}
|
||||
|
||||
public static interface IHelloService {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
package org.apache.dubbo.common.config.configcenter;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration;
|
||||
import org.apache.dubbo.common.utils.StringUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
|
|
@ -30,7 +29,7 @@ import static org.apache.dubbo.common.utils.PathUtils.normalize;
|
|||
/**
|
||||
* An abstract implementation of {@link DynamicConfiguration} is like "tree-structure" path :
|
||||
* <ul>
|
||||
* <li>{@link FileSystemDynamicConfiguration "file"}</li>
|
||||
* <li>{@link org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration "file"}</li>
|
||||
* <li>{@link org.apache.dubbo.configcenter.support.zookeeper.ZookeeperDynamicConfiguration "zookeeper"}</li>
|
||||
* <li>{@link org.apache.dubbo.configcenter.consul.ConsulDynamicConfiguration "consul"}</li>
|
||||
* </ul>
|
||||
|
|
|
|||
|
|
@ -281,6 +281,7 @@ public interface CommonConstants {
|
|||
String MONITOR_KEY = "monitor";
|
||||
String BACKGROUND_KEY = "background";
|
||||
String CLUSTER_KEY = "cluster";
|
||||
String MERGEABLE_CLUSTER_NAME = "mergeable";
|
||||
String USERNAME_KEY = "username";
|
||||
String PASSWORD_KEY = "password";
|
||||
String HOST_KEY = "host";
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
nop=org.apache.dubbo.common.config.configcenter.nop.NopDynamicConfigurationFactory
|
||||
file=org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfigurationFactory
|
||||
|
|
@ -94,6 +94,12 @@
|
|||
<version>${project.parent.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-generic-invoke</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
|
|
|
|||
|
|
@ -232,6 +232,20 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-router-condition</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-router-tag</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.testcontainers</groupId>
|
||||
<artifactId>testcontainers</artifactId>
|
||||
|
|
|
|||
|
|
@ -739,7 +739,6 @@ public class ReferenceConfig<T> extends ReferenceConfigBase<T> {
|
|||
}
|
||||
|
||||
checkStubAndLocal(interfaceClass);
|
||||
ConfigValidationUtils.checkMock(interfaceClass, this);
|
||||
|
||||
if (StringUtils.isEmpty(url)) {
|
||||
checkRegistry();
|
||||
|
|
|
|||
|
|
@ -463,7 +463,6 @@ public class ServiceConfig<T> extends ServiceConfigBase<T> {
|
|||
}
|
||||
}
|
||||
checkStubAndLocal(interfaceClass);
|
||||
ConfigValidationUtils.checkMock(interfaceClass, this);
|
||||
ConfigValidationUtils.validateServiceConfig(this);
|
||||
postProcessConfig();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ import org.apache.dubbo.rpc.cluster.LoadBalance;
|
|||
import org.apache.dubbo.rpc.cluster.filter.ClusterFilter;
|
||||
import org.apache.dubbo.rpc.model.ScopeModel;
|
||||
import org.apache.dubbo.rpc.model.ScopeModelUtil;
|
||||
import org.apache.dubbo.rpc.support.MockInvoker;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
|
@ -354,45 +353,6 @@ public class ConfigValidationUtils {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Legitimacy check and setup of local simulated operations. The operations can be a string with Simple operation or
|
||||
* a classname whose {@link Class} implements a particular function
|
||||
*
|
||||
* @param interfaceClass for provider side, it is the {@link Class} of the service that will be exported; for consumer
|
||||
* side, it is the {@link Class} of the remote service interface that will be referenced
|
||||
*/
|
||||
public static void checkMock(Class<?> interfaceClass, AbstractInterfaceConfig config) {
|
||||
String mock = config.getMock();
|
||||
if (ConfigUtils.isEmpty(mock)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String normalizedMock = MockInvoker.normalizeMock(mock);
|
||||
if (normalizedMock.startsWith(RETURN_PREFIX)) {
|
||||
normalizedMock = normalizedMock.substring(RETURN_PREFIX.length()).trim();
|
||||
try {
|
||||
//Check whether the mock value is legal, if it is illegal, throw exception
|
||||
MockInvoker.parseMockValue(normalizedMock);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException("Illegal mock return in <dubbo:service/reference ... " +
|
||||
"mock=\"" + mock + "\" />");
|
||||
}
|
||||
} else if (normalizedMock.startsWith(THROW_PREFIX)) {
|
||||
normalizedMock = normalizedMock.substring(THROW_PREFIX.length()).trim();
|
||||
if (ConfigUtils.isNotEmpty(normalizedMock)) {
|
||||
try {
|
||||
//Check whether the mock value is legal
|
||||
MockInvoker.getThrowable(normalizedMock);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException("Illegal mock throw in <dubbo:service/reference ... " +
|
||||
"mock=\"" + mock + "\" />");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//Check whether the mock class is a implementation of the interfaceClass, and if it has a default constructor
|
||||
MockInvoker.getMockObject(config.getScopeModel().getExtensionDirector(), normalizedMock, interfaceClass);
|
||||
}
|
||||
}
|
||||
|
||||
public static void validateAbstractInterfaceConfig(AbstractInterfaceConfig config) {
|
||||
checkName(LOCAL_KEY, config.getLocal());
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import org.apache.dubbo.rpc.Protocol;
|
|||
import org.apache.dubbo.rpc.ProxyFactory;
|
||||
import org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder;
|
||||
import org.apache.dubbo.rpc.cluster.support.registry.ZoneAwareClusterInvoker;
|
||||
import org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker;
|
||||
//import org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker;
|
||||
import org.apache.dubbo.rpc.cluster.support.wrapper.ScopeClusterInvoker;
|
||||
import org.apache.dubbo.rpc.listener.ListenerInvokerWrapper;
|
||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||
|
|
@ -418,8 +418,9 @@ class ReferenceConfigTest {
|
|||
Assertions.assertTrue(referenceConfig.getInvoker() instanceof ScopeClusterInvoker);
|
||||
ScopeClusterInvoker<?> scopeClusterInvoker = (ScopeClusterInvoker<?>) referenceConfig.getInvoker();
|
||||
Invoker<?> mockInvoker = scopeClusterInvoker.getInvoker();
|
||||
Assertions.assertTrue(mockInvoker instanceof MockClusterInvoker);
|
||||
Invoker<?> withCount = ((MockClusterInvoker<?>) mockInvoker).getDirectory().getAllInvokers().get(0);
|
||||
// Assertions.assertTrue(mockInvoker instanceof MockClusterInvoker);
|
||||
// Invoker<?> withCount = ((MockClusterInvoker<?>) mockInvoker).getDirectory().getAllInvokers().get(0);
|
||||
Invoker<?> withCount = scopeClusterInvoker.getDirectory().getAllInvokers().get(0);
|
||||
|
||||
Assertions.assertTrue(withCount instanceof ReferenceCountInvokerWrapper);
|
||||
Invoker<?> withFilter = ((ReferenceCountInvokerWrapper<?>) withCount).getInvoker();
|
||||
|
|
@ -525,7 +526,7 @@ class ReferenceConfigTest {
|
|||
referenceConfig.init();
|
||||
Assertions.assertTrue(referenceConfig.getInvoker() instanceof ScopeClusterInvoker);
|
||||
Invoker scopeClusterInvoker = referenceConfig.getInvoker();
|
||||
Assertions.assertTrue(((ScopeClusterInvoker) scopeClusterInvoker).getInvoker() instanceof MockClusterInvoker);
|
||||
// Assertions.assertTrue(((ScopeClusterInvoker) scopeClusterInvoker).getInvoker() instanceof MockClusterInvoker);
|
||||
Assertions.assertEquals(Boolean.TRUE, ((ScopeClusterInvoker) scopeClusterInvoker).getInvoker().getUrl().getAttribute(PEER_KEY));
|
||||
dubboBootstrap.destroy();
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,6 @@ import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
|||
import org.apache.dubbo.config.AbstractInterfaceConfig;
|
||||
import org.apache.dubbo.config.ApplicationConfig;
|
||||
import org.apache.dubbo.config.MetadataReportConfig;
|
||||
import org.apache.dubbo.config.api.Greeting;
|
||||
import org.apache.dubbo.config.mock.GreetingMock1;
|
||||
import org.apache.dubbo.config.mock.GreetingMock2;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
|
@ -43,35 +40,6 @@ import static org.mockito.Mockito.verify;
|
|||
|
||||
class ConfigValidationUtilsTest {
|
||||
|
||||
|
||||
@Test
|
||||
void checkMock1() {
|
||||
Assertions.assertThrows(IllegalStateException.class, () -> {
|
||||
InterfaceConfig interfaceConfig = new InterfaceConfig();
|
||||
interfaceConfig.setMock("return {a, b}");
|
||||
ConfigValidationUtils.checkMock(Greeting.class, interfaceConfig);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void checkMock2() {
|
||||
Assertions.assertThrows(IllegalStateException.class, () -> {
|
||||
InterfaceConfig interfaceConfig = new InterfaceConfig();
|
||||
interfaceConfig.setMock(GreetingMock1.class.getName());
|
||||
ConfigValidationUtils.checkMock(Greeting.class, interfaceConfig);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void checkMock3() {
|
||||
Assertions.assertThrows(IllegalStateException.class, () -> {
|
||||
InterfaceConfig interfaceConfig = new InterfaceConfig();
|
||||
interfaceConfig.setMock(GreetingMock2.class.getName());
|
||||
ConfigValidationUtils.checkMock(Greeting.class, interfaceConfig);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void testValidateMetadataConfig() {
|
||||
MetadataReportConfig config = new MetadataReportConfig();
|
||||
|
|
|
|||
|
|
@ -124,6 +124,42 @@
|
|||
<version>${project.parent.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-context</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-generic-invoke</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-classloader-filter</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-access-log</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-monitor-common</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-qos-trace</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
<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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-configcenter</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>dubbo-configcenter-file</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>${project.artifactId}</name>
|
||||
<description>The File implementation of the configcenter api</description>
|
||||
<properties>
|
||||
<skip_maven_deploy>false</skip_maven_deploy>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-common</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-metrics-api</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-metrics-default</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-metrics-prometheus</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-metrics-config-center</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1 @@
|
|||
file=org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfigurationFactory
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
<module>dubbo-configcenter-zookeeper</module>
|
||||
<module>dubbo-configcenter-apollo</module>
|
||||
<module>dubbo-configcenter-nacos</module>
|
||||
<module>dubbo-configcenter-file</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -99,6 +99,11 @@
|
|||
<artifactId>dubbo-serialization-fastjson2</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-cluster-mergeable</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -75,6 +75,13 @@
|
|||
</dependency>
|
||||
|
||||
<!-- config-center -->
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-configcenter-file</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-configcenter-zookeeper</artifactId>
|
||||
|
|
@ -146,6 +153,13 @@
|
|||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-metadata-rest</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-metadata-report-zookeeper</artifactId>
|
||||
|
|
@ -236,6 +250,13 @@
|
|||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-monitor-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-monitor-default</artifactId>
|
||||
|
|
@ -289,6 +310,126 @@
|
|||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-cluster-mergeable</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-mock</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-router-script</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-router-mesh</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-router-condition</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-router-tag</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-loadbalance-adaptive</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-access-log</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-tps</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-token</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-generic-invoke</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-context</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-classloader-filter</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-proxy-bytebuddy</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-qos-trace</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- registry -->
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
|
|
@ -355,6 +496,13 @@
|
|||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-zookeeper-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-zookeeper</artifactId>
|
||||
|
|
@ -521,6 +669,7 @@
|
|||
<include>org.apache.dubbo:dubbo-compatible</include>
|
||||
<include>org.apache.dubbo:dubbo-config-api</include>
|
||||
<include>org.apache.dubbo:dubbo-config-spring</include>
|
||||
<include>org.apache.dubbo:dubbo-configcenter-file</include>
|
||||
<include>org.apache.dubbo:dubbo-configcenter-apollo</include>
|
||||
<include>org.apache.dubbo:dubbo-configcenter-nacos</include>
|
||||
<include>org.apache.dubbo:dubbo-configcenter-zookeeper</include>
|
||||
|
|
@ -529,6 +678,7 @@
|
|||
<include>org.apache.dubbo:dubbo-filter-cache</include>
|
||||
<include>org.apache.dubbo:dubbo-filter-validation</include>
|
||||
<include>org.apache.dubbo:dubbo-metadata-api</include>
|
||||
<include>org.apache.dubbo:dubbo-metadata-rest</include>
|
||||
<include>org.apache.dubbo:dubbo-metadata-definition-protobuf</include>
|
||||
<include>org.apache.dubbo:dubbo-metadata-report-nacos</include>
|
||||
<include>org.apache.dubbo:dubbo-metadata-report-redis</include>
|
||||
|
|
@ -541,12 +691,28 @@
|
|||
<include>org.apache.dubbo:dubbo-metrics-prometheus</include>
|
||||
<include>org.apache.dubbo:dubbo-tracing</include>
|
||||
<include>org.apache.dubbo:dubbo-monitor-api</include>
|
||||
<include>org.apache.dubbo:dubbo-monitor-common</include>
|
||||
<include>org.apache.dubbo:dubbo-monitor-default</include>
|
||||
<include>org.apache.dubbo:dubbo-qos</include>
|
||||
<include>org.apache.dubbo:dubbo-qos-api</include>
|
||||
<include>org.apache.dubbo:dubbo-security</include>
|
||||
<include>org.apache.dubbo:dubbo-reactive</include>
|
||||
<include>org.apache.dubbo:dubbo-spring-security</include>
|
||||
<include>org.apache.dubbo:dubbo-plugin-cluster-mergeable</include>
|
||||
<include>org.apache.dubbo:dubbo-plugin-mock</include>
|
||||
<include>org.apache.dubbo:dubbo-plugin-router-script</include>
|
||||
<include>org.apache.dubbo:dubbo-plugin-router-mesh</include>
|
||||
<include>org.apache.dubbo:dubbo-plugin-router-condition</include>
|
||||
<include>org.apache.dubbo:dubbo-plugin-router-tag</include>
|
||||
<include>org.apache.dubbo:dubbo-plugin-loadbalance-adaptive</include>
|
||||
<include>org.apache.dubbo:dubbo-plugin-access-log</include>
|
||||
<include>org.apache.dubbo:dubbo-plugin-tps</include>
|
||||
<include>org.apache.dubbo:dubbo-plugin-token</include>
|
||||
<include>org.apache.dubbo:dubbo-plugin-generic-invoke</include>
|
||||
<include>org.apache.dubbo:dubbo-plugin-context</include>
|
||||
<include>org.apache.dubbo:dubbo-plugin-classloader-filter</include>
|
||||
<include>org.apache.dubbo:dubbo-plugin-proxy-bytebuddy</include>
|
||||
<include>org.apache.dubbo:dubbo-plugin-qos-trace</include>
|
||||
<include>org.apache.dubbo:dubbo-registry-api</include>
|
||||
<include>org.apache.dubbo:dubbo-registry-multicast</include>
|
||||
<include>org.apache.dubbo:dubbo-registry-multiple</include>
|
||||
|
|
@ -556,6 +722,7 @@
|
|||
<include>org.apache.dubbo:dubbo-remoting-http</include>
|
||||
<include>org.apache.dubbo:dubbo-remoting-netty4</include>
|
||||
<include>org.apache.dubbo:dubbo-remoting-netty</include>
|
||||
<include>org.apache.dubbo:dubbo-remoting-zookeeper-api</include>
|
||||
<include>org.apache.dubbo:dubbo-remoting-zookeeper</include>
|
||||
<include>org.apache.dubbo:dubbo-remoting-zookeeper-curator5</include>
|
||||
<include>org.apache.dubbo:dubbo-rpc-api</include>
|
||||
|
|
|
|||
|
|
@ -90,6 +90,11 @@
|
|||
<artifactId>dubbo-configcenter</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-configcenter-file</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-configcenter-zookeeper</artifactId>
|
||||
|
|
@ -199,6 +204,11 @@
|
|||
<artifactId>dubbo-metadata-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-metadata-rest</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-metadata-report-zookeeper</artifactId>
|
||||
|
|
@ -280,6 +290,11 @@
|
|||
<artifactId>dubbo-monitor-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-monitor-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-monitor-default</artifactId>
|
||||
|
|
@ -337,6 +352,97 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-cluster-mergeable</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-mock</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-router-script</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-router-mesh</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-router-condition</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-router-tag</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-loadbalance-adaptive</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-access-log</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-tps</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-token</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-generic-invoke</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-context</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-classloader-filter</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-proxy-bytebuddy</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-qos-trace</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- registry -->
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
|
|
@ -395,6 +501,11 @@
|
|||
<artifactId>dubbo-remoting-netty4</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-zookeeper-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-zookeeper</artifactId>
|
||||
|
|
|
|||
|
|
@ -49,6 +49,11 @@
|
|||
<artifactId>dubbo-metadata-api</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-plugin-router-mesh</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>kubernetes-client</artifactId>
|
||||
|
|
|
|||
|
|
@ -45,27 +45,6 @@
|
|||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JAX-RS API -->
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>javax.ws.rs-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Web MVC -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Web MVC -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-metrics-api</artifactId>
|
||||
|
|
|
|||
|
|
@ -14,24 +14,24 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.dubbo.metadata;
|
||||
|
||||
import org.apache.dubbo.metadata.rest.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* DemoService
|
||||
*/
|
||||
public interface DemoService {
|
||||
|
||||
String sayName(String name);
|
||||
|
||||
void throwRuntimeException() throws RuntimeException;
|
||||
|
||||
List<User> getUsers(List<User> users);
|
||||
|
||||
int echo(int i);
|
||||
|
||||
}
|
||||
//package org.apache.dubbo.metadata;
|
||||
//
|
||||
//import org.apache.dubbo.metadata.rest.User;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * DemoService
|
||||
// */
|
||||
//public interface DemoService {
|
||||
//
|
||||
// String sayName(String name);
|
||||
//
|
||||
// void throwRuntimeException() throws RuntimeException;
|
||||
//
|
||||
// List<User> getUsers(List<User> users);
|
||||
//
|
||||
// int echo(int i);
|
||||
//
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-metadata-api</artifactId>
|
||||
<artifactId>dubbo-metadata-rest</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
-->
|
||||
<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">
|
||||
<parent>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-metadata</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>dubbo-metadata-rest</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>dubbo-metadata-rest</name>
|
||||
<description>The rest metadata module of Dubbo project</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-metadata-api</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JAX-RS API -->
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>javax.ws.rs-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Web MVC -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Web MVC -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -29,6 +29,7 @@
|
|||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>dubbo-metadata-api</module>
|
||||
<module>dubbo-metadata-rest</module>
|
||||
<module>dubbo-metadata-definition-protobuf</module>
|
||||
<module>dubbo-metadata-processor</module>
|
||||
<module>dubbo-metadata-report-zookeeper</module>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
observationsender=org.apache.dubbo.rpc.cluster.filter.support.ObservationSenderFilter
|
||||
metricsClusterFilter=org.apache.dubbo.rpc.cluster.filter.support.MetricsClusterFilter
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue