use of io.servicecomb.core.definition.OperationMeta in project java-chassis by ServiceComb.
the class TestLocator method createRestOperatonMeta.
protected RestOperationMeta createRestOperatonMeta(String httpMethod, String path) {
OperationMeta om = new OperationMeta();
om.setHttpMethod(httpMethod);
RestOperationMeta rom = new RestOperationMeta();
rom.setOperationMeta(om);
rom.setAbsolutePath(path);
return rom;
}
use of io.servicecomb.core.definition.OperationMeta in project java-chassis by ServiceComb.
the class ConsumerSchemaFactory method mapSameIntfParameters.
protected void mapSameIntfParameters(ConsumerSchemaContext context) {
for (OperationMeta operationMeta : context.getSchemaMeta().getOperations()) {
List<ArgumentMapper> consumerArgMapperList = new ArrayList<>();
int swaggerParameterCount = operationMeta.getSwaggerOperation().getParameters().size();
for (int idx = 0; idx < swaggerParameterCount; idx++) {
ConsumerArgumentSame argMapper = new ConsumerArgumentSame(idx, idx);
consumerArgMapperList.add(argMapper);
}
ConsumerArgumentsMapper argsMapper = new ConsumerArgumentsMapper(consumerArgMapperList, swaggerParameterCount);
createOperation(context, operationMeta, argsMapper);
}
}
use of io.servicecomb.core.definition.OperationMeta in project java-chassis by ServiceComb.
the class ProducerSchemaFactory method connectToProvider.
@Override
protected void connectToProvider(ProducerSchemaContext context) {
if (context.getGenerator() == null) {
generateSwagger(context);
}
// 建立契约与producer之间的参数映射关系
Class<?> swaggerIntf = ClassUtils.getJavaInterface(context.getSchemaMeta().getSwagger());
for (OperationMeta operationMeta : context.getSchemaMeta().getOperations()) {
OperationGenerator operationGenerator = context.getGenerator().getOperationGeneratorMap().get(operationMeta.getOperationId());
Method swaggerMethod = ReflectUtils.findMethod(swaggerIntf, operationMeta.getOperationId());
List<Parameter> swaggerParameters = operationMeta.getSwaggerOperation().getParameters();
Method producerMethod = operationGenerator.getProviderMethod();
List<Parameter> producerParameters = operationGenerator.getProviderParameters();
ProducerArgumentsMapper argsMapper = producerArgsMapperFactory.createArgumentsMapper(context.getSchemaMeta().getSwagger(), swaggerMethod, swaggerParameters, producerMethod, producerParameters);
createOperation(context, operationMeta, argsMapper);
}
}
use of io.servicecomb.core.definition.OperationMeta in project java-chassis by ServiceComb.
the class InvocationFactory method forConsumer.
public static Invocation forConsumer(ReferenceConfig referenceConfig, SchemaMeta schemaMeta, String operationName, Object[] swaggerArguments) {
OperationMeta operationMeta = schemaMeta.ensureFindOperation(operationName);
Invocation invocation = new Invocation(referenceConfig, operationMeta, swaggerArguments);
invocation.addContext(Const.SRC_MICROSERVICE, microserviceName);
return invocation;
}
use of io.servicecomb.core.definition.OperationMeta in project java-chassis by ServiceComb.
the class MockUtil method mockAbstactRestServer.
public void mockAbstactRestServer() {
new MockUp<AbstractRestServer<HttpServletResponse>>() {
@Mock
protected RestOperationMeta findRestOperation(RestServerRequestInternal restRequest) {
RestOperationMeta restOperationMeta = Mockito.mock(RestOperationMeta.class);
OperationMeta operationMeta = Mockito.mock(OperationMeta.class);
Executor executor = Mockito.mock(Executor.class);
operationMeta.setExecutor(executor);
return restOperationMeta;
}
};
}
Aggregations