summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorEric Debeau <eric.debeau@orange.com>2019-02-21 13:18:47 +0000
committerGerrit Code Review <gerrit@onap.org>2019-02-21 13:18:47 +0000
commitb9c025acf17c887ee3a98d8f9b2efe316270b60a (patch)
treeb97876482194be911a4a2cdbc8dc258f10d5ae35 /src/test
parent526d2fc3562ccafa503ce5d086a7f4da6f2f3393 (diff)
parent7093b767e7d9a76c4f91ec98e95a9b1ea8a5e14d (diff)
Merge "Update to Spring Boot 2"
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/nbi/test/ExecutionTaskTest.java50
-rw-r--r--src/test/java/org/onap/nbi/test/ServiceOrderRepositoryTest.java6
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