This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch CXF-8671
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/CXF-8671 by this push:
new 31e2bcae7b Adapt JAXWSServicesListingTest test cases to jetty 12.0.8+
changes
31e2bcae7b is described below
commit 31e2bcae7bf65a7376eb4bb1296d44856e02a8f3
Author: Andriy Redko <[email protected]>
AuthorDate: Thu Apr 4 21:44:21 2024 -0400
Adapt JAXWSServicesListingTest test cases to jetty 12.0.8+ changes
---
.../servicelisting/JAXWSServicesListingTest.java | 28 +++++++++++++++-------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git
a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/servicelisting/JAXWSServicesListingTest.java
b/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/servicelisting/JAXWSServicesListingTest.java
index caf1389150..0795349293 100644
---
a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/servicelisting/JAXWSServicesListingTest.java
+++
b/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/servicelisting/JAXWSServicesListingTest.java
@@ -19,6 +19,7 @@
package org.apache.cxf.systest.ws.servicelisting;
+import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -28,7 +29,10 @@ import
org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.junit.BeforeClass;
import org.junit.Test;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
public class JAXWSServicesListingTest extends AbstractBusClientServerTestBase {
@@ -78,10 +82,14 @@ public class JAXWSServicesListingTest extends
AbstractBusClientServerTestBase {
"http://localhost:" + PORT +
"/service_listing/services/<script>alert(1)</script>/../../";
URL url = new URL(endpointAddress);
- try (InputStream input = url.openStream()) {
- String result = IOUtils.readStringFromStream(input);
- assertFalse(result.contains("<script>"));
- }
+ // Changes sinceJetty 12.0.8+ see please
https://github.com/jetty/jetty.project/pull/11496
+ final IOException ex = assertThrows(IOException.class, () -> {
+ try (InputStream input = url.openStream()) {
+ String result = IOUtils.readStringFromStream(input);
+ assertFalse(result.contains("<script>"));
+ }
+ });
+ assertThat(ex.getMessage(), containsString("400 for URL: " +
endpointAddress));
}
@Test
@@ -91,10 +99,14 @@ public class JAXWSServicesListingTest extends
AbstractBusClientServerTestBase {
"http://localhost:" + PORT +
"/service_listing/services/<script>alert(1)</script>/../../?formatted=false";
URL url = new URL(endpointAddress);
- try (InputStream input = url.openStream()) {
- String result = IOUtils.readStringFromStream(input);
- assertFalse(result.contains("<script>"));
- }
+ // Changes sinceJetty 12.0.8+ see please
https://github.com/jetty/jetty.project/pull/11496
+ final IOException ex = assertThrows(IOException.class, () -> {
+ try (InputStream input = url.openStream()) {
+ String result = IOUtils.readStringFromStream(input);
+ assertFalse(result.contains("<script>"));
+ }
+ });
+ assertThat(ex.getMessage(), containsString("400 for URL: " +
endpointAddress));
}
}