HttpWebService extends ServletBase { @Override public void doGet( final HttpServletRequest request, final HttpServletResponse response ) throws ServletException, IOException { PentahoSystem.systemEntryPoint(); try { if ( !isSecurityDetailsRequest( request ) ) { if ( HttpWebService.logger.isDebugEnabled() ) { HttpWebService.logger.debug( Messages.getInstance().getString( "HttpWebService.DEBUG_MISSING_ACTION_PARAMETER" ) ); } doGetFixMe( request, response ); return; } String responseEncoding = PentahoSystem.getSystemSetting( "web-service-encoding", "utf-8" ); response.setContentType( "text/xml" ); response.setCharacterEncoding( responseEncoding ); String details = getDetailsParameter( request ); if ( "users".equalsIgnoreCase( details ) ) { Document usersDoc = getUsers(); Document aclsDoc = getACLs(); XmlDom4JHelper.saveDom( SoapHelper.createSoapResponseDocument( new Document[] { usersDoc, aclsDoc } ), response .getOutputStream(), responseEncoding, true ); } else if ( "roles".equalsIgnoreCase( details ) ) { Document rolesDoc = getRoles(); Document aclsDoc = getACLs(); XmlDom4JHelper.saveDom( SoapHelper.createSoapResponseDocument( new Document[] { rolesDoc, aclsDoc } ), response .getOutputStream(), responseEncoding, true ); } else if ( "acls".equalsIgnoreCase( details ) ) { Document aclsDoc = getACLs(); XmlDom4JHelper.saveDom( SoapHelper.createSoapResponseDocument( aclsDoc ), response.getOutputStream(), responseEncoding, true ); } else { if ( !"all".equalsIgnoreCase( details ) ) { if ( HttpWebService.logger.isWarnEnabled() ) { HttpWebService.logger.warn( Messages.getInstance().getString( "HttpWebService.WARN_MISSING_DETAILS_PARAMETER" ) ); } } Document usersDoc = getUsers(); Document rolesDoc = getRoles(); Document aclsDoc = getACLs(); XmlDom4JHelper.saveDom( SoapHelper.createSoapResponseDocument( new Document[] { usersDoc, rolesDoc, aclsDoc } ), response .getOutputStream(), responseEncoding, true ); } } finally { PentahoSystem.systemExitPoint(); } } HttpWebService(); @Override Log getLogger(); String getPayloadAsString( final HttpServletRequest request ); void doGetFixMe( final HttpServletRequest request, final HttpServletResponse response ); @Override void doGet( final HttpServletRequest request, final HttpServletResponse response );  }
@Test public void testDoGet() throws Exception { HttpWebService service = spy( httpWebService ); doNothing().when( service ).doGetFixMe( request, response ); doReturn( true ).when( service ).isSecurityDetailsRequest( request ); when( response.getOutputStream() ).thenReturn( responseOutputStream ); service.doGet( request, response ); verify( service, never() ).doGetFixMe( request, response ); }