You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2020/03/19 10:15:02 UTC

[cxf] 02/06: Adding a test for the service listing + private endpoints

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch 3.2.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 104aed7840e30f46f5c6e60c6aceee2222f1aff9
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Wed Mar 18 12:12:10 2020 +0000

    Adding a test for the service listing + private endpoints
    
    (cherry picked from commit 6a984d1184f2288bf190269b11537b7b1a687dad)
    (cherry picked from commit f3932a9ab64689e354e9c36da95f001049fde13d)
---
 .../cxf/systest/jaxrs/JAXRSServicesListingTest.java       | 15 +++++++++++++++
 .../src/test/resources/service_listing/WEB-INF/beans.xml  |  8 ++++++++
 2 files changed, 23 insertions(+)

diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSServicesListingTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSServicesListingTest.java
index 88af617..43f167f 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSServicesListingTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSServicesListingTest.java
@@ -98,4 +98,19 @@ public class JAXRSServicesListingTest extends AbstractBusClientServerTestBase {
             assertFalse(result.contains("<script>"));
         }
     }
+
+    @Test
+    public void testServiceListingPrivate() throws Exception {
+
+        String endpointAddress =
+            "http://localhost:" + PORT + "/service_listing/services";
+        String expectedResult =
+            "http://localhost:" + PORT + "/service_listing/services/resourcesprivate";
+
+        URL url = new URL(endpointAddress);
+        try (InputStream input = url.openStream()) {
+            String result = IOUtils.readStringFromStream(input);
+            assertFalse(result.contains(expectedResult));
+        }
+    }
 }
diff --git a/systests/jaxrs/src/test/resources/service_listing/WEB-INF/beans.xml b/systests/jaxrs/src/test/resources/service_listing/WEB-INF/beans.xml
index 425b8c7..eebe008 100644
--- a/systests/jaxrs/src/test/resources/service_listing/WEB-INF/beans.xml
+++ b/systests/jaxrs/src/test/resources/service_listing/WEB-INF/beans.xml
@@ -27,5 +27,13 @@
             <ref bean="servletconfigstore"/>
         </jaxrs:serviceBeans>
     </jaxrs:server>
+    <jaxrs:server id="bookserviceprivate" address="/resourcesprivate">
+        <jaxrs:serviceBeans>
+            <ref bean="servletconfigstore"/>
+        </jaxrs:serviceBeans>
+        <jaxrs:properties>
+            <entry key="org.apache.cxf.endpoint.private" value="true"/>
+        </jaxrs:properties>
+    </jaxrs:server>
     <bean id="servletconfigstore" class="org.apache.cxf.systest.jaxrs.SpringServletConfigStore"/>
 </beans>
\ No newline at end of file