Search in sources :

Example 1 with ProducerArgumentsMapperFactory

use of io.servicecomb.swagger.invocation.arguments.producer.ProducerArgumentsMapperFactory in project java-chassis by ServiceComb.

the class TestProducerSchemaFactory method init.

@BeforeClass
public static void init() {
    ProducerResponseMapperFactory responseMapperFactory = new ProducerResponseMapperFactory();
    responseMapperFactory.setMapperList(Arrays.asList(new ProducerResponseSame()));
    ProducerArgumentsMapperFactory producerArgsMapperFactory = new ProducerArgumentsMapperFactory();
    MicroserviceMetaManager microserviceMetaManager = new MicroserviceMetaManager();
    SchemaLoader schemaLoader = new SchemaLoader() {

        @Override
        public void putSelfBasePathIfAbsent(String microserviceName, String basePath) {
        }
    };
    CompositeSwaggerGeneratorContext compositeSwaggerGeneratorContext = new CompositeSwaggerGeneratorContext();
    ReflectUtils.setField(producerSchemaFactory, "producerArgsMapperFactory", producerArgsMapperFactory);
    ReflectUtils.setField(producerSchemaFactory, "responseMapperFactory", responseMapperFactory);
    ReflectUtils.setField(producerSchemaFactory, "microserviceMetaManager", microserviceMetaManager);
    ReflectUtils.setField(producerSchemaFactory, "schemaLoader", schemaLoader);
    ReflectUtils.setField(producerSchemaFactory, "compositeSwaggerGeneratorContext", compositeSwaggerGeneratorContext);
    BeanUtils.setContext(Mockito.mock(ApplicationContext.class));
    UnitTestMeta.init();
    schemaMeta = producerSchemaFactory.getOrCreateProducerSchema("app:ms", "schema", TestProducerSchemaFactoryImpl.class, new TestProducerSchemaFactoryImpl());
}
Also used : MicroserviceMetaManager(io.servicecomb.core.definition.MicroserviceMetaManager) SchemaLoader(io.servicecomb.core.definition.loader.SchemaLoader) ApplicationContext(org.springframework.context.ApplicationContext) ProducerArgumentsMapperFactory(io.servicecomb.swagger.invocation.arguments.producer.ProducerArgumentsMapperFactory) ProducerResponseMapperFactory(io.servicecomb.swagger.invocation.response.producer.ProducerResponseMapperFactory) ProducerResponseSame(io.servicecomb.swagger.invocation.response.producer.ProducerResponseSame) CompositeSwaggerGeneratorContext(io.servicecomb.swagger.generator.core.CompositeSwaggerGeneratorContext) BeforeClass(org.junit.BeforeClass)

Aggregations

MicroserviceMetaManager (io.servicecomb.core.definition.MicroserviceMetaManager)1 SchemaLoader (io.servicecomb.core.definition.loader.SchemaLoader)1 CompositeSwaggerGeneratorContext (io.servicecomb.swagger.generator.core.CompositeSwaggerGeneratorContext)1 ProducerArgumentsMapperFactory (io.servicecomb.swagger.invocation.arguments.producer.ProducerArgumentsMapperFactory)1 ProducerResponseMapperFactory (io.servicecomb.swagger.invocation.response.producer.ProducerResponseMapperFactory)1 ProducerResponseSame (io.servicecomb.swagger.invocation.response.producer.ProducerResponseSame)1 BeforeClass (org.junit.BeforeClass)1 ApplicationContext (org.springframework.context.ApplicationContext)1