use of org.apache.servicecomb.core.definition.MicroserviceMeta in project incubator-servicecomb-java-chassis by apache.
the class TestServicePathManager method setup.
@Before
public void setup() {
BeanUtils.setContext(applicationContext);
MicroserviceMeta mm = new MicroserviceMeta("app:ms");
Swagger swagger = UnitTestSwaggerUtils.generateSwagger(TestServicePathManagerSchemaImpl.class).getSwagger();
Map<String, Path> paths = swagger.getPaths();
swagger.setBasePath("");
Path path = paths.remove("/static1");
paths.put("/root/rest/static1", path);
path = paths.remove("/dynamic1");
paths.put("/dynamic1/{id}", path);
path = paths.remove("/dynamic2");
paths.put("/dynamic2/{id}", path);
SchemaMeta schemaMeta = new SchemaMeta(swagger, mm, "sid");
spm = new ServicePathManager(mm);
spm.addSchema(schemaMeta);
spm.sortPath();
}
use of org.apache.servicecomb.core.definition.MicroserviceMeta in project incubator-servicecomb-java-chassis by apache.
the class SchemaListenerManager method notifySchemaListener.
public void notifySchemaListener(MicroserviceMeta... microserviceMetas) {
List<SchemaMeta> schemaMetaList = new ArrayList<>();
for (MicroserviceMeta microserviceMeta : microserviceMetas) {
schemaMetaList.addAll(microserviceMeta.getSchemaMetas());
}
notifySchemaListener(schemaMetaList.toArray(new SchemaMeta[schemaMetaList.size()]));
}
use of org.apache.servicecomb.core.definition.MicroserviceMeta 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;
}
};
}
use of org.apache.servicecomb.core.definition.MicroserviceMeta in project incubator-servicecomb-java-chassis by apache.
the class RestEngineSchemaListener method onBootEvent.
@Override
public void onBootEvent(BootEvent event) {
if (!event.getEventType().equals(EventType.BEFORE_REGISTRY)) {
return;
}
MicroserviceMeta microserviceMeta = microserviceMetaManager.getOrCreateMicroserviceMeta(RegistryUtils.getMicroservice());
ServicePathManager servicePathManager = ServicePathManager.getServicePathManager(microserviceMeta);
if (servicePathManager != null) {
servicePathManager.buildProducerPaths();
}
}
use of org.apache.servicecomb.core.definition.MicroserviceMeta in project incubator-servicecomb-java-chassis by apache.
the class RestProducerInvocation method findRestOperation.
protected void findRestOperation() {
String targetMicroserviceName = requestEx.getHeader(Const.TARGET_MICROSERVICE);
if (targetMicroserviceName == null) {
// for compatible
targetMicroserviceName = RegistryUtils.getMicroservice().getServiceName();
}
MicroserviceMeta selfMicroserviceMeta = CseContext.getInstance().getMicroserviceMetaManager().ensureFindValue(targetMicroserviceName);
findRestOperation(selfMicroserviceMeta);
}
Aggregations