Search in sources :

Example 1 with Handler

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;
}
Also used : SchemaMeta(io.servicecomb.core.definition.SchemaMeta) Handler(io.servicecomb.core.Handler)

Example 2 with Handler

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;
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) SimpleLoadBalanceHandler(io.servicecomb.core.handler.impl.SimpleLoadBalanceHandler) Config(io.servicecomb.core.handler.config.Config) SimpleLoadBalanceHandler(io.servicecomb.core.handler.impl.SimpleLoadBalanceHandler) Handler(io.servicecomb.core.Handler)

Aggregations

Handler (io.servicecomb.core.Handler)2 SchemaMeta (io.servicecomb.core.definition.SchemaMeta)1 Config (io.servicecomb.core.handler.config.Config)1 SimpleLoadBalanceHandler (io.servicecomb.core.handler.impl.SimpleLoadBalanceHandler)1 ApplicationContext (org.springframework.context.ApplicationContext)1