Search in sources :

Example 1 with RestOperationMeta

use of org.apache.servicecomb.common.rest.definition.RestOperationMeta in project incubator-servicecomb-java-chassis by apache.

the class ServicePathManager method addProducerPaths.

private void addProducerPaths(String urlPrefix, Collection<RestOperationMeta> restOperationMetas) {
    for (RestOperationMeta swaggerRestOperation : restOperationMetas) {
        RestOperationMeta producerRestOperation = swaggerRestOperation;
        if (!swaggerRestOperation.getAbsolutePath().startsWith(urlPrefix)) {
            producerRestOperation = new RestOperationMeta();
            producerRestOperation.init(swaggerRestOperation.getOperationMeta());
            producerRestOperation.setAbsolutePath(urlPrefix + swaggerRestOperation.getAbsolutePath());
        }
        producerPaths.addResource(producerRestOperation);
    }
}
Also used : RestOperationMeta(org.apache.servicecomb.common.rest.definition.RestOperationMeta)

Example 2 with RestOperationMeta

use of org.apache.servicecomb.common.rest.definition.RestOperationMeta in project incubator-servicecomb-java-chassis by apache.

the class TestMicroservicePaths method testAddResourceStaticNewGroup.

@Test
public void testAddResourceStaticNewGroup() {
    RestOperationMeta staticRes = UnitTestRestUtils.createRestOperationMeta("POST", "/static");
    MicroservicePaths paths = new MicroservicePaths();
    paths.addResource(staticRes);
    Assert.assertSame(staticRes, paths.getStaticPathOperationMap().get("/static").findValue("POST"));
}
Also used : RestOperationMeta(org.apache.servicecomb.common.rest.definition.RestOperationMeta) Test(org.junit.Test)

Example 3 with RestOperationMeta

use of org.apache.servicecomb.common.rest.definition.RestOperationMeta in project incubator-servicecomb-java-chassis by apache.

the class TestMicroservicePaths method testCloneTo.

@Test
public void testCloneTo() {
    RestOperationMeta staticRes = UnitTestRestUtils.createRestOperationMeta("POST", "/static");
    RestOperationMeta dynamicRes = UnitTestRestUtils.createRestOperationMeta("POST", "/dynamic/{id}");
    MicroservicePaths paths = new MicroservicePaths();
    paths.addResource(staticRes);
    paths.addResource(dynamicRes);
    MicroservicePaths other = new MicroservicePaths();
    paths.cloneTo(other);
    Assert.assertEquals(paths.getStaticPathOperationMap(), other.getStaticPathOperationMap());
    Assert.assertEquals(paths.getDynamicPathOperationList(), other.getDynamicPathOperationList());
}
Also used : RestOperationMeta(org.apache.servicecomb.common.rest.definition.RestOperationMeta) Test(org.junit.Test)

Example 4 with RestOperationMeta

use of org.apache.servicecomb.common.rest.definition.RestOperationMeta in project incubator-servicecomb-java-chassis by apache.

the class TestOperationLocator method testLocateStaticFound.

@Test
public void testLocateStaticFound() {
    RestOperationMeta rom = addRestOperationMeta("GET", "/static");
    locator.locate("ms", "/static", "GET", paths);
    Assert.assertSame(rom, locator.getOperation());
}
Also used : RestOperationMeta(org.apache.servicecomb.common.rest.definition.RestOperationMeta) Test(org.junit.Test)

Example 5 with RestOperationMeta

use of org.apache.servicecomb.common.rest.definition.RestOperationMeta in project incubator-servicecomb-java-chassis by apache.

the class TestOperationLocator method addRestOperationMeta.

private RestOperationMeta addRestOperationMeta(String httpMethod, String path) {
    RestOperationMeta rom = UnitTestRestUtils.createRestOperationMeta(httpMethod, path);
    paths.addResource(rom);
    return rom;
}
Also used : RestOperationMeta(org.apache.servicecomb.common.rest.definition.RestOperationMeta)

Aggregations

RestOperationMeta (org.apache.servicecomb.common.rest.definition.RestOperationMeta)43 OperationMeta (org.apache.servicecomb.core.definition.OperationMeta)19 Test (org.junit.Test)18 Invocation (org.apache.servicecomb.core.Invocation)5 Response (org.apache.servicecomb.swagger.invocation.Response)5 CommonExceptionData (org.apache.servicecomb.swagger.invocation.exception.CommonExceptionData)5 InvocationException (org.apache.servicecomb.swagger.invocation.exception.InvocationException)5 HttpClientRequest (io.vertx.core.http.HttpClientRequest)4 RestClientRequestImpl (org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl)4 ProduceProcessor (org.apache.servicecomb.common.rest.codec.produce.ProduceProcessor)4 Endpoint (org.apache.servicecomb.core.Endpoint)4 URIEndpointObject (org.apache.servicecomb.foundation.common.net.URIEndpointObject)4 HttpClientWithContext (org.apache.servicecomb.foundation.vertx.client.http.HttpClientWithContext)4 AsyncResponse (org.apache.servicecomb.swagger.invocation.AsyncResponse)4 HttpClientResponse (io.vertx.core.http.HttpClientResponse)3 HttpMethod (io.vertx.core.http.HttpMethod)3 HashMap (java.util.HashMap)3 MockUp (mockit.MockUp)3 URLPathBuilder (org.apache.servicecomb.common.rest.definition.path.URLPathBuilder)3 InvocationStageTrace (org.apache.servicecomb.core.invocation.InvocationStageTrace)3