Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.7.8 service introspection #6366

Merged
merged 41 commits into from
Jun 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f608b21
Polish apache/dubbo#6296 : Adding the new methods into MetadataReport…
mercyblitz Jun 10, 2020
4e3c691
Polish apache/dubbo#6296 : Adding the new methods into MetadataReport…
mercyblitz Jun 10, 2020
e30a547
Polish apache/dubbo#6171 : [Feature] Introducing the composite implem…
mercyblitz Jun 10, 2020
351b439
Merge branch '2.7.8-dev' into 2.7.8-service-introspection
mercyblitz Jun 10, 2020
450c7cd
Revert "fix wrong check of InvokerListener when export a service (fix…
mercyblitz Jun 10, 2020
c39eeb5
Revert "fix wrong check of InvokerListener when export a service (fix…
mercyblitz Jun 10, 2020
e400898
Merge branch 'master' of github.com:apache/dubbo
mercyblitz Jun 10, 2020
0743042
Revert the MetadataReport
mercyblitz Jun 10, 2020
b48d7d6
Polish apache/dubbo#6305 : [Refactor] ServiceConfig and ReferenceConf…
mercyblitz Jun 11, 2020
6172dd9
Merge remote-tracking branch 'origin/2.7.8-service-introspection' int…
mercyblitz Jun 11, 2020
60c441d
Merge remote-tracking branch 'upstream/master' into 2.7.8-service-int…
mercyblitz Jun 11, 2020
38e0d33
Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#p…
mercyblitz Jun 11, 2020
a52ec0f
Polish apache/dubbo#6310 : Refactoring MetadataReport's methods
mercyblitz Jun 11, 2020
e2b9b56
Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#p…
mercyblitz Jun 11, 2020
ab03f26
Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#p…
mercyblitz Jun 11, 2020
55b95a7
Polish apache/dubbo#6315 : [Refactor] Refactoring the implementation …
mercyblitz Jun 12, 2020
454cea6
Polish apache/dubbo#6315 : Refactoring by TreePathDynamicConfiguration
mercyblitz Jun 12, 2020
2bdb538
Polish apache/dubbo#6315 : Refactoring ConsulDynamicConfiguration by …
mercyblitz Jun 12, 2020
2c92015
Polish apache/dubbo#6315 : Reset the config base path to be "metadata…
mercyblitz Jun 12, 2020
2fbc068
Polish apache/dubbo#6315 : Bugfix
mercyblitz Jun 12, 2020
ddc4cb7
Polish apache/dubbo#6315 : Bugfix
mercyblitz Jun 12, 2020
8a6a6bf
Merge remote-tracking branch 'upstream/2.7.8-dev' into 2.7.8-service-…
mercyblitz Jun 15, 2020
0154426
Merge remote-tracking branch 'upstream/2.7.8-dev' into 2.7.8-service-…
mercyblitz Jun 15, 2020
eba44fa
Polish apache/dubbo#6315 : Correct words
mercyblitz Jun 15, 2020
c546f3c
Polish apache/dubbo#6333 : [Refactor] Using mandatory implementation …
mercyblitz Jun 16, 2020
05e5c4f
Polish apache/dubbo#6336 : [Refactor] org.apache.dubbo.metadata.Servi…
mercyblitz Jun 17, 2020
719bad7
Merge remote-tracking branch 'upstream/2.7.8-dev' into 2.7.8-service-…
mercyblitz Jun 17, 2020
cac3c0d
Polish apache/dubbo#6170 : [Feature] Introducing the externalized con…
mercyblitz Jun 17, 2020
e72a3be
Polish apache/dubbo#6342 : [Enhancement] Introducing the composite Se…
mercyblitz Jun 18, 2020
64b474c
Refactor
mercyblitz Jun 18, 2020
36e21ca
Polish apache/dubbo#6172 : [Feature] Adding the "services" attribute …
mercyblitz Jun 19, 2020
7b03172
Polish apache/dubbo#6173 : [Feature] Adding the "services" attribute …
mercyblitz Jun 19, 2020
1b12937
Polish apache/dubbo#6346 : [Issue] Merging all subscribied URLs from …
mercyblitz Jun 19, 2020
77c82d4
Polish apache/dubbo#6346 : [Issue] Merging all subscribied URLs from …
mercyblitz Jun 19, 2020
e528d75
Polish apache/dubbo#6252
mercyblitz Jun 22, 2020
f4a02de
Polish apache/dubbo#6356 & apache/dubbo#6171
mercyblitz Jun 23, 2020
3be5aa2
Polish apache/dubbo#6356 & apache/dubbo#6171
mercyblitz Jun 23, 2020
0014485
Polish apache/dubbo#6224 : Filter chain was not invoked with local ca…
mercyblitz Jun 23, 2020
6f78b4d
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 23, 2020
74777d8
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 24, 2020
cd974c4
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 24, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public abstract class AbstractDynamicConfigurationFactory implements DynamicConf

@Override
public final DynamicConfiguration getDynamicConfiguration(URL url) {
String key = url == null ? DEFAULT_KEY : url.getAddress();
String key = url == null ? DEFAULT_KEY : url.toServiceString();
return dynamicConfigurations.computeIfAbsent(key, k -> createDynamicConfiguration(url));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.dubbo.common.URL;

import java.net.NetworkInterface;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.regex.Pattern;

Expand All @@ -44,6 +45,11 @@ public interface CommonConstants {

String ANY_VALUE = "*";

/**
* @since 2.7.8
*/
char COMMA_SEPARATOR_CHAR = ',';

String COMMA_SEPARATOR = ",";

String DOT_SEPARATOR = ".";
Expand Down Expand Up @@ -187,6 +193,14 @@ public interface CommonConstants {

String REMOTE_METADATA_STORAGE_TYPE = "remote";

/**
* The composite metadata storage type includes {@link #DEFAULT_METADATA_STORAGE_TYPE "local"} and
* {@link #REMOTE_METADATA_STORAGE_TYPE "remote"}.
*
* @since 2.7.8
*/
String COMPOSITE_METADATA_STORAGE_TYPE = "composite";

/**
* Consumer side 's proxy class
*/
Expand Down Expand Up @@ -314,4 +328,19 @@ public interface CommonConstants {

String SSL_ENABLED_KEY = "ssl-enabled";


/**
* The parameter key for the class path of the ServiceNameMapping {@link Properties} file
*
* @since 2.7.8
*/
String SERVICE_NAME_MAPPING_PROPERTIES_FILE_KEY = "service-name-mapping.properties-path";

/**
* The default class path of the ServiceNameMapping {@link Properties} file
*
* @since 2.7.8
*/
String DEFAULT_SERVICE_NAME_MAPPING_PROPERTIES_PATH = "META-INF/dubbo/service-name-mapping.properties";

}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public interface RegistryConstants {

/**
* The parameter key of the subscribed service names for Service-Oriented Registry
* <p>
* If there is a multiple-values, the "comma" is the separator.
*
* @since 2.7.5
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ static String normalize(String path) {
if (index > -1) {
normalizedPath = normalizedPath.substring(0, index);
}
return replace(normalizedPath, "//", "/");

while (normalizedPath.contains("//")) {
normalizedPath = replace(normalizedPath, "//", "/");
}

return normalizedPath;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static java.lang.String.valueOf;
import static java.util.Collections.emptySet;
import static java.util.Collections.unmodifiableSet;
import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SEPARATOR;
import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SPLIT_PATTERN;
import static org.apache.dubbo.common.constants.CommonConstants.DOT_REGEX;
Expand Down Expand Up @@ -699,6 +703,45 @@ public static List<String> splitToList(String str, char ch) {
return splitToList0(str, ch);
}

/**
* Split the specified value to be a {@link Set}
*
* @param value the content to be split
* @param separatorChar a char to separate
* @return non-null read-only {@link Set}
* @since 2.7.8
*/
public static Set<String> splitToSet(String value, char separatorChar) {
return splitToSet(value, separatorChar, false);
}

/**
* Split the specified value to be a {@link Set}
*
* @param value the content to be split
* @param separatorChar a char to separate
* @param trimElements require to trim the elements or not
* @return non-null read-only {@link Set}
* @since 2.7.8
*/
public static Set<String> splitToSet(String value, char separatorChar, boolean trimElements) {
List<String> values = splitToList(value, separatorChar);
int size = values.size();

if (size < 1) { // empty condition
return emptySet();
}

if (!trimElements) { // Do not require to trim the elements
return new LinkedHashSet(values);
}

return unmodifiableSet(values
.stream()
.map(String::trim)
.collect(LinkedHashSet::new, Set::add, Set::addAll));
}

/**
* join string.
*
Expand Down Expand Up @@ -797,7 +840,7 @@ private static Map<String, String> parseKeyValuePair(String str, String itemSepa
}

public static String getQueryStringValue(String qs, String key) {
Map<String, String> map = StringUtils.parseQueryString(qs);
Map<String, String> map = parseQueryString(qs);
return map.get(key);
}

Expand Down Expand Up @@ -1051,4 +1094,16 @@ public static byte decodeHexByte(CharSequence s, int pos) {
return (byte) ((hi << 4) + lo);
}

/**
* Create the common-delimited {@link String} by one or more {@link String} members
*
* @param one one {@link String}
* @param others others {@link String}
* @return <code>null</code> if <code>one</code> or <code>others</code> is <code>null</code>
* @since 2.7.8
*/
public static String toCommaDelimitedString(String one, String... others) {
String another = arrayToDelimitedString(others, COMMA_SEPARATOR);
return isEmpty(another) ? one : one + COMMA_SEPARATOR + another;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.apache.dubbo.config.annotation;

import org.apache.dubbo.common.constants.RegistryConstants;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down Expand Up @@ -279,4 +281,11 @@
* @since 2.7.3
*/
String id() default "";

/**
* @return The service names that the Dubbo interface subscribed
* @see RegistryConstants#SUBSCRIBED_SERVICE_NAMES_KEY
* @since 2.7.8
*/
String[] services() default {};
}
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,15 @@ public void clear() {
});
}

/**
* @throws IllegalStateException
* @since 2.7.8
*/
@Override
public void destroy() throws IllegalStateException {
clear();
}

/**
* Add the dubbo {@link AbstractConfig config}
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,28 @@

import org.junit.jupiter.api.Test;

import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY;
import static org.apache.dubbo.common.utils.StringUtils.toCommaDelimitedString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isEmptyOrNullString;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class StringUtilsTest {
@Test
Expand Down Expand Up @@ -363,4 +372,25 @@ public void testParseParameters() {
assertEquals(0, illegalMap.size());
}

@Test
public void testToCommaDelimitedString() {
String value = toCommaDelimitedString(null);
assertNull(value);

value = toCommaDelimitedString(null, null);
assertNull(value);

value = toCommaDelimitedString("");
assertEquals("", value);

value = toCommaDelimitedString("one");
assertEquals("one", value);

value = toCommaDelimitedString("one", "two");
assertEquals("one,two", value);

value = toCommaDelimitedString("one", "two", "three");
assertEquals("one,two,three", value);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class ConfigManagerTest {

@BeforeEach
public void init() {
configManager.clear();
configManager.destroy();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void onEvent(Event event) {

@Override
public int getPriority() {
return 0;
return -1;
}

public int getEventOccurs() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public class ConfigTest {

@AfterEach
public void tearDown() {
ApplicationModel.getConfigManager().clear();
ApplicationModel.reset();
}

@BeforeEach
public void setup() {
// In IDE env, make sure adding the following argument to VM options
System.setProperty("java.net.preferIPv4Stack", "true");
ApplicationModel.getConfigManager().clear();
ApplicationModel.reset();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public class ReferenceConfigTest {

@BeforeEach
public void setUp() {
ApplicationModel.getConfigManager().clear();
ApplicationModel.reset();
}

@AfterEach
public void tearDown() {
ApplicationModel.getConfigManager().clear();
ApplicationModel.reset();
}

@Test
Expand Down
24 changes: 24 additions & 0 deletions dubbo-config/dubbo-config-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@
<artifactId>dubbo-registry-eureka</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -156,6 +162,12 @@
<artifactId>dubbo-metadata-report-zookeeper</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -170,6 +182,12 @@
<artifactId>dubbo-metadata-report-nacos</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -198,6 +216,12 @@
<artifactId>dubbo-configcenter-nacos</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
Loading