fix docker file java_opts
fix application scope condition route
fix ci
Showing 3 of 6 files from the diff.
Other files ignored by Codecov
@@ -16,11 +16,13 @@
Loading
16 | 16 | */ |
|
17 | 17 | package org.apache.dubbo.admin.service.impl; |
|
18 | 18 | ||
19 | + | import org.apache.dubbo.admin.common.exception.ParamValidationException; |
|
19 | 20 | import org.apache.dubbo.admin.common.util.Constants; |
|
20 | 21 | import org.apache.dubbo.admin.common.util.SyncUtils; |
|
21 | 22 | import org.apache.dubbo.admin.model.domain.Consumer; |
|
22 | 23 | import org.apache.dubbo.admin.service.ConsumerService; |
|
23 | 24 | import org.apache.dubbo.common.URL; |
|
25 | + | import org.apache.dubbo.common.utils.StringUtils; |
|
24 | 26 | import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier; |
|
25 | 27 | import org.springframework.stereotype.Component; |
|
26 | 28 |
@@ -78,4 +80,18 @@
Loading
78 | 80 | return SyncUtils.filterFromCategory(getRegistryCache(), filter); |
|
79 | 81 | } |
|
80 | 82 | ||
83 | + | @Override |
|
84 | + | public String findVersionInApplication(String application) { |
|
85 | + | Map<String, String> filter = new HashMap<>(); |
|
86 | + | filter.put(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY); |
|
87 | + | filter.put(Constants.APPLICATION_KEY, application); |
|
88 | + | Map<String, URL> stringURLMap = SyncUtils.filterFromCategory(getRegistryCache(), filter); |
|
89 | + | if (stringURLMap == null || stringURLMap.isEmpty()) { |
|
90 | + | throw new ParamValidationException("there is no consumer for application: " + application); |
|
91 | + | } |
|
92 | + | String defaultVersion = "2.6"; |
|
93 | + | URL url = stringURLMap.values().iterator().next(); |
|
94 | + | String version = url.getParameter(Constants.SPECIFICATION_VERSION_KEY); |
|
95 | + | return StringUtils.isBlank(version) ? defaultVersion : version; |
|
96 | + | } |
|
81 | 97 | } |
@@ -23,7 +23,7 @@
Loading
23 | 23 | import org.apache.dubbo.admin.common.util.Constants; |
|
24 | 24 | import org.apache.dubbo.admin.model.dto.AccessDTO; |
|
25 | 25 | import org.apache.dubbo.admin.model.dto.ConditionRouteDTO; |
|
26 | - | import org.apache.dubbo.admin.service.ProviderService; |
|
26 | + | import org.apache.dubbo.admin.service.ConsumerService; |
|
27 | 27 | import org.apache.dubbo.admin.service.RouteService; |
|
28 | 28 | import org.apache.dubbo.common.logger.Logger; |
|
29 | 29 | import org.apache.dubbo.common.logger.LoggerFactory; |
@@ -50,12 +50,12 @@
Loading
50 | 50 | private static final Logger logger = LoggerFactory.getLogger(AccessesController.class); |
|
51 | 51 | ||
52 | 52 | private final RouteService routeService; |
|
53 | - | private final ProviderService providerService; |
|
53 | + | private final ConsumerService consumerService; |
|
54 | 54 | ||
55 | 55 | @Autowired |
|
56 | - | public AccessesController(RouteService routeService, ProviderService providerService) { |
|
56 | + | public AccessesController(RouteService routeService, ConsumerService consumerService) { |
|
57 | 57 | this.routeService = routeService; |
|
58 | - | this.providerService = providerService; |
|
58 | + | this.consumerService = consumerService; |
|
59 | 59 | } |
|
60 | 60 | ||
61 | 61 | @RequestMapping(method = RequestMethod.GET) |
@@ -99,7 +99,7 @@
Loading
99 | 99 | throw new ParamValidationException("Either Service or application is required."); |
|
100 | 100 | } |
|
101 | 101 | String application = accessDTO.getApplication(); |
|
102 | - | if (StringUtils.isNotEmpty(application) && "2.6".equals(providerService.findVersionInApplication(application))) { |
|
102 | + | if (StringUtils.isNotEmpty(application) && "2.6".equals(consumerService.findVersionInApplication(application))) { |
|
103 | 103 | throw new VersionValidationException("dubbo 2.6 does not support application scope blackwhite list config"); |
|
104 | 104 | } |
|
105 | 105 | if (accessDTO.getBlacklist() == null && accessDTO.getWhitelist() == null) { |
@@ -27,7 +27,7 @@
Loading
27 | 27 | import org.apache.dubbo.admin.common.util.ConvertUtil; |
|
28 | 28 | import org.apache.dubbo.admin.model.dto.ConditionRouteDTO; |
|
29 | 29 | import org.apache.dubbo.admin.model.dto.ConditionRouteResultDTO; |
|
30 | - | import org.apache.dubbo.admin.service.ProviderService; |
|
30 | + | import org.apache.dubbo.admin.service.ConsumerService; |
|
31 | 31 | import org.apache.dubbo.admin.service.RouteService; |
|
32 | 32 | import org.springframework.beans.factory.annotation.Autowired; |
|
33 | 33 | import org.springframework.http.HttpStatus; |
@@ -47,12 +47,12 @@
Loading
47 | 47 | public class ConditionRoutesController { |
|
48 | 48 | ||
49 | 49 | private final RouteService routeService; |
|
50 | - | private final ProviderService providerService; |
|
50 | + | private final ConsumerService consumerService; |
|
51 | 51 | ||
52 | 52 | @Autowired |
|
53 | - | public ConditionRoutesController(RouteService routeService, ProviderService providerService) { |
|
53 | + | public ConditionRoutesController(RouteService routeService, ConsumerService consumerService) { |
|
54 | 54 | this.routeService = routeService; |
|
55 | - | this.providerService = providerService; |
|
55 | + | this.consumerService = consumerService; |
|
56 | 56 | } |
|
57 | 57 | ||
58 | 58 | @RequestMapping(method = RequestMethod.POST) |
@@ -65,7 +65,7 @@
Loading
65 | 65 | if (StringUtils.isEmpty(serviceName) && StringUtils.isEmpty(app)) { |
|
66 | 66 | throw new ParamValidationException("serviceName and app is Empty!"); |
|
67 | 67 | } |
|
68 | - | if (StringUtils.isNotEmpty(app) && providerService.findVersionInApplication(app).equals("2.6")) { |
|
68 | + | if (StringUtils.isNotEmpty(app) && consumerService.findVersionInApplication(app).equals("2.6")) { |
|
69 | 69 | throw new VersionValidationException("dubbo 2.6 does not support application scope routing rule"); |
|
70 | 70 | } |
|
71 | 71 | routeService.createConditionRoute(routeDTO, serviceVersion, serviceGroup); |
Files | Complexity | Coverage |
---|---|---|
dubbo-admin-server/src/main/java/org/apache/dubbo/admin | 20.30% | 21.95% |
Project Totals (98 files) | 20.30% | 21.95% |
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.