Search in sources :

Example 1 with BackupService

use of com.thoughtworks.go.server.service.BackupService in project gocd by gocd.

the class BackupFilterTest method setUp.

@Before
public void setUp() throws ServletException, IOException {
    ServletHelper.init();
    res = mock(HttpServletResponse.class);
    backupService = mock(BackupService.class);
    chain = mock(FilterChain.class);
    filterConfig = mock(FilterConfig.class);
    inputStream = BackupFilter.class.getClassLoader().getResourceAsStream("backup_in_progress.html");
    output = new ByteArrayOutputStream();
    writer = mock(PrintWriter.class);
    when(res.getWriter()).thenReturn(writer);
    this.backupFilter = new BackupFilter(backupService);
    backupFilter.init(filterConfig);
}
Also used : BackupService(com.thoughtworks.go.server.service.BackupService) FilterChain(javax.servlet.FilterChain) HttpServletResponse(javax.servlet.http.HttpServletResponse) FilterConfig(javax.servlet.FilterConfig) ByteArrayOutputStream(java.io.ByteArrayOutputStream) PrintWriter(java.io.PrintWriter) Before(org.junit.Before)

Example 2 with BackupService

use of com.thoughtworks.go.server.service.BackupService in project gocd by gocd.

the class ApiSessionFilterIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    WebApplicationContext wac = mock(WebApplicationContext.class);
    when(wac.getBean("filterChainProxy", javax.servlet.Filter.class)).thenReturn(filterChainProxy);
    when(wac.getBean("backupService")).thenReturn(mock(BackupService.class));
    filterChainProxy.init(new MockFilterConfig());
    servletContext = new MockServletContext();
    servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
    proxy = new DelegatingFilterProxy("filterChainProxy", wac);
    proxy.setServletContext(servletContext);
}
Also used : BackupService(com.thoughtworks.go.server.service.BackupService) WebApplicationContext(org.springframework.web.context.WebApplicationContext) DelegatingFilterProxy(org.springframework.web.filter.DelegatingFilterProxy) Before(org.junit.Before)

Aggregations

BackupService (com.thoughtworks.go.server.service.BackupService)2 Before (org.junit.Before)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintWriter (java.io.PrintWriter)1 FilterChain (javax.servlet.FilterChain)1 FilterConfig (javax.servlet.FilterConfig)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 WebApplicationContext (org.springframework.web.context.WebApplicationContext)1 DelegatingFilterProxy (org.springframework.web.filter.DelegatingFilterProxy)1