Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add testcase for DubboService#parameters to verify issue#3072 #8001

Merged
merged 1 commit into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
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");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* @since TODO
*/
@Service
@DubboService
@DubboService(parameters = {"sayHello.timeout", "3000"})
public class DefaultHelloService implements HelloService {

@Override
Expand Down