diff options
author | romaingimbert <romain.gimbert@orange.com> | 2019-02-01 15:05:15 +0100 |
---|---|---|
committer | romaingimbert <romain.gimbert@orange.com> | 2019-02-01 15:05:15 +0100 |
commit | 7093b767e7d9a76c4f91ec98e95a9b1ea8a5e14d (patch) | |
tree | bf5d63b7d170504e490ca415345543d855dcbf62 /src/test/java | |
parent | 2afa1a1b9b020c0ada15581658268e98b7219a64 (diff) |
Update to Spring Boot 2
-update pom dependencies
-fix code
-fix test
Change-Id: I23c3c702c598ce46e5b861a2fbdfd06f2d439c51
Issue-ID: EXTAPI-192
Signed-off-by: romaingimbert <romain.gimbert@orange.com>
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/org/onap/nbi/test/ExecutionTaskTest.java | 50 | ||||
-rw-r--r-- | src/test/java/org/onap/nbi/test/ServiceOrderRepositoryTest.java | 6 |
2 files changed, 31 insertions, 25 deletions
diff --git a/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java b/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java index bc51541..7bc8a41 100644 --- a/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java +++ b/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java @@ -24,6 +24,7 @@ import com.github.tomakehurst.wiremock.stubbing.StubMapping; import java.util.Calendar; import java.util.Date; import java.util.List; +import java.util.Optional; import javax.validation.Validation; import javax.validation.Validator; import javax.validation.ValidatorFactory; @@ -120,7 +121,10 @@ public class ExecutionTaskTest { } - + private ServiceOrder getServiceOrder(String serviceOrderId) { + Optional<ServiceOrder> serviceOrderChecked = serviceOrderRepository.findById(serviceOrderId); + return serviceOrderChecked.get(); + } @@ -133,7 +137,7 @@ public class ExecutionTaskTest { SoTaskProcessor.processOrderItem(executionTaskA); - ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test"); + ServiceOrder serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { if (serviceOrderItem.getId().equals("A")) { @@ -149,7 +153,7 @@ public class ExecutionTaskTest { assertThat(executionTaskA).isNull(); SoTaskProcessor.processOrderItem(executionTaskB); - serviceOrderChecked = serviceOrderRepository.findOne("test"); + serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED); @@ -171,7 +175,7 @@ public class ExecutionTaskTest { SoTaskProcessor.processOrderItem(executionTaskA); - ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test"); + ServiceOrder serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { if (serviceOrderItem.getId().equals("A")) { @@ -187,7 +191,7 @@ public class ExecutionTaskTest { assertThat(executionTaskA).isNull(); SoTaskProcessor.processOrderItem(executionTaskB); - serviceOrderChecked = serviceOrderRepository.findOne("test"); + serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED); @@ -209,7 +213,7 @@ public class ExecutionTaskTest { SoTaskProcessor.processOrderItem(executionTaskA); - ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test"); + ServiceOrder serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { if (serviceOrderItem.getId().equals("A")) { @@ -225,7 +229,7 @@ public class ExecutionTaskTest { assertThat(executionTaskA).isNull(); SoTaskProcessor.processOrderItem(executionTaskB); - serviceOrderChecked = serviceOrderRepository.findOne("test"); + serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED); @@ -247,7 +251,7 @@ public class ExecutionTaskTest { SoTaskProcessor.processOrderItem(executionTaskA); - ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test"); + ServiceOrder serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { if (serviceOrderItem.getId().equals("A")) { @@ -263,7 +267,7 @@ public class ExecutionTaskTest { assertThat(executionTaskA).isNull(); SoTaskProcessor.processOrderItem(executionTaskB); - serviceOrderChecked = serviceOrderRepository.findOne("test"); + serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED); @@ -287,7 +291,7 @@ public class ExecutionTaskTest { SoTaskProcessor.processOrderItem(executionTaskA); - ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test"); + ServiceOrder serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { if (serviceOrderItem.getId().equals("A")) { @@ -303,7 +307,7 @@ public class ExecutionTaskTest { changeCreationDate(executionTaskA); SoTaskProcessor.processOrderItem(executionTaskA); - serviceOrderChecked = serviceOrderRepository.findOne("test"); + serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED); @@ -333,7 +337,7 @@ public class ExecutionTaskTest { SoTaskProcessor.processOrderItem(executionTaskA); - ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test"); + ServiceOrder serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { if (serviceOrderItem.getId().equals("A")) { @@ -347,7 +351,7 @@ public class ExecutionTaskTest { changeCreationDate(executionTaskA); SoTaskProcessor.processOrderItem(executionTaskA); - serviceOrderChecked = serviceOrderRepository.findOne("test"); + serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED); @@ -369,7 +373,7 @@ public class ExecutionTaskTest { SoTaskProcessor.processOrderItem(executionTaskA); - ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test"); + ServiceOrder serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED); @@ -392,7 +396,7 @@ public class ExecutionTaskTest { SoTaskProcessor.processOrderItem(executionTaskA); - ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test"); + ServiceOrder serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED); @@ -413,7 +417,7 @@ public class ExecutionTaskTest { SoTaskProcessor.processOrderItem(executionTaskA); - ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test"); + ServiceOrder serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED); @@ -438,7 +442,7 @@ public class ExecutionTaskTest { SoTaskProcessor.processOrderItem(executionTaskA); - ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test"); + ServiceOrder serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED); @@ -466,7 +470,7 @@ public class ExecutionTaskTest { SoTaskProcessor.processOrderItem(executionTaskA); - ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test"); + ServiceOrder serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { if (serviceOrderItem.getId().equals("A")) { @@ -477,7 +481,7 @@ public class ExecutionTaskTest { } } SoTaskProcessor.processOrderItem(executionTaskA); - serviceOrderChecked = serviceOrderRepository.findOne("test"); + serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { if (serviceOrderItem.getId().equals("A")) { @@ -495,7 +499,7 @@ public class ExecutionTaskTest { SoTaskProcessor.processOrderItem(executionTaskB); SoTaskProcessor.processOrderItem(executionTaskB); - serviceOrderChecked = serviceOrderRepository.findOne("test"); + serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED); @@ -519,7 +523,7 @@ public class ExecutionTaskTest { SoTaskProcessor.processOrderItem(executionTaskA); - ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test"); + ServiceOrder serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { if (serviceOrderItem.getId().equals("A")) { @@ -534,7 +538,7 @@ public class ExecutionTaskTest { changeCreationDate(executionTaskA); SoTaskProcessor.processOrderItem(executionTaskA); - serviceOrderChecked = serviceOrderRepository.findOne("test"); + serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED); @@ -552,7 +556,7 @@ public class ExecutionTaskTest { executionTaskRepository, ActionType.ADD); SoTaskProcessor.processOrderItem(executionTaskA); - ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test"); + ServiceOrder serviceOrderChecked = getServiceOrder("test"); assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED); for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) { assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED); diff --git a/src/test/java/org/onap/nbi/test/ServiceOrderRepositoryTest.java b/src/test/java/org/onap/nbi/test/ServiceOrderRepositoryTest.java index 11ed493..fd83ec0 100644 --- a/src/test/java/org/onap/nbi/test/ServiceOrderRepositoryTest.java +++ b/src/test/java/org/onap/nbi/test/ServiceOrderRepositoryTest.java @@ -18,8 +18,10 @@ package org.onap.nbi.test; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.util.List; +import java.util.Optional; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -53,8 +55,8 @@ public class ServiceOrderRepositoryTest { @Test public void findById() { - ServiceOrder result = serviceOrderRepository.findOne("test"); - assertNotNull(result); + Optional<ServiceOrder> optionalServiceOrderChecked = serviceOrderRepository.findById("test"); + assertTrue(optionalServiceOrderChecked.isPresent()); } @Test |