use of org.apache.dubbo.admin.model.domain.MethodMetadata in project incubator-dubbo-ops by apache.
the class ServiceTestV3Util method generateMethodMeta.
public static MethodMetadata generateMethodMeta(FullServiceDefinition serviceDefinition, MethodDefinition methodDefinition) {
MethodMetadata methodMetadata = new MethodMetadata();
String[] parameterTypes = methodDefinition.getParameterTypes();
String returnType = methodDefinition.getReturnType();
String signature = methodDefinition.getName() + "~" + String.join(";", parameterTypes);
methodMetadata.setSignature(signature);
methodMetadata.setReturnType(returnType);
List<Object> parameters = generateParameterTypes(parameterTypes, serviceDefinition);
methodMetadata.setParameterTypes(parameters);
return methodMetadata;
}
use of org.apache.dubbo.admin.model.domain.MethodMetadata in project incubator-dubbo-ops by apache.
the class ServiceTestController method methodDetail.
@RequestMapping(value = "/method", method = RequestMethod.GET)
public MethodMetadata methodDetail(@PathVariable String env, @RequestParam String application, @RequestParam String service, @RequestParam String method) {
Map<String, String> info = ConvertUtil.serviceName2Map(service);
MetadataIdentifier identifier = new MetadataIdentifier(info.get(Constants.INTERFACE_KEY), info.get(Constants.VERSION_KEY), info.get(Constants.GROUP_KEY), Constants.PROVIDER_SIDE, application);
String metadata = providerService.getProviderMetaData(identifier);
MethodMetadata methodMetadata = null;
if (metadata != null) {
Gson gson = new Gson();
String release = providerService.findVersionInApplication(application);
if (release.startsWith("2.")) {
org.apache.dubbo.admin.model.domain.FullServiceDefinition serviceDefinition = gson.fromJson(metadata, org.apache.dubbo.admin.model.domain.FullServiceDefinition.class);
List<org.apache.dubbo.admin.model.domain.MethodDefinition> methods = serviceDefinition.getMethods();
if (methods != null) {
for (org.apache.dubbo.admin.model.domain.MethodDefinition m : methods) {
if (ServiceTestUtil.sameMethod(m, method)) {
methodMetadata = ServiceTestUtil.generateMethodMeta(serviceDefinition, m);
break;
}
}
}
} else {
FullServiceDefinition serviceDefinition = gson.fromJson(metadata, FullServiceDefinition.class);
List<MethodDefinition> methods = serviceDefinition.getMethods();
if (methods != null) {
for (MethodDefinition m : methods) {
if (ServiceTestV3Util.sameMethod(m, method)) {
methodMetadata = ServiceTestV3Util.generateMethodMeta(serviceDefinition, m);
break;
}
}
}
}
}
return methodMetadata;
}
use of org.apache.dubbo.admin.model.domain.MethodMetadata in project incubator-dubbo-ops by apache.
the class ServiceTestUtil method generateMethodMeta.
public static MethodMetadata generateMethodMeta(FullServiceDefinition serviceDefinition, MethodDefinition methodDefinition) {
MethodMetadata methodMetadata = new MethodMetadata();
String[] parameterTypes = methodDefinition.getParameterTypes();
String returnType = methodDefinition.getReturnType();
String signature = methodDefinition.getName() + "~" + String.join(";", parameterTypes);
methodMetadata.setSignature(signature);
methodMetadata.setReturnType(returnType);
List<Object> parameters = generateParameterTypes(parameterTypes, serviceDefinition);
methodMetadata.setParameterTypes(parameters);
return methodMetadata;
}
Aggregations