aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/nbi/test/ApiTestWithoutOnap.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/onap/nbi/test/ApiTestWithoutOnap.java')
-rw-r--r--src/test/java/org/onap/nbi/test/ApiTestWithoutOnap.java169
1 files changed, 0 insertions, 169 deletions
diff --git a/src/test/java/org/onap/nbi/test/ApiTestWithoutOnap.java b/src/test/java/org/onap/nbi/test/ApiTestWithoutOnap.java
deleted file mode 100644
index 6e57673..0000000
--- a/src/test/java/org/onap/nbi/test/ApiTestWithoutOnap.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * Copyright (c) 2018 Orange
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.nbi.test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.After;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.nbi.apis.assertions.ServiceOrderExecutionTaskAssertions;
-import org.onap.nbi.apis.servicecatalog.ServiceSpecificationResource;
-import org.onap.nbi.apis.serviceinventory.ServiceInventoryResource;
-import org.onap.nbi.apis.serviceorder.ServiceOrderResource;
-import org.onap.nbi.apis.serviceorder.model.ActionType;
-import org.onap.nbi.apis.serviceorder.model.RelatedParty;
-import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
-import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
-import org.onap.nbi.apis.serviceorder.model.StateType;
-import org.onap.nbi.apis.serviceorder.model.orchestrator.ExecutionTask;
-import org.onap.nbi.apis.serviceorder.repositories.ExecutionTaskRepository;
-import org.onap.nbi.apis.serviceorder.repositories.ServiceOrderRepository;
-import org.onap.nbi.apis.serviceorder.workflow.SOTaskProcessor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.annotation.DirtiesContext.ClassMode;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
-
-@ActiveProfiles("test")
-@RunWith(SpringRunner.class)
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
-@DirtiesContext(classMode= ClassMode.AFTER_CLASS)
-public class ApiTestWithoutOnap {
-
-
- @Autowired
- ServiceOrderRepository serviceOrderRepository;
-
- @Autowired
- ExecutionTaskRepository executionTaskRepository;
-
- @Autowired
- SOTaskProcessor SoTaskProcessor;
-
- @Autowired
- ServiceSpecificationResource serviceSpecificationResource;
-
- @Autowired
- ServiceInventoryResource serviceInventoryResource;
-
- @Autowired
- ServiceOrderResource serviceOrderResource;
-
- @After
- public void tearsDownUpPort() throws Exception {
- executionTaskRepository.deleteAll();
- serviceOrderRepository.deleteAll();
- }
-
-
- public ExecutionTask getExecutionTask(String orderItemId) {
- for (ExecutionTask executionTask : executionTaskRepository.findAll()) {
- if (executionTask.getOrderItemId().equalsIgnoreCase(orderItemId)) {
- return executionTask;
- }
-
- }
- return null;
- }
-
-
-
- @Test
- public void testExecutionTaskWithoutOnap() throws Exception {
-
- ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions.setUpBddForExecutionTaskSucess(serviceOrderRepository,
- executionTaskRepository, ActionType.ADD);
-
- SoTaskProcessor.processOrderItem(executionTaskA);
- ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
- }
- assertThat(serviceOrderChecked.getOrderMessage().size()).isGreaterThan(0);
- assertThat(serviceOrderChecked.getOrderMessage().get(0).getCode()).isEqualTo("502");
- assertThat(serviceOrderChecked.getOrderMessage().get(0).getMessageInformation()).isEqualTo("Problem with SO API");
-
- assertThat(executionTaskRepository.count()).isEqualTo(0);
- }
-
-
- @Test
- public void testCheckServiceOrderWithSDCNotResponding() throws Exception {
-
- ServiceOrder testServiceOrder = ServiceOrderExecutionTaskAssertions.createTestServiceOrder(ActionType.ADD);
- List<RelatedParty> customers = new ArrayList<>();
- RelatedParty customer = new RelatedParty();
- customer.setId("new");
- customer.setRole("ONAPcustomer");
- customer.setName("romain");
- customers.add(customer);
- testServiceOrder.setRelatedParty(customers);
- testServiceOrder.setState(StateType.ACKNOWLEDGED);
- testServiceOrder.setId("test");
- serviceOrderRepository.save(testServiceOrder);
-
- serviceOrderResource.checkServiceOrder(testServiceOrder);
-
- ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.REJECTED);
-
- assertThat(serviceOrderChecked.getOrderMessage().size()).isGreaterThan(0);
- assertThat(serviceOrderChecked.getOrderMessage().get(0).getCode()).isEqualTo("500");
- assertThat(serviceOrderChecked.getOrderMessage().get(0).getMessageInformation()).isEqualTo("Problem with SDC API");
- }
-
-
-
- @Test
- public void testServiceCatalogGetResource() throws Exception {
-
- ResponseEntity<Object> resource = serviceSpecificationResource
- .getServiceSpecification("1e3feeb0-8e36-46c6-862c-236d9c626439", null);
- assertThat(resource.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
-
-
- }
-
-
-
- @Test
- public void testServiceResourceGetInventory() throws Exception {
-
- String serviceName = "vFW";
- String serviceId = "e4688e5f-61a0-4f8b-ae02-a2fbde623bcb";
- MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
- params.add("serviceSpecification.name", serviceName);
- params.add("relatedParty.id", "6490");
- ResponseEntity<Object> resource = serviceInventoryResource.getServiceInventory(serviceId, params);
- assertThat(resource.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
-
-
- }
-
-
-
-
-}