Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Sign In

OpenWiseSolutions / openhub-framework / 1198

4 Feb 2021 - 14:46 coverage decreased (-0.5%) to 70.196%
1198

Pull #129

travis-ci

9181eb84f9c35729a3bad740fb7f9d93?size=18&default=identiconweb-flow
Merge b150e80af into 382999a38
Pull Request #129: [OHFJIRA-85]: Upgrade to Spring Boot 2.0.9.RELEASE

23 of 66 new or added lines in 12 files covered. (34.85%)

28 existing lines in 4 files now uncovered.

4329 of 6167 relevant lines covered (70.2%)

0.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

41.18
/web/src/main/java/org/openhubframework/openhub/OpenHubApplication.java
1
/*
2
 * Copyright 2016-2021 the original author or authors.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package org.openhubframework.openhub;
18

19
import javax.servlet.Filter;
20

21
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
22
import org.springframework.boot.builder.SpringApplicationBuilder;
23
import org.springframework.boot.context.ApplicationPidFileWriter;
24
import org.springframework.boot.context.properties.EnableConfigurationProperties;
25
import org.springframework.boot.web.context.WebServerPortFileWriter;
26
import org.springframework.boot.web.servlet.FilterRegistrationBean;
27
import org.springframework.boot.web.servlet.support.ErrorPageFilter;
28
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
29
import org.springframework.cache.annotation.EnableCaching;
30
import org.springframework.context.annotation.*;
31
import org.springframework.context.annotation.aspectj.EnableSpringConfigured;
32
import org.springframework.web.WebApplicationInitializer;
33

34
import org.openhubframework.openhub.api.route.CamelConfiguration;
35
import org.openhubframework.openhub.common.AutoConfiguration;
36
import org.openhubframework.openhub.common.log.LogContextFilter;
37
import org.openhubframework.openhub.core.config.CamelConfig;
38
import org.openhubframework.openhub.core.config.JpaConfig;
39
import org.openhubframework.openhub.core.config.WebServiceConfig;
40
import org.openhubframework.openhub.config.CamelRoutesConfig;
41
import org.openhubframework.openhub.web.config.GlobalSecurityConfig;
42
import org.openhubframework.openhub.config.WebConfigurer;
43
import org.openhubframework.openhub.web.config.WebSecurityConfig;
44

45

46
/**
47
 * OpenHub application configuration.
48
 * <p/>
49
 * This class configures root Spring context and {@link WebConfigurer web child} context.
50
 *
51
 * @author Petr Juza
52
 * @see WebConfigurer
53
 * @see GlobalSecurityConfig
54
 * @see WebSecurityConfig
55
 * @see CamelRoutesConfig
56
 * @see CamelConfig
57
 * @see WebServiceConfig
58
 * @see JpaConfig
59
 * @since 2.0
60
 */
61
@EnableAutoConfiguration(excludeName = {"org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration"})
62
@EnableCaching
63
@EnableConfigurationProperties
64
// note: all routes with @CamelConfiguration are configured in CamelRoutesConfig
65
@ComponentScan(basePackages = {
66
        "org.openhubframework.openhub.common",
67
        "org.openhubframework.openhub.core",
68
        "org.openhubframework.openhub.modules",
69
        "org.openhubframework.openhub.config"
70
},
71
        excludeFilters = {
72
                @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = AutoConfiguration.class),
73
                @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = CamelConfiguration.class)
74
        })
75
@Configuration
76
@EnableSpringConfigured
77
@EnableAspectJAutoProxy
78
@PropertySource(value = {"classpath:/extensions.cfg"})
79
// WebApplicationInitializer must be implemented directly because of Weblogic support
80
// see https://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html#howto-weblogic
81
public class OpenHubApplication extends SpringBootServletInitializer implements WebApplicationInitializer {
1×
82
    
83
    /**
84
     * Sets up filter for adding context information to logging.
85
     */
86
    @Bean
87
    public Filter logContextFilter() {
88
        return new LogContextFilter();
1×
89
    }
90

91
    // ----------------------------------------------
92
    // reason of this code snippet: 
93
    //      http://stackoverflow.com/questions/30170586/how-to-disable-errorpagefilter-in-spring-boot
94
    
95
    @Bean
96
    public ErrorPageFilter errorPageFilter() {
97
        return new ErrorPageFilter();
1×
98
    }
99

100
    @Bean
101
    public FilterRegistrationBean disableSpringBootErrorFilter(ErrorPageFilter filter) {
102
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
1×
103
        filterRegistrationBean.setFilter(filter);
1×
104
        filterRegistrationBean.setEnabled(false);
1×
105
        return filterRegistrationBean;
1×
106
    }
107
    // ----------------------------------------------    
108
    
109
    @Override
110
    protected SpringApplicationBuilder createSpringApplicationBuilder() {
111
        return createOpenHubApplicationBuilder();
!
112
    }
113

114
    /**
115
     * Main method used to start OpenHub server in standalone mode.
116
     *
117
     * @param args as arguments used to override configuration
118
     * @throws Exception if OpenHub was not start correctly
119
     * @see #createOpenHubApplicationBuilder()
120
     */
121
    public static void main(String[] args) throws Exception {
122
        final SpringApplicationBuilder ohf = createOpenHubApplicationBuilder();
!
123
        ohf.listeners(
!
124
                new ApplicationPidFileWriter("ohf-app.pid"),
!
NEW
125
                new WebServerPortFileWriter("ohf-app.port"));
!
126
        ohf.run(args);
!
127
    }
!
128

129
    private static SpringApplicationBuilder createOpenHubApplicationBuilder() {
130
        return new SpringApplicationBuilder()
!
131
                .parent(OpenHubApplication.class)
!
132
                // explicitly request a web environment for standalone running
133
                .web(true);
!
134
    }
135
    
136
}
Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
BLOG · TWITTER · Legal & Privacy · Supported CI Services · What's a CI service? · Automated Testing

© 2021 Coveralls, Inc