cleaned up missed repo interactions 67/65367/2
authorBenjamin, Max (mb388a) <mb388a@us.att.com>
Sat, 8 Sep 2018 15:40:35 +0000 (11:40 -0400)
committerBenjamin, Max (mb388a) <mb388a@us.att.com>
Sun, 9 Sep 2018 02:33:28 +0000 (22:33 -0400)
-Missed oen file from the previous commit
- Removing any left out repository imports and dependencies from the
api handle

Change-Id: I5447d1a9f20b2e50243432e4570dec7aa27c7061
Issue-ID: SO-996
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java

index d273040..52ed34a 100644 (file)
@@ -28,7 +28,6 @@ import com.github.tomakehurst.wiremock.client.WireMock;
 import org.junit.After;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
 import org.onap.so.logger.MsoLogger;
 import org.onap.so.logger.MsoLogger.Catalog;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -45,8 +44,7 @@ import org.springframework.test.context.jdbc.Sql.ExecutionPhase;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import javax.transaction.Transactional;
-import java.io.File;
-import java.io.IOException;
+
 import java.nio.file.Files;
 import java.nio.file.Paths;
 
@@ -55,7 +53,7 @@ import java.nio.file.Paths;
 @ActiveProfiles("test")
 @ContextConfiguration
 @Transactional
-@Sql(executionPhase=ExecutionPhase.AFTER_TEST_METHOD,scripts="classpath:InfraActiveRequestsReset.sql")
+//@Sql(executionPhase=ExecutionPhase.AFTER_TEST_METHOD,scripts="classpath:InfraActiveRequestsReset.sql")
 @AutoConfigureWireMock(port = 0)
 public abstract class BaseTest {
        protected MsoLogger logger = MsoLogger.getMsoLogger(Catalog.GENERAL, BaseTest.class);
@@ -65,26 +63,16 @@ public abstract class BaseTest {
 
        @Autowired
        protected Environment env;
-       
-       @Autowired
-       protected InfraActiveRequestsRepository iar;
-       
+
        @LocalServerPort
        private int port;
        
-       protected String readJsonFileAsString(String fileLocation) throws JsonParseException, JsonMappingException, IOException{
-               ObjectMapper mapper = new ObjectMapper();
-               JsonNode jsonNode = mapper.readTree(new File(fileLocation));
-               return jsonNode.asText();
-       }
-       
        protected String createURLWithPort(String uri) {
                return "http://localhost:" + port + uri;
        }
        
        @After
        public void tearDown(){
-               iar.deleteAll();
                WireMock.reset();
        }
 
index 9df66ed..0af9826 100644 (file)
@@ -51,7 +51,6 @@ import org.junit.Test;
 import org.onap.so.apihandler.common.ErrorNumbers;
 import org.onap.so.db.request.beans.InfraActiveRequests;
 import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
 import org.onap.so.exceptions.ValidationException;
 import org.onap.so.serviceinstancebeans.GetOrchestrationListResponse;
 import org.onap.so.serviceinstancebeans.GetOrchestrationResponse;
@@ -72,16 +71,12 @@ import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
 public class OrchestrationRequestsTest extends BaseTest {
-    @Autowired
-    private InfraActiveRequestsRepository iar;
-
     @Autowired
     private RequestsDbClient requestsDbClient;
     
     @Autowired 
     private OrchestrationRequests orchReq;
 
-    private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
     private static final GetOrchestrationListResponse ORCHESTRATION_LIST = generateOrchestrationList();
     private static final String INVALID_REQUEST_ID = "invalid-request-id";
 
@@ -341,7 +336,7 @@ public class OrchestrationRequestsTest extends BaseTest {
         requests.setRequestId("requestId");
         requests.setRequestScope("service");
         requests.setRequestType("createInstance");
-        iar.save(requests);
+//        iar.save(requests);
 
         headers.set("Accept", MediaType.APPLICATION_JSON);
         headers.set("Content-Type", MediaType.APPLICATION_JSON);
@@ -441,4 +436,4 @@ public class OrchestrationRequestsTest extends BaseTest {
                 .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestDetailsFilter.json"))))
                 .withStatus(HttpStatus.SC_OK)));
     }
-}
\ No newline at end of file
+}
index e759752..1e11b74 100644 (file)
@@ -30,7 +30,6 @@ import org.onap.so.apihandlerinfra.Status;
 import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
 import org.onap.so.apihandlerinfra.tenantisolationbeans.TenantIsolationRequest;
 import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.springframework.boot.context.embedded.LocalServerPort;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpMethod;
index 5f18e28..8ac84d6 100644 (file)
@@ -25,9 +25,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.onap.so.apihandlerinfra.BaseTest;
 import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.context.embedded.LocalServerPort;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpMethod;
@@ -44,15 +41,8 @@ import static org.junit.Assert.assertTrue;
 
 public class CloudResourcesOrchestrationTest extends BaseTest{
        
-       @Autowired
-       private InfraActiveRequestsRepository iarRepo;
        private String requestJSON = "{\"requestDetails\":{\"requestInfo\":{\"source\":\"VID\",\"requestorId\":\"xxxxxx\" } } }";
        private static final String path = "/onap/so/infra/cloudResourcesRequests";
-       
-       @LocalServerPort
-       private int port;
-
-
 
        HttpHeaders headers = new HttpHeaders();
        @Before
@@ -275,8 +265,6 @@ public class CloudResourcesOrchestrationTest extends BaseTest{
                iar.setRequestStatus("COMPLETE");
                iar.setRequestAction("TEST");
                
-               iarRepo.saveAndFlush(iar);
-
                headers.set("Accept", MediaType.APPLICATION_JSON);
                headers.set("Content-Type", MediaType.APPLICATION_JSON);
                HttpEntity<String> entity = new HttpEntity<>("", headers);
@@ -303,8 +291,6 @@ public class CloudResourcesOrchestrationTest extends BaseTest{
                iar.setRequestStatus("COMPLETE");
                iar.setRequestAction("TEST");
                
-               iarRepo.saveAndFlush(iar);
-
                headers.set("Accept", MediaType.APPLICATION_JSON);
                headers.set("Content-Type", MediaType.APPLICATION_JSON);
                HttpEntity<String> entity = new HttpEntity<>(null, headers);
index eba9049..9a53340 100644 (file)
@@ -30,8 +30,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
 import static com.github.tomakehurst.wiremock.client.WireMock.containing;
 import static org.hamcrest.Matchers.startsWith;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+
 import static org.junit.Assert.assertThat;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -39,7 +38,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.http.HttpStatus;
 import org.json.JSONObject;
 import org.junit.Rule;
-import org.junit.After;
 import org.junit.Test;
 import org.junit.Ignore;
 import org.junit.rules.ExpectedException;
@@ -47,16 +45,12 @@ import org.onap.so.apihandler.common.ErrorNumbers;
 import org.onap.so.apihandlerinfra.BaseTest;
 import org.onap.so.apihandlerinfra.exceptions.ApiException;
 import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
-import org.onap.so.apihandlerinfra.tenantisolation.helpers.ActivateVnfDBHelper;
 import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
 import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus;
 import org.onap.so.apihandlerinfra.tenantisolationbeans.Status;
 import org.onap.so.db.request.beans.InfraActiveRequests;
 import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
 import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
-import org.onap.so.db.request.data.repository.OperationalEnvDistributionStatusRepository;
-import org.onap.so.db.request.data.repository.OperationalEnvServiceModelStatusRepository;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import javax.ws.rs.core.HttpHeaders;
@@ -66,10 +60,6 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
 
        @Autowired
        private ActivateVnfStatusOperationalEnvironment activateVnfStatus;
-       @Autowired
-       private InfraActiveRequestsRepository infraActiveRequestsRepository;
-       @Autowired
-       private ActivateVnfDBHelper dbHelper;
     @Rule
     public ExpectedException thrown = ExpectedException.none();
 
@@ -185,10 +175,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
                                                .withStatus(HttpStatus.SC_OK)));
                
                activateVnfStatus.checkOrUpdateOverallStatus(operationalEnvironmentId, requestIdOrig);
-               
-               // do nothing, waiting for more
-               assertNull(infraActiveRequestsRepository.findOne(requestIdOrig));
-       }               
+       }
        
        @Test
        public void executionTest_Ok() throws Exception {
index 1dfafce..809e39c 100644 (file)
@@ -40,7 +40,6 @@ import org.onap.so.client.aai.objects.AAIOperationalEnvironment;
 import org.onap.so.client.grm.beans.Property;
 import org.onap.so.client.grm.beans.ServiceEndPointList;
 import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
index 5b0e1f6..7c24050 100644 (file)
@@ -37,7 +37,6 @@ import org.onap.so.apihandlerinfra.exceptions.ValidateException;
 import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
 import org.onap.so.client.aai.AAIVersion;
 import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import javax.ws.rs.core.HttpHeaders;