use of org.apache.dubbo.config.spring.context.annotation.consumer.test.TestConsumerConfiguration in project dubbo by alibaba.
the class EnableDubboTest method testConsumer.
@Test
public void testConsumer() {
context.register(TestProviderConfiguration.class, TestConsumerConfiguration.class);
context.refresh();
TestConsumerConfiguration consumerConfiguration = context.getBean(TestConsumerConfiguration.class);
DemoService demoService = consumerConfiguration.getDemoService();
String value = demoService.sayName("Mercy");
Assertions.assertEquals("Hello,Mercy", value);
DemoService autowiredDemoService = consumerConfiguration.getAutowiredDemoService();
Assertions.assertEquals("Hello,Mercy", autowiredDemoService.sayName("Mercy"));
TestConsumerConfiguration.Child child = context.getBean(TestConsumerConfiguration.Child.class);
// From Child
demoService = child.getDemoServiceFromChild();
Assertions.assertNotNull(demoService);
value = demoService.sayName("Mercy");
Assertions.assertEquals("Hello,Mercy", value);
// From Parent
demoService = child.getDemoServiceFromParent();
Assertions.assertNotNull(demoService);
value = demoService.sayName("Mercy");
Assertions.assertEquals("Hello,Mercy", value);
// From Ancestor
demoService = child.getDemoServiceFromAncestor();
Assertions.assertNotNull(demoService);
value = demoService.sayName("Mercy");
Assertions.assertEquals("Hello,Mercy", value);
// Test my-registry2 bean presentation
RegistryConfig registryConfig = context.getBean("my-registry2", RegistryConfig.class);
// Test multiple binding
Assertions.assertEquals("N/A", registryConfig.getAddress());
}
Aggregations