Search in sources :

Example 11 with JHipsterProperties

use of io.github.jhipster.config.JHipsterProperties in project uplace.es by Uplace.

the class WebConfigurerTest method setup.

@Before
public void setup() {
    servletContext = spy(new MockServletContext());
    doReturn(new MockFilterRegistration()).when(servletContext).addFilter(anyString(), any(Filter.class));
    doReturn(new MockServletRegistration()).when(servletContext).addServlet(anyString(), any(Servlet.class));
    env = new MockEnvironment();
    props = new JHipsterProperties();
    webConfigurer = new WebConfigurer(env, props);
    metricRegistry = new MetricRegistry();
    webConfigurer.setMetricRegistry(metricRegistry);
}
Also used : JHipsterProperties(io.github.jhipster.config.JHipsterProperties) InstrumentedFilter(com.codahale.metrics.servlet.InstrumentedFilter) CachingHttpHeadersFilter(io.github.jhipster.web.filter.CachingHttpHeadersFilter) MockEnvironment(org.springframework.mock.env.MockEnvironment) MetricRegistry(com.codahale.metrics.MetricRegistry) MetricsServlet(com.codahale.metrics.servlets.MetricsServlet) MockServletContext(org.springframework.mock.web.MockServletContext) Before(org.junit.Before)

Example 12 with JHipsterProperties

use of io.github.jhipster.config.JHipsterProperties in project jhipster-sample-app-hazelcast by jhipster.

the class WebConfigurerTest method setup.

@Before
public void setup() {
    servletContext = spy(new MockServletContext());
    doReturn(mock(FilterRegistration.Dynamic.class)).when(servletContext).addFilter(anyString(), any(Filter.class));
    doReturn(mock(ServletRegistration.Dynamic.class)).when(servletContext).addServlet(anyString(), any(Servlet.class));
    env = new MockEnvironment();
    props = new JHipsterProperties();
    webConfigurer = new WebConfigurer(env, props);
    metricRegistry = new MetricRegistry();
    webConfigurer.setMetricRegistry(metricRegistry);
}
Also used : JHipsterProperties(io.github.jhipster.config.JHipsterProperties) InstrumentedFilter(com.codahale.metrics.servlet.InstrumentedFilter) CachingHttpHeadersFilter(io.github.jhipster.web.filter.CachingHttpHeadersFilter) MockEnvironment(org.springframework.mock.env.MockEnvironment) MetricRegistry(com.codahale.metrics.MetricRegistry) WebServlet(org.h2.server.web.WebServlet) MetricsServlet(com.codahale.metrics.servlets.MetricsServlet) MockServletContext(org.springframework.mock.web.MockServletContext) Before(org.junit.Before)

Example 13 with JHipsterProperties

use of io.github.jhipster.config.JHipsterProperties in project jhipster-sample-app-websocket by jhipster.

the class WebConfigurerTest method setup.

@Before
public void setup() {
    servletContext = spy(new MockServletContext());
    doReturn(mock(FilterRegistration.Dynamic.class)).when(servletContext).addFilter(anyString(), any(Filter.class));
    doReturn(mock(ServletRegistration.Dynamic.class)).when(servletContext).addServlet(anyString(), any(Servlet.class));
    env = new MockEnvironment();
    props = new JHipsterProperties();
    webConfigurer = new WebConfigurer(env, props);
    metricRegistry = new MetricRegistry();
    webConfigurer.setMetricRegistry(metricRegistry);
}
Also used : JHipsterProperties(io.github.jhipster.config.JHipsterProperties) InstrumentedFilter(com.codahale.metrics.servlet.InstrumentedFilter) CachingHttpHeadersFilter(io.github.jhipster.web.filter.CachingHttpHeadersFilter) MockEnvironment(org.springframework.mock.env.MockEnvironment) MetricRegistry(com.codahale.metrics.MetricRegistry) WebServlet(org.h2.server.web.WebServlet) MetricsServlet(com.codahale.metrics.servlets.MetricsServlet) MockServletContext(org.springframework.mock.web.MockServletContext) Before(org.junit.Before)

Example 14 with JHipsterProperties

use of io.github.jhipster.config.JHipsterProperties in project jhipster-sample-app-mongodb by jhipster.

the class WebConfigurerTest method setup.

@Before
public void setup() {
    servletContext = spy(new MockServletContext());
    doReturn(mock(FilterRegistration.Dynamic.class)).when(servletContext).addFilter(anyString(), any(Filter.class));
    doReturn(mock(ServletRegistration.Dynamic.class)).when(servletContext).addServlet(anyString(), any(Servlet.class));
    env = new MockEnvironment();
    props = new JHipsterProperties();
    webConfigurer = new WebConfigurer(env, props);
    metricRegistry = new MetricRegistry();
    webConfigurer.setMetricRegistry(metricRegistry);
}
Also used : JHipsterProperties(io.github.jhipster.config.JHipsterProperties) InstrumentedFilter(com.codahale.metrics.servlet.InstrumentedFilter) CachingHttpHeadersFilter(io.github.jhipster.web.filter.CachingHttpHeadersFilter) MockEnvironment(org.springframework.mock.env.MockEnvironment) MetricRegistry(com.codahale.metrics.MetricRegistry) MetricsServlet(com.codahale.metrics.servlets.MetricsServlet) MockServletContext(org.springframework.mock.web.MockServletContext) Before(org.junit.Before)

Example 15 with JHipsterProperties

use of io.github.jhipster.config.JHipsterProperties in project jhipster-sample-app-mongodb by jhipster.

the class JWTFilterTest method setup.

@Before
public void setup() {
    JHipsterProperties jHipsterProperties = new JHipsterProperties();
    tokenProvider = new TokenProvider(jHipsterProperties);
    ReflectionTestUtils.setField(tokenProvider, "secretKey", "test secret");
    ReflectionTestUtils.setField(tokenProvider, "tokenValidityInMilliseconds", 60000);
    jwtFilter = new JWTFilter(tokenProvider);
    SecurityContextHolder.getContext().setAuthentication(null);
}
Also used : JHipsterProperties(io.github.jhipster.config.JHipsterProperties) Before(org.junit.Before)

Aggregations

JHipsterProperties (io.github.jhipster.config.JHipsterProperties)21 Before (org.junit.Before)21 MetricRegistry (com.codahale.metrics.MetricRegistry)13 InstrumentedFilter (com.codahale.metrics.servlet.InstrumentedFilter)13 MetricsServlet (com.codahale.metrics.servlets.MetricsServlet)13 MockEnvironment (org.springframework.mock.env.MockEnvironment)13 MockServletContext (org.springframework.mock.web.MockServletContext)13 CachingHttpHeadersFilter (io.github.jhipster.web.filter.CachingHttpHeadersFilter)12 WebServlet (org.h2.server.web.WebServlet)7 Filter (javax.servlet.Filter)1 Servlet (javax.servlet.Servlet)1 Environment (org.springframework.core.env.Environment)1