Skip to content

Commit

Permalink
feat: Add testcase for DubboService#parameters to verify issue#3072 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
pinxiong committed Jun 8, 2021
1 parent 95e83e9 commit 56367d5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.dubbo.config.spring.beans.factory.annotation;

import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.config.spring.ServiceBean;
import org.apache.dubbo.config.spring.api.HelloService;
Expand Down Expand Up @@ -117,11 +118,27 @@ public void testMethodAnnotation() {
* Lazy-init for Dubbo Service
*/
@Test
public void testLazyInitDubboService(){
public void testLazyInitDubboService() {
/**
* The class {@link org.apache.dubbo.config.spring.context.annotation.provider.DefaultLazyInitHelloService} has Lazy annotation
* */
BeanDefinition beanDefinition=beanFactory.getBeanDefinition("defaultLazyInitHelloService");
Assertions.assertEquals(beanDefinition.isLazyInit(),true);
BeanDefinition beanDefinition = beanFactory.getBeanDefinition("defaultLazyInitHelloService");
Assertions.assertEquals(beanDefinition.isLazyInit(), true);
}

/**
* Test if the {@link DubboService#parameters()} works well
* see issue: https://github.com/apache/dubbo/issues/3072
*/
@Test
public void testDubboServiceParameter() {
/**
* get the {@link ServiceBean} of {@link org.apache.dubbo.config.spring.context.annotation.provider.DefaultHelloService}
* */
ServiceBean serviceBean = beanFactory.getBean("ServiceBean:org.apache.dubbo.config.spring.api.HelloService", ServiceBean.class);
Assertions.assertNotNull(serviceBean);
Assertions.assertNotNull(serviceBean.getParameters());
Assertions.assertTrue(serviceBean.getParameters().size() == 1);
Assertions.assertEquals(serviceBean.toUrl().getParameter("sayHello.timeout"), "3000");
}
}
Expand Up @@ -28,7 +28,7 @@
* @since TODO
*/
@Service
@DubboService
@DubboService(parameters = {"sayHello.timeout", "3000"})
public class DefaultHelloService implements HelloService {

@Override
Expand Down

0 comments on commit 56367d5

Please sign in to comment.