Clover icon

sunshower-base

  1. Project Clover database Fri Apr 6 2018 03:41:27 UTC
  2. Package io.sunshower.test.ws

File JAXRSConfiguration.java

 

Coverage histogram

../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
23
13
1
107
91
13
0.57
1.77
13
1

Classes

Class Line # Actions
JAXRSConfiguration 22 23 13
1.0100%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package io.sunshower.test.ws;
2   
3    import javax.ws.rs.client.Client;
4    import javax.ws.rs.client.ClientBuilder;
5    import javax.ws.rs.client.WebTarget;
6    import org.jboss.resteasy.client.jaxrs.internal.ClientConfiguration;
7    import org.jboss.resteasy.core.Dispatcher;
8    import org.jboss.resteasy.core.ResourceMethodRegistry;
9    import org.jboss.resteasy.core.SynchronousDispatcher;
10    import org.jboss.resteasy.plugins.providers.DefaultTextPlain;
11    import org.jboss.resteasy.plugins.providers.StringTextStar;
12    import org.jboss.resteasy.plugins.spring.SpringBeanProcessor;
13    import org.jboss.resteasy.spi.Registry;
14    import org.jboss.resteasy.spi.ResteasyDeployment;
15    import org.jboss.resteasy.spi.ResteasyProviderFactory;
16    import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
17    import org.springframework.context.ApplicationContext;
18    import org.springframework.context.annotation.Bean;
19    import org.springframework.context.annotation.DependsOn;
20    import org.springframework.core.annotation.Order;
21   
 
22    public class JAXRSConfiguration {
23   
 
24  1 toggle @Bean
25    public WebTarget sunshowerWebTarget(
26    Client client, EnableJAXRS configuration, SunshowerTestServer server) {
27  1 return client.target(server.getLocation());
28    }
29   
 
30  1 toggle @Bean
31    @DependsOn("sunshowerWebTarget")
32    public JAXRSPostProcessor jaxrsPostProcessor(ApplicationContext context) {
33  1 return new JAXRSPostProcessor(
34    (ConfigurableListableBeanFactory) context.getAutowireCapableBeanFactory());
35    }
36   
 
37  1 toggle @Bean
38    public SunshowerTestServer sunshowerTestServer(
39    EnableJAXRS configuration, ResteasyDeployment deployment) {
40  1 return new SunshowerTestServer(configuration, deployment);
41    }
42   
 
43  1 toggle @Bean
44    public static ProviderDependencyReorderingFactoryPostProcessor
45    providerDependencyReorderingFactoryPostProcessor() {
46  1 return new ProviderDependencyReorderingFactoryPostProcessor();
47    }
48   
 
49  1 toggle @Bean
50    public Client jaxRsClient(ResteasyProviderFactory factory) {
51  1 return ClientBuilder.newClient(new ClientConfiguration(factory));
52    }
53   
 
54  1 toggle @Bean
55    public JsonProvider jsonProvider() {
56  1 JsonProvider provider = new JsonProvider();
57  1 return provider;
58    }
59   
 
60  1 toggle @Bean
61    public StringTextStar stringTextStar() {
62  1 return new StringTextStar();
63    }
64   
 
65  1 toggle @Bean
66    public DefaultTextPlain defaultTextPlain() {
67  1 return new DefaultTextPlain();
68    }
69   
 
70  1 toggle @Bean
71    public Dispatcher dispatcher(ResteasyProviderFactory providerFactory, Registry registry) {
72  1 return new SynchronousDispatcher(providerFactory, (ResourceMethodRegistry) registry);
73    }
74   
 
75  1 toggle @Bean
76    public Registry resteasyRegistry(ResteasyProviderFactory factory) {
77  1 return new ResourceMethodRegistry(factory);
78    }
79   
 
80  1 toggle @Bean
81    public ResteasyProviderFactory resteasyProviderFactory() {
82  1 return new ResteasyProviderFactory();
83    }
84   
 
85  1 toggle @Bean
86    public ResteasyDeployment resteasyDeployment(
87    Registry registry, Dispatcher dispatcher, ResteasyProviderFactory factory) {
88  1 ResteasyDeployment deployment = new ResteasyDeployment();
89  1 deployment.setRegistry(registry);
90  1 deployment.setProviderFactory(factory);
91  1 deployment.setDispatcher(dispatcher);
92  1 return deployment;
93    }
94   
 
95  1 toggle @Bean
96    @Order
97    public SpringBeanProcessor springBeanProcessor(
98    Registry registry, ResteasyDeployment deployment, ResteasyProviderFactory factory) {
99   
100  1 factory.setRegisterBuiltins(true);
101  1 SpringBeanProcessor processor = new SpringBeanProcessor();
102  1 processor.setProviderFactory(factory);
103  1 processor.setRegistry(registry);
104  1 processor.setDispatcher(deployment.getDispatcher());
105  1 return processor;
106    }
107    }