HybrisHTTPRequest { public String getHybrisConsoleOutput(String json, ServerAnwserTypes type) { if(type == ServerAnwserTypes.EXECUTION_RESULT) { return returnFromJSON(json, "executionResult"); } if(type == ServerAnwserTypes.OUTPUT_TEXT) { return returnFromJSON(json, "outputText"); } if(type== ServerAnwserTypes.STACKTRACE_TEXT) { return returnFromJSON(json, "stacktraceText"); } return null; } private  HybrisHTTPRequest(); static HybrisHTTPRequest getInstance(); boolean isHybrisServerURLSet(); void setLocaleISOCode(String localeISOCode); void setMaxCount(String maxCount); void setUsername(String username); boolean isHybrisVersion5OrAbove(); void setHybrisVersion5OrAbove(boolean hybrisVersion5OrAbove); boolean isUserdataSet(); void setServerURL(String serverURL); String executeFlexsearchScript(String script, String jSessionID); String executeGroovyScript(String script, String jSessionID); String executeBeanshellScript(String script, String jSessionID); String getJSessionID(String username, String password); String getJSessionID(); String getHybrisConsoleOutput(String json, ServerAnwserTypes type); String getHybrisFlexsearchConsoleOutput(String json, ServerAnwserTypes type); boolean isHybrisServerURLEqual(String otherServerURL);  }
@Test public void shouldGetTheOutputTextFromJSON() { assertEquals("org.springframework.security.filterChains\norg.springframework.security.filterChainProxy\norg.springframework.security.web.DefaultSecurityFilterChain#0\norg.springframework.security.web.DefaultSecurityFilterChain#1\norg.springframework.security.web.DefaultSecurityFilterChain#2\norg.springframework.security.web.DefaultSecurityFilterChain#3\norg.springframework.security.web.DefaultSecurityFilterChain#4\norg.springframework.security.web.DefaultSecurityFilterChain#5\norg.springframework.security.web.PortMapperImpl#0\norg.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0\norg.springframework.security.authentication.ProviderManager#0\norg.springframework.security.web.context.HttpSessionSecurityContextRepository#0\norg.springframework.security.web.savedrequest.HttpSessionRequestCache#0\norg.springframework.security.web.access.intercept.FilterSecurityInterceptor#0\norg.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0\norg.springframework.security.authentication.AnonymousAuthenticationProvider#0\norg.springframework.security.authentication.RememberMeAuthenticationProvider#0\norg.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint#0\norg.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0\norg.springframework.security.userDetailsServiceFactory\norg.springframework.security.web.DefaultSecurityFilterChain#6\nfixation\naccessDecisionManager\nrememberMeServices\norg.springframework.security.authentication.DefaultAuthenticationEventPublisher#0\norg.springframework.security.authenticationManager\ncoreAuthenticationProvider\ncorePreAuthenticationChecks\ncoreUserDetailsService\norg.springframework.beans.factory.config.CustomScopeConfigurer#0\nlocaleResolver\nhacRedirectFilter\nspringHacFilterChain\nhacDataSourceSwitchingFilter\nhacTransactionTemplate\n", HybrisHTTPRequest.getHybrisConsoleOutput("{\"executionResult\":\"Groovy Rocks!\",\"outputText\":\"org.springframework.security.filterChains\\norg.springframework.security.filterChainProxy\\norg.springframework.security.web.DefaultSecurityFilterChain#0\\norg.springframework.security.web.DefaultSecurityFilterChain#1\\norg.springframework.security.web.DefaultSecurityFilterChain#2\\norg.springframework.security.web.DefaultSecurityFilterChain#3\\norg.springframework.security.web.DefaultSecurityFilterChain#4\\norg.springframework.security.web.DefaultSecurityFilterChain#5\\norg.springframework.security.web.PortMapperImpl#0\\norg.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0\\norg.springframework.security.authentication.ProviderManager#0\\norg.springframework.security.web.context.HttpSessionSecurityContextRepository#0\\norg.springframework.security.web.savedrequest.HttpSessionRequestCache#0\\norg.springframework.security.web.access.intercept.FilterSecurityInterceptor#0\\norg.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0\\norg.springframework.security.authentication.AnonymousAuthenticationProvider#0\\norg.springframework.security.authentication.RememberMeAuthenticationProvider#0\\norg.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint#0\\norg.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0\\norg.springframework.security.userDetailsServiceFactory\\norg.springframework.security.web.DefaultSecurityFilterChain#6\\nfixation\\naccessDecisionManager\\nrememberMeServices\\norg.springframework.security.authentication.DefaultAuthenticationEventPublisher#0\\norg.springframework.security.authenticationManager\\ncoreAuthenticationProvider\\ncorePreAuthenticationChecks\\ncoreUserDetailsService\\norg.springframework.beans.factory.config.CustomScopeConfigurer#0\\nlocaleResolver\\nhacRedirectFilter\\nspringHacFilterChain\\nhacDataSourceSwitchingFilter\\nhacTransactionTemplate\\n\",\"stacktraceText\":\"\"}", ServerAnwserTypes.OUTPUT_TEXT)); }
@Test public void shouldGetTheExecutionResultFromJSON() { assertEquals("Groovy Rocks!", HybrisHTTPRequest.getHybrisConsoleOutput("{\"executionResult\":\"Groovy Rocks!\",\"outputText\":\"org.springframework.security.filterChains\\norg.springframework.security.filterChainProxy\\norg.springframework.security.web.DefaultSecurityFilterChain#0\\norg.springframework.security.web.DefaultSecurityFilterChain#1\\norg.springframework.security.web.DefaultSecurityFilterChain#2\\norg.springframework.security.web.DefaultSecurityFilterChain#3\\norg.springframework.security.web.DefaultSecurityFilterChain#4\\norg.springframework.security.web.DefaultSecurityFilterChain#5\\norg.springframework.security.web.PortMapperImpl#0\\norg.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0\\norg.springframework.security.authentication.ProviderManager#0\\norg.springframework.security.web.context.HttpSessionSecurityContextRepository#0\\norg.springframework.security.web.savedrequest.HttpSessionRequestCache#0\\norg.springframework.security.web.access.intercept.FilterSecurityInterceptor#0\\norg.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0\\norg.springframework.security.authentication.AnonymousAuthenticationProvider#0\\norg.springframework.security.authentication.RememberMeAuthenticationProvider#0\\norg.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint#0\\norg.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0\\norg.springframework.security.userDetailsServiceFactory\\norg.springframework.security.web.DefaultSecurityFilterChain#6\\nfixation\\naccessDecisionManager\\nrememberMeServices\\norg.springframework.security.authentication.DefaultAuthenticationEventPublisher#0\\norg.springframework.security.authenticationManager\\ncoreAuthenticationProvider\\ncorePreAuthenticationChecks\\ncoreUserDetailsService\\norg.springframework.beans.factory.config.CustomScopeConfigurer#0\\nlocaleResolver\\nhacRedirectFilter\\nspringHacFilterChain\\nhacDataSourceSwitchingFilter\\nhacTransactionTemplate\\n\",\"stacktraceText\":\"\"}", ServerAnwserTypes.EXECUTION_RESULT)); }
@Test public void shouldGetTheStacktraceResultFromJSON() { assertEquals("No", HybrisHTTPRequest.getHybrisConsoleOutput("{\"executionResult\":\"Groovy Rocks!\",\"outputText\":\"org.springframework.security.filterChains\\norg.springframework.security.filterChainProxy\\norg.springframework.security.web.DefaultSecurityFilterChain#0\\norg.springframework.security.web.DefaultSecurityFilterChain#1\\norg.springframework.security.web.DefaultSecurityFilterChain#2\\norg.springframework.security.web.DefaultSecurityFilterChain#3\\norg.springframework.security.web.DefaultSecurityFilterChain#4\\norg.springframework.security.web.DefaultSecurityFilterChain#5\\norg.springframework.security.web.PortMapperImpl#0\\norg.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0\\norg.springframework.security.authentication.ProviderManager#0\\norg.springframework.security.web.context.HttpSessionSecurityContextRepository#0\\norg.springframework.security.web.savedrequest.HttpSessionRequestCache#0\\norg.springframework.security.web.access.intercept.FilterSecurityInterceptor#0\\norg.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0\\norg.springframework.security.authentication.AnonymousAuthenticationProvider#0\\norg.springframework.security.authentication.RememberMeAuthenticationProvider#0\\norg.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint#0\\norg.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0\\norg.springframework.security.userDetailsServiceFactory\\norg.springframework.security.web.DefaultSecurityFilterChain#6\\nfixation\\naccessDecisionManager\\nrememberMeServices\\norg.springframework.security.authentication.DefaultAuthenticationEventPublisher#0\\norg.springframework.security.authenticationManager\\ncoreAuthenticationProvider\\ncorePreAuthenticationChecks\\ncoreUserDetailsService\\norg.springframework.beans.factory.config.CustomScopeConfigurer#0\\nlocaleResolver\\nhacRedirectFilter\\nspringHacFilterChain\\nhacDataSourceSwitchingFilter\\nhacTransactionTemplate\\n\",\"stacktraceText\":\"No\"}", ServerAnwserTypes.STACKTRACE_TEXT)); }