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;
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;
@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);
@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();
}
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;
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";
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);
.withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestDetailsFilter.json"))))
.withStatus(HttpStatus.SC_OK)));
}
-}
\ No newline at end of file
+}
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;
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;
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
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);
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);
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;
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;
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;
@Autowired
private ActivateVnfStatusOperationalEnvironment activateVnfStatus;
- @Autowired
- private InfraActiveRequestsRepository infraActiveRequestsRepository;
- @Autowired
- private ActivateVnfDBHelper dbHelper;
@Rule
public ExpectedException thrown = ExpectedException.none();
.withStatus(HttpStatus.SC_OK)));
activateVnfStatus.checkOrUpdateOverallStatus(operationalEnvironmentId, requestIdOrig);
-
- // do nothing, waiting for more
- assertNull(infraActiveRequestsRepository.findOne(requestIdOrig));
- }
+ }
@Test
public void executionTest_Ok() throws Exception {
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;
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;