Update for SNI Chcecking 61/133661/1
authorliamfallon <liam.fallon@est.tech>
Tue, 14 Mar 2023 17:20:20 +0000 (17:20 +0000)
committerliamfallon <liam.fallon@est.tech>
Tue, 14 Mar 2023 17:22:51 +0000 (17:22 +0000)
SNI checking is now supported in Jersey

Issue-ID: POLICY-4474
Change-Id: I6afc2d577493485f151887180ef152303c456f3a
Signed-off-by: liamfallon <liam.fallon@est.tech>
examples/examples-acm/src/main/java/org/onap/policy/apex/examples/acm/AcmTestServerDmaap.java
examples/examples-grpc/src/test/java/org/onap/policy/apex/examples/grpc/GrpcTestServerSim.java
examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/OnapVCpeSim.java
plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaRecordTest.java
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorTest.java
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/RestServerCarrierTechnologyParameters.java
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestFile2Rest.java
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRest2File.java
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/taskparameters/TestTaskParameters.java

index 1d9d56a..9e8b1b7 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
+ * Copyright (C) 2022-2023 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ public class AcmTestServerDmaap implements AutoCloseable {
      */
     public AcmTestServerDmaap() {
         restServer = HttpServletServerFactoryInstance.getServerFactory().build("AcmTestRestDmaapEndpoint", false, HOST,
-                restServerPort, "/", false, false);
+                restServerPort, false, "/", false, false);
         restServer.addServletClass(null, AcmTestRestDmaapEndpoint.class.getName());
         restServer.setSerializationProvider(GsonMessageBodyHandler.class.getName());
         restServer.start();
index cd9f11c..46e0ea2 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2020 Nordix Foundation.
+ *  Copyright (C) 2020,2023 Nordix Foundation.
  *  Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -45,7 +45,7 @@ public class GrpcTestServerSim {
     public GrpcTestServerSim() throws InterruptedException, IOException {
         int restServerPort = 54321;
         restServer = HttpServletServerFactoryInstance.getServerFactory().build("GrpcTestRestSimEndpoint", false, HOST,
-            restServerPort, "/GrpcTestRestSim", false, false);
+            restServerPort, false, "/GrpcTestRestSim", false, false);
         restServer.addServletClass(null, GrpcTestRestSimEndpoint.class.getName());
         restServer.setSerializationProvider(GsonMessageBodyHandler.class.getName());
         restServer.start();
index 2a6a2e8..c20fd92 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2019 Nordix Foundation.
+ *  Modifications Copyright (C) 2019,2023 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -39,7 +39,8 @@ public class OnapVCpeSim {
      */
     public OnapVCpeSim(final String[] args) throws Exception {
         server = HttpServletServerFactoryInstance.getServerFactory().build(
-            "OnapVCpeSimEndpoint", false, args[0], Integer.valueOf(args[1]).intValue(), "/OnapVCpeSim", false, false);
+            "OnapVCpeSimEndpoint", false, args[0], Integer.valueOf(args[1]).intValue(), false, "/OnapVCpeSim", false,
+            false);
 
         server.addServletClass(null, OnapVCpeSimEndpoint.class.getName());
         server.setSerializationProvider(GsonMessageBodyHandler.class.getName());
@@ -74,7 +75,7 @@ public class OnapVCpeSim {
         for (int index = 0; index < MAX_LOOPS; index++) {
             ThreadUtilities.sleep(100);
         }
-        
+
         sim.tearDown();
     }
 }
index 2977059..3a81584 100644 (file)
@@ -147,7 +147,7 @@ public class AvroSchemaRecordTest {
         assertThatThrownBy(() -> subRecord0.get("address")).hasMessage("Not a valid schema field: address");
 
         final GenericRecord subRecord1 = (GenericRecord) schemaHelper.createNewSubInstance("EmailAddress");
-        assertThatThrownBy(() -> subRecord0.get("address")).hasMessage("Not a valid schema field: address");
+        assertThatThrownBy(() -> subRecord1.get("EmailAddress")).hasMessage("Not a valid schema field: EmailAddress");
 
         assertThatThrownBy(() -> schemaHelper.createNewSubInstance("IDontExist"))
             .hasMessage("AvroTest:0.0.1: the schema \"User\" does not have a subtype of type \"IDontExist\"");
index 40e9004..a7795a1 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2019-2020,2023 Nordix Foundation.
  *  Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -68,7 +68,7 @@ public class RestRequestorTest {
      */
     @BeforeClass
     public static void setUp() throws Exception {
-        server = HttpServletServerFactoryInstance.getServerFactory().build(null, false, null, PORT,
+        server = HttpServletServerFactoryInstance.getServerFactory().build(null, false, null, PORT, false,
             "/TestRESTRequestor", false, false);
 
         server.addServletClass(null, SupportRestRequestorEndpoint.class.getName());
index ad3d77b..8ed2504 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2019-2020,2023 Nordix Foundation.
  *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -133,7 +133,13 @@ public class ApexRestServerConsumer extends ApexPluginsEventConsumer {
             restConsumerProperties.getName(),
             restConsumerProperties.isHttps(),
             restConsumerProperties.getHost(),
-            restConsumerProperties.getPort(), null, true, false);
+            restConsumerProperties.getPort(),
+            restConsumerProperties.isSniHostCheck(),
+            null,
+            true,
+            false
+        );
+
         if (restConsumerProperties.isAaf()) {
             server.addFilterClass(null, ApexRestServerAafFilter.class.getName());
         }
index bf24d22..a77ec17 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2019 Nordix Foundation.
+ *  Modifications Copyright (C) 2019,2023 Nordix Foundation.
  *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -72,6 +72,7 @@ public class RestServerCarrierTechnologyParameters extends CarrierTechnologyPara
     private String userName;
     private String password;
     private boolean https;
+    private boolean sniHostCheck;
     private boolean aaf;
     // @formatter:on
 
index 8596cee..d1488df 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2020 Nordix Foundation.
+ *  Copyright (C) 2019-2020,2023 Nordix Foundation.
  *  Modifications Copyright (C) 2020-2021 Bell Canada. All rights reserved.
  *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
@@ -77,7 +77,7 @@ public class TestExecutionPropertyRest {
         }
 
         server = HttpServletServerFactoryInstance.getServerFactory().build("TestExecutionPropertyRest", false, null,
-            PORT, "/TestExecutionRest", false, false);
+            PORT, false, "/TestExecutionRest", false, false);
 
         server.addServletClass(null, TestRestClientEndpoint.class.getName());
         server.setSerializationProvider(GsonMessageBodyHandler.class.getName());
index 04a1e6f..5683b48 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2019-2020,2023 Nordix Foundation.
  *  Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -75,7 +75,7 @@ public class TestFile2Rest {
      */
     @BeforeClass
     public static void setUp() throws Exception {
-        server = HttpServletServerFactoryInstance.getServerFactory().build("TestFile2Rest", false, null, PORT,
+        server = HttpServletServerFactoryInstance.getServerFactory().build("TestFile2Rest", false, null, PORT, false,
                 "/TestFile2Rest", false, false);
 
         server.addServletClass(null, TestRestClientEndpoint.class.getName());
index 0aeb196..34aaab8 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2019-2020,2023 Nordix Foundation.
  *  Modifications Copyright (C) 2020-2021 Bell Canada. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -78,7 +78,7 @@ public class TestRest2File {
      */
     @Before
     public void setUp() throws Exception {
-        server = HttpServletServerFactoryInstance.getServerFactory().build("TestRest2File", false, null, PORT,
+        server = HttpServletServerFactoryInstance.getServerFactory().build("TestRest2File", false, null, PORT, false,
             "/TestRest2File", false, false);
 
         server.addServletClass(null, TestRestClientEndpoint.class.getName());
index 9713bcb..6555383 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2020 Nordix Foundation.
+ *  Copyright (C) 2020,2023 Nordix Foundation.
  *  Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -56,7 +56,6 @@ public class TestTaskParameters {
     private static final int PORT = 32801;
     private static final String HOST = "localhost";
 
-
     /**
      * Sets up a server for testing.
      *
@@ -68,8 +67,9 @@ public class TestTaskParameters {
             throw new IllegalStateException("port " + PORT + " is still in use");
         }
 
-        server = HttpServletServerFactoryInstance.getServerFactory().build("TestTaskParameters", false, null, PORT,
-            "/TestTaskParametersRest", false, false);
+        server =
+            HttpServletServerFactoryInstance.getServerFactory().build("TestTaskParameters", false, null, PORT, false,
+                "/TestTaskParametersRest", false, false);
 
         server.addServletClass(null, RestClientEndpointForTaskParameters.class.getName());
         server.setSerializationProvider(GsonMessageBodyHandler.class.getName());
@@ -153,7 +153,9 @@ public class TestTaskParameters {
         // @formatter:on
 
         new ApexCliToscaEditorMain(cliArgs);
-        final String[] args = {"target/classes/APEXPolicy.json"};
+        final String[] args = {
+            "target/classes/APEXPolicy.json"
+        };
         // clear the details set in server
         client.target("http://" + HOST + ":" + PORT + "/TestTaskParametersRest/apex/event/clearDetails")
             .request("application/json").get();