Skip to content

Commit

Permalink
Merge remote-tracking branch 'apache/master' into 2.7.11-release
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbumenJ committed May 6, 2021
2 parents 5f161b0 + f29663b commit 30616ea
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import static org.apache.dubbo.rpc.Constants.LOCAL_PROTOCOL;
import static org.apache.dubbo.rpc.Constants.SCOPE_REMOTE;

public class ReferenceConfigTest {
private TestingServer zkServer;
Expand All @@ -52,6 +54,7 @@ public void tearDown() throws Exception {
}

@Test
@Disabled("Disabled due to Github Actions environment")
public void testInjvm() throws Exception {
ApplicationConfig application = new ApplicationConfig();
application.setName("test-protocol-random-port");
Expand All @@ -60,7 +63,7 @@ public void testInjvm() throws Exception {
registry.setAddress(registryUrl);

ProtocolConfig protocol = new ProtocolConfig();
protocol.setName("mockprotocol");
protocol.setName("dubbo");

ServiceConfig<DemoService> demoService;
demoService = new ServiceConfig<DemoService>();
Expand All @@ -74,7 +77,7 @@ public void testInjvm() throws Exception {
rc.setApplication(application);
rc.setRegistry(registry);
rc.setInterface(DemoService.class.getName());
rc.setInjvm(false);
rc.setScope(SCOPE_REMOTE);

try {
System.setProperty("java.net.preferIPv4Stack", "true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.apache.dubbo.metadata.definition.model.ServiceDefinition;
import org.apache.dubbo.rpc.model.ApplicationModel;

import com.google.gson.Gson;
import com.alibaba.fastjson.JSON;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -82,7 +82,7 @@ public void testOnServiceConfigExportedEvent() {

ServiceDefinition serviceDefinitionBuild = ServiceDefinitionBuilder.build(serviceConfig.getInterfaceClass());

assertEquals(serviceDefinition, new Gson().toJson(serviceDefinitionBuild));
assertEquals(serviceDefinition, JSON.toJSONString(serviceDefinitionBuild));
serviceConfig.unexport();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.dubbo.metadata.report.identifier.ServiceMetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.SubscriberMetadataIdentifier;

import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

Expand Down Expand Up @@ -252,8 +253,7 @@ private void storeProviderMetadataTask(MetadataIdentifier providerMetadataIdenti
}
allMetadataReports.put(providerMetadataIdentifier, serviceDefinition);
failedReports.remove(providerMetadataIdentifier);
Gson gson = new Gson();
String data = gson.toJson(serviceDefinition);
String data = JSON.toJSONString(serviceDefinition);
doStoreProviderMetadata(providerMetadataIdentifier, data);
saveProperties(providerMetadataIdentifier, data, true, !syncReport);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.apache.dubbo.metadata.WritableMetadataService;
import org.apache.dubbo.metadata.definition.model.ServiceDefinition;

import com.google.gson.Gson;
import com.alibaba.fastjson.JSON;

import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.PID_KEY;
Expand Down Expand Up @@ -78,8 +78,7 @@ protected String getServiceDefinition(URL exportedURL) {
if (StringUtils.isNotEmpty(interfaceName) && !isGeneric(exportedURL.getParameter(GENERIC_KEY))) {
Class interfaceClass = forName(interfaceName);
ServiceDefinition serviceDefinition = buildFullDefinition(interfaceClass, exportedURL.getParameters());
Gson gson = new Gson();
json = gson.toJson(serviceDefinition);
json = JSON.toJSONString(serviceDefinition);
}
} catch (ClassNotFoundException e) {
//ignore error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.apache.dubbo.rpc.model.ApplicationModel;
import org.apache.dubbo.rpc.support.ProtocolUtils;

import com.google.gson.Gson;
import com.alibaba.fastjson.JSON;

import java.util.Comparator;
import java.util.Map;
Expand Down Expand Up @@ -172,8 +172,7 @@ public void publishServiceDefinition(URL providerUrl) {
if (StringUtils.isNotEmpty(interfaceName)) {
Class interfaceClass = Class.forName(interfaceName);
ServiceDefinition serviceDefinition = ServiceDefinitionBuilder.build(interfaceClass);
Gson gson = new Gson();
String data = gson.toJson(serviceDefinition);
String data = JSON.toJSONString(serviceDefinition);
serviceDefinitions.put(providerUrl.getServiceKey(), data);
return;
}
Expand Down

0 comments on commit 30616ea

Please sign in to comment.