可测试

This commit is contained in:
huangsimin 2019-07-09 13:45:43 +08:00
parent 01a175cfaa
commit 08b920ed19
2 changed files with 7 additions and 26 deletions

View File

@ -24,8 +24,4 @@ public class GenericServicePool {
public void put(String key, GenericService genericService) {
gsDictionary.put(key, genericService);
}
// public boolean contains(String key) {
// return gsDictionary.containsKey(key);
// }
}

View File

@ -75,20 +75,6 @@ public class ConfigGateway implements RouteDefinitionLocator {
Map<String, Object> configYaml = new Yaml().load((InputStream) inputStream);
if (configYaml != null) {
// streaming-media-types 这个先不管
// NettyWriteResponseFilter nwrf =
// applicationContext.getBean(NettyWriteResponseFilter.class);
// try {
// Field field = nwrf.getClass().getDeclaredField("streamingMediaTypes");
// field.setAccessible(true);
// List<MediaType> mts = new ArrayList<MediaType>();
// mts.add(MediaType.TEXT_EVENT_STREAM);
// mts.add(MediaType.APPLICATION_STREAM_JSON);
// field.set(nwrf, mts);
// } catch (Exception e) {
// log.error(e.toString());
// }
Map<String, Object> defaultYaml = (Map<String, Object>) configYaml.get("restful");
Map<String, Object> dubboYaml = (Map<String, Object>) configYaml.get("dubbo");
@ -111,7 +97,6 @@ public class ConfigGateway implements RouteDefinitionLocator {
}
return Flux.empty();
// return Flux.fromIterable(it);
}
@ -223,6 +208,7 @@ public class ConfigGateway implements RouteDefinitionLocator {
}
}
@SuppressWarnings("unchecked")
private String parseDubboUriAndSetBase(RouteDefinition rd, LinkedHashMap<String, List<String>> iter) {
// 设置id
Object id = iter.get("id");
@ -252,13 +238,6 @@ public class ConfigGateway implements RouteDefinitionLocator {
}
iter.remove("order");
if (uri != null) {
String uriString = (String) uri;
uriString = uriString.trim();
if (uriString.startsWith("dubbo://")) { // dubbo://127.0.0.1/interface?
return uriString;
}
}
ReferenceConfig<GenericService> reference = new ReferenceConfig<GenericService>();
reference.setConnections(3);
@ -273,6 +252,7 @@ public class ConfigGateway implements RouteDefinitionLocator {
}
iter.remove("application");
// 遍历所有dubbo配置的key, 如果不存在特殊处理的, 就直接反射到reference 默认方法上
for (Entry<String, List<String>> entry : iter.entrySet()) {
// Object group = iter.get("group");
String key = entry.getKey();
@ -297,6 +277,11 @@ public class ConfigGateway implements RouteDefinitionLocator {
}
}
// Object methods = iter.get("methods");
// if(methods == null || ((List<Object>)methods).size() == 0) {
// DubboGatewayFilterFactory.mehtods.put(name, params);
// }
UriString += Extract.getReferenceConfigKey(reference);
GenericServicePool gsPool = appContext.getBean(GenericServicePool.class);
reference.setGeneric(true);