Search in sources :

Example 26 with OperationMeta

use of org.apache.servicecomb.core.definition.OperationMeta in project incubator-servicecomb-java-chassis by apache.

the class InvocationFactory method forConsumer.

/*
   * 为tcc场景提供的快捷方式,consumer端使用
   */
public static Invocation forConsumer(ReferenceConfig referenceConfig, String operationQualifiedName, Object[] swaggerArguments) {
    MicroserviceMeta microserviceMeta = referenceConfig.getMicroserviceMeta();
    OperationMeta operationMeta = microserviceMeta.ensureFindOperation(operationQualifiedName);
    return forConsumer(referenceConfig, operationMeta, swaggerArguments);
}
Also used : MicroserviceMeta(org.apache.servicecomb.core.definition.MicroserviceMeta) OperationMeta(org.apache.servicecomb.core.definition.OperationMeta)

Example 27 with OperationMeta

use of org.apache.servicecomb.core.definition.OperationMeta in project incubator-servicecomb-java-chassis by apache.

the class ServicePathManager method addSchema.

public void addSchema(SchemaMeta schemaMeta) {
    if (isSchemaExists(schemaMeta.getSchemaId())) {
        return;
    }
    schemaIdSet.add(schemaMeta.getSchemaId());
    for (OperationMeta operationMeta : schemaMeta.getOperations()) {
        RestOperationMeta restOperationMeta = new RestOperationMeta();
        restOperationMeta.init(operationMeta);
        operationMeta.putExtData(RestConst.SWAGGER_REST_OPERATION, restOperationMeta);
        addResource(restOperationMeta);
    }
    LOGGER.info("add schema to service paths. {}:{}:{}.", schemaMeta.getMicroserviceMeta().getAppId(), schemaMeta.getMicroserviceName(), schemaMeta.getSchemaId());
}
Also used : RestOperationMeta(org.apache.servicecomb.common.rest.definition.RestOperationMeta) OperationMeta(org.apache.servicecomb.core.definition.OperationMeta) RestOperationMeta(org.apache.servicecomb.common.rest.definition.RestOperationMeta)

Example 28 with OperationMeta

use of org.apache.servicecomb.core.definition.OperationMeta in project incubator-servicecomb-java-chassis by apache.

the class UnitTestRestUtils method createRestOperationMeta.

public static RestOperationMeta createRestOperationMeta(String httpMethod, String path) {
    OperationMeta om = new OperationMeta();
    om.setHttpMethod(httpMethod);
    RestOperationMeta rom = new RestOperationMeta();
    rom.setOperationMeta(om);
    rom.setAbsolutePath(path);
    Deencapsulation.setField(rom, "produces", Arrays.asList(MediaType.APPLICATION_JSON));
    return rom;
}
Also used : OperationMeta(org.apache.servicecomb.core.definition.OperationMeta)

Example 29 with OperationMeta

use of org.apache.servicecomb.core.definition.OperationMeta in project incubator-servicecomb-java-chassis by apache.

the class ServerRestArgsFilter method afterReceiveRequest.

@Override
public Response afterReceiveRequest(Invocation invocation, HttpServletRequestEx requestEx) {
    OperationMeta operationMeta = invocation.getOperationMeta();
    RestOperationMeta restOperationMeta = operationMeta.getExtData(RestConst.SWAGGER_REST_OPERATION);
    Object[] args = RestCodec.restToArgs(requestEx, restOperationMeta);
    invocation.setSwaggerArguments(args);
    return null;
}
Also used : RestOperationMeta(org.apache.servicecomb.common.rest.definition.RestOperationMeta) OperationMeta(org.apache.servicecomb.core.definition.OperationMeta) RestOperationMeta(org.apache.servicecomb.common.rest.definition.RestOperationMeta)

Example 30 with OperationMeta

use of org.apache.servicecomb.core.definition.OperationMeta in project incubator-servicecomb-java-chassis by apache.

the class MockUtil method mockRequestMeta.

public void mockRequestMeta() {
    new MockUp<RequestMeta>() {

        @Mock
        public OperationMeta getOperationMeta() throws Exception {
            OperationMeta om = new OperationMeta();
            om.init(new SchemaMeta(null, new MicroserviceMeta("test"), null), this.getClass().getMethods()[0], "path", "get", null);
            return om;
        }
    };
}
Also used : SchemaMeta(org.apache.servicecomb.core.definition.SchemaMeta) MicroserviceMeta(org.apache.servicecomb.core.definition.MicroserviceMeta) MockUp(mockit.MockUp) OperationMeta(org.apache.servicecomb.core.definition.OperationMeta) RestOperationMeta(org.apache.servicecomb.common.rest.definition.RestOperationMeta)

Aggregations

OperationMeta (org.apache.servicecomb.core.definition.OperationMeta)33 Test (org.junit.Test)14 RestOperationMeta (org.apache.servicecomb.common.rest.definition.RestOperationMeta)12 Invocation (org.apache.servicecomb.core.Invocation)9 SchemaMeta (org.apache.servicecomb.core.definition.SchemaMeta)8 MockUp (mockit.MockUp)6 AsyncResponse (org.apache.servicecomb.swagger.invocation.AsyncResponse)6 Endpoint (org.apache.servicecomb.core.Endpoint)5 MicroserviceMeta (org.apache.servicecomb.core.definition.MicroserviceMeta)5 OperationProtobuf (org.apache.servicecomb.codec.protobuf.definition.OperationProtobuf)4 Response (org.apache.servicecomb.swagger.invocation.Response)4 HttpClientRequest (io.vertx.core.http.HttpClientRequest)3 Holder (javax.xml.ws.Holder)3 WrapSchema (org.apache.servicecomb.codec.protobuf.utils.WrapSchema)3 ProduceProcessor (org.apache.servicecomb.common.rest.codec.produce.ProduceProcessor)3 URLPathBuilder (org.apache.servicecomb.common.rest.definition.path.URLPathBuilder)3 ReactiveExecutor (org.apache.servicecomb.core.executor.ReactiveExecutor)3 URIEndpointObject (org.apache.servicecomb.foundation.common.net.URIEndpointObject)3 InvocationException (org.apache.servicecomb.swagger.invocation.exception.InvocationException)3 Buffer (io.vertx.core.buffer.Buffer)2