Move some tests from group 3 to group 5
[vid.git] / vid-automation / src / main / java / org / onap / vid / api / BaseApiTest.java
index 8492b9b..48ca526 100644 (file)
@@ -8,7 +8,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.isEmptyOrNullString;
 import static org.hamcrest.Matchers.not;
 
-//import com.automation.common.report_portal_integration.listeners.ReportPortalListener;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
@@ -21,7 +20,6 @@ import java.util.Properties;
 import java.util.Random;
 import java.util.TimeZone;
 import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
 import org.apache.commons.io.IOUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -39,6 +37,7 @@ import vid.automation.reportportal.ReportPortalListenerDelegator;
 import vid.automation.test.infra.FeaturesTogglingConfiguration;
 import vid.automation.test.services.UsersService;
 import vid.automation.test.utils.CookieAndJsonHttpHeadersInterceptor;
+import vid.automation.test.utils.InsecureHttpsClient;
 
 @Listeners(ReportPortalListenerDelegator.class)
 public class BaseApiTest {
@@ -51,16 +50,16 @@ public class BaseApiTest {
     @SuppressWarnings("WeakerAccess")
     protected Client client;
     protected Random random;
-    protected final RestTemplate restTemplate = new RestTemplate();
+    protected final RestTemplate restTemplate = InsecureHttpsClient.newRestTemplate();
 
-    protected final UsersService usersService = new UsersService();
-    protected final RestTemplate restTemplateErrorAgnostic = new RestTemplate();
+    protected static final UsersService usersService = new UsersService();
+    protected final RestTemplate restTemplateErrorAgnostic = InsecureHttpsClient.newRestTemplate();
 
     @BeforeClass
     public void init() {
         uri = getUri();
         objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
-        client = ClientBuilder.newClient();
+        client = InsecureHttpsClient.newJaxrsClient();
         client.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true);
         random = new Random(System.currentTimeMillis());
         FeaturesTogglingConfiguration.initializeFeatureManager();
@@ -69,7 +68,8 @@ public class BaseApiTest {
     private URI getUri() {
         String host = System.getProperty("VID_HOST", "127.0.0.1");
         int port = Integer.valueOf(System.getProperty("VID_PORT", "8080"));
-        return new JerseyUriBuilder().host(host).port(port).scheme("http").path("vid").build();
+        String protocol = System.getProperty("VID_PROTOCOL", "http");
+        return new JerseyUriBuilder().host(host).port(port).scheme(protocol).path("vid").build();
     }
 
     public void login() {