Skip to content

Commit

Permalink
Fixed: Test run was unsuccessful because of failing solr tests (OFBIZ…
Browse files Browse the repository at this point in the history
…-12595)

The previous commit for OFBIZ-12594 was only working on Windows. On *nix OSs
there is no way to reliably get "--test" String from java.class.path property.

Also the previous fix was brittle because relying only on 1 space separating
words.

This fix puts in the SolrDispatchFilter system property at the beginning of the
4 Solr tests and removes it at end of them. That presence can reliably be tested
in ControlFilter that is called before SolrDispatchFilter. It allows to bypass
SecurityUtil::containsFreemarkerInterpolation that would else change the
parameters content type that must be application/x-www-form-urlencoded.
content

Thanks: Tom Pietsch for report and Mart Naum for confirmation

Conflicts handled by hand
  • Loading branch information
JacquesLeRoux committed Apr 13, 2022
1 parent 6789011 commit 16ed130
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
offset = requestUri.length();
}
if (!GenericValue.getStackTraceAsString().contains("ControlFilterTests")
&& !(System.getProperty("java.class.path").contains("--test component=solr") // Allows Solr tests
|| System.getProperty("java.class.path").contains("ofbiz --test_ManifestJar.jar") // Allows Solr tests in testIntegration
|| System.getProperty("java.class.path").contains("ofbiz.jar")) // Allows Solr tests in testIntegration in 18.12
&& null == System.getProperty("SolrDispatchFilter") // Allows Solr tests
&& SecurityUtil.containsFreemarkerInterpolation(httpRequest, httpResponse, requestUri)) {
return;
}
Expand Down

0 comments on commit 16ed130

Please sign in to comment.