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);
}
}
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"));
}
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());
}
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());
}
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;
}
Aggregations