use of org.apache.servicecomb.swagger.invocation.converter.ConverterMgr in project incubator-servicecomb-java-chassis by apache.
the class BootstrapNormal method boot.
public SwaggerEnvironment boot() {
SwaggerEnvironment env = new SwaggerEnvironment();
ConverterMgr converterMgr = new ConverterMgr();
ProducerArgumentsMapperFactory producerArgumentsFactory = new ProducerArgumentsMapperFactory();
producerArgumentsFactory.setFactoryList(Arrays.asList(new ProducerInvocationContextMapperFactory()));
producerArgumentsFactory.setConverterMgr(converterMgr);
env.setProducerArgumentsFactory(producerArgumentsFactory);
ConsumerArgumentsMapperFactory consumerArgumentsFactory = new ConsumerArgumentsMapperFactory();
consumerArgumentsFactory.setFactoryList(Arrays.asList(new ConsumerInvocationContextMapperFactory()));
consumerArgumentsFactory.setConverterMgr(converterMgr);
env.setConsumerArgumentsFactory(consumerArgumentsFactory);
env.setConverterMgr(converterMgr);
return env;
}
use of org.apache.servicecomb.swagger.invocation.converter.ConverterMgr in project incubator-servicecomb-java-chassis by apache.
the class TestProducerSchemaFactory method init.
@BeforeClass
public static void init() {
ServiceRegistry serviceRegistry = ServiceRegistryFactory.createLocal();
RegistryUtils.setServiceRegistry(serviceRegistry);
ConverterMgr converterMgr = new ConverterMgr();
ProducerArgumentsMapperFactory producerArgsMapperFactory = new ProducerArgumentsMapperFactory();
producerArgsMapperFactory.setConverterMgr(converterMgr);
MicroserviceMetaManager microserviceMetaManager = new MicroserviceMetaManager();
SchemaLoader schemaLoader = new SchemaLoader() {
@Override
public void putSelfBasePathIfAbsent(String microserviceName, String basePath) {
}
};
CompositeSwaggerGeneratorContext compositeSwaggerGeneratorContext = new CompositeSwaggerGeneratorContext();
producerSchemaFactory.setSwaggerEnv(swaggerEnv);
ReflectUtils.setField(producerSchemaFactory, "microserviceMetaManager", microserviceMetaManager);
ReflectUtils.setField(producerSchemaFactory, "schemaLoader", schemaLoader);
ReflectUtils.setField(producerSchemaFactory, "compositeSwaggerGeneratorContext", compositeSwaggerGeneratorContext);
Executor reactiveExecutor = new ReactiveExecutor();
Executor normalExecutor = (cmd) -> {
};
new MockUp<BeanUtils>() {
@SuppressWarnings("unchecked")
@Mock
<T> T getBean(String name) {
if (ExecutorManager.EXECUTOR_REACTIVE.equals(name)) {
return (T) reactiveExecutor;
}
return (T) normalExecutor;
}
};
// ApplicationContext applicationContext = Mockito.mock(ApplicationContext.class);
// BeanUtils.setContext(applicationContext);
// Mockito.when(applicationContext.getBean(ExecutorManager.EXECUTOR_REACTIVE)).thenReturn(new ReactiveExecutor());
UnitTestMeta.init();
schemaMeta = producerSchemaFactory.getOrCreateProducerSchema("app:ms", "schema", TestProducerSchemaFactoryImpl.class, new TestProducerSchemaFactoryImpl());
}
Aggregations