use of org.apache.servicecomb.core.definition.schema.ConsumerSchemaFactory in project incubator-servicecomb-java-chassis by apache.
the class MockUtil method mockRegisterManager.
public void mockRegisterManager() throws InstantiationException, IllegalAccessException {
MicroserviceMeta microserviceMeta = microserviceMetaManager.getOrCreateMicroserviceMeta("app:test");
microserviceMeta.putExtData("RestServicePathManager", new ServicePathManager(microserviceMeta));
ConsumerSchemaFactory consumerSchemaFactory = new MockUp<ConsumerSchemaFactory>() {
@Mock
public MicroserviceMeta getOrCreateConsumer(String microserviceName) {
return microserviceMeta;
}
}.getMockInstance();
CseContext.getInstance().setConsumerSchemaFactory(consumerSchemaFactory);
}
use of org.apache.servicecomb.core.definition.schema.ConsumerSchemaFactory in project incubator-servicecomb-java-chassis by apache.
the class UnitTestMeta method init.
@SuppressWarnings("unchecked")
public static synchronized void init() {
if (inited) {
return;
}
ConsumerProviderManager consumerProviderManager = new ConsumerProviderManager();
ConsumerSchemaFactory consumerSchemaFactory = new ConsumerSchemaFactory();
consumerSchemaFactory.setMicroserviceMetaManager(microserviceMetaManager);
consumerSchemaFactory.setSchemaListenerManager(schemaListenerManager);
consumerProviderManager.setConsumerSchemaFactory(consumerSchemaFactory);
CseContext.getInstance().setConsumerProviderManager(consumerProviderManager);
CseContext.getInstance().setConsumerSchemaFactory(consumerSchemaFactory);
CseContext.getInstance().setSchemaListenerManager(schemaListenerManager);
Config config = new Config();
Class<?> cls = SimpleLoadBalanceHandler.class;
config.getHandlerClassMap().put("simpleLB", (Class<Handler>) cls);
ProducerHandlerManager.INSTANCE.init(new Config());
ConsumerHandlerManager.INSTANCE.init(config);
ApplicationContext applicationContext = Mockito.mock(ApplicationContext.class);
Mockito.when(applicationContext.getBean(Mockito.anyString())).thenReturn(null);
BeanUtils.setContext(applicationContext);
inited = true;
}
Aggregations