use of io.servicecomb.core.Handler in project java-chassis by ServiceComb.
the class SchemaLoader method registerSchema.
public SchemaMeta registerSchema(MicroserviceMeta microserviceMeta, String schemaId, Swagger swagger) {
String microserviceName = microserviceMeta.getName();
LOGGER.info("register schema {}/{}/{}", microserviceMeta.getAppId(), microserviceName, schemaId);
SchemaMeta schemaMeta = new SchemaMeta(swagger, microserviceMeta, schemaId);
List<Handler> producerHandlerChain = ProducerHandlerManager.INSTANCE.getOrCreate(microserviceName);
schemaMeta.setProviderHandlerChain(producerHandlerChain);
List<Handler> consumerHandlerChain = ConsumerHandlerManager.INSTANCE.getOrCreate(microserviceName);
schemaMeta.setConsumerHandlerChain(consumerHandlerChain);
microserviceMeta.regSchemaMeta(schemaMeta);
putSelfBasePathIfAbsent(microserviceName, swagger.getBasePath());
return schemaMeta;
}
use of io.servicecomb.core.Handler in project java-chassis by ServiceComb.
the class UnitTestMeta method init.
@SuppressWarnings("unchecked")
public static synchronized void init() {
if (inited) {
return;
}
Config config = new Config();
Class<?> cls = SimpleLoadBalanceHandler.class;
config.getHandlerClassMap().put("simpleLB", (Class<Handler>) cls);
ProducerHandlerManager.INSTANCE.init(config);
ConsumerHandlerManager.INSTANCE.init(config);
ApplicationContext applicationContext = Mockito.mock(ApplicationContext.class);
BeanUtils.setContext(applicationContext);
inited = true;
}
Aggregations