summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/onap')
-rw-r--r--src/test/java/org/onap/aai/validation/TestApplication.java9
-rw-r--r--src/test/java/org/onap/aai/validation/controller/TestValidationController.java32
-rw-r--r--src/test/java/org/onap/aai/validation/modeldriven/validator/TestInstanceReader.java2
-rw-r--r--src/test/java/org/onap/aai/validation/modeldriven/validator/TestModelDrivenValidator.java2
-rw-r--r--src/test/java/org/onap/aai/validation/reader/TestEventReader.java2
-rw-r--r--src/test/java/org/onap/aai/validation/reader/TestOxmReader.java2
-rw-r--r--src/test/java/org/onap/aai/validation/result/TestValidationResult.java2
-rw-r--r--src/test/java/org/onap/aai/validation/ruledriven/mock/TestDefaultRules.java9
-rw-r--r--src/test/java/org/onap/aai/validation/ruledriven/validator/TestDataDictionary.java2
-rw-r--r--src/test/java/org/onap/aai/validation/ruledriven/validator/TestRuleDrivenValidator.java2
-rw-r--r--src/test/java/org/onap/aai/validation/services/TestInfoService.java2
11 files changed, 34 insertions, 32 deletions
diff --git a/src/test/java/org/onap/aai/validation/TestApplication.java b/src/test/java/org/onap/aai/validation/TestApplication.java
index 9f66df9..13dc999 100644
--- a/src/test/java/org/onap/aai/validation/TestApplication.java
+++ b/src/test/java/org/onap/aai/validation/TestApplication.java
@@ -27,17 +27,20 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* Invoke the Spring Boot Application (primarily for code coverage).
*
*/
-@SpringBootTest(classes = ValidationServiceApplication.class)
-@TestPropertySource(locations = {"classpath:oxm-reader/schemaIngest.properties", "classpath:test-application.properties"})
-@ContextConfiguration(locations = {"classpath:validation-service-beans.xml"})
+@SpringBootTest
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {"classpath:data-dictionary/test-data-dictionary-beans.xml"})
+@TestPropertySource(locations = {"classpath:schema-ingest.properties", "classpath:test-application.properties"})
public class TestApplication {
@Rule
diff --git a/src/test/java/org/onap/aai/validation/controller/TestValidationController.java b/src/test/java/org/onap/aai/validation/controller/TestValidationController.java
index b35ed17..cab1cbb 100644
--- a/src/test/java/org/onap/aai/validation/controller/TestValidationController.java
+++ b/src/test/java/org/onap/aai/validation/controller/TestValidationController.java
@@ -17,26 +17,17 @@
*/
package org.onap.aai.validation.controller;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.stubbing.OngoingStubbing;
import org.onap.aai.validation.Validator;
import org.onap.aai.validation.config.ValidationControllerConfig;
import org.onap.aai.validation.exception.ValidationServiceError;
@@ -49,7 +40,11 @@ import org.onap.aai.validation.result.ValidationResult;
import org.onap.aai.validation.result.ValidationResultBuilder;
import org.onap.aai.validation.result.Violation;
-@RunWith(MockitoJUnitRunner.class)
+import java.util.*;
+
+import static org.mockito.Mockito.*;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
public class TestValidationController {
private static final String AAI_EVENT = "AAI-EVENT";
@@ -105,7 +100,6 @@ public class TestValidationController {
@Before
public void setupMocks() throws ValidationServiceException {
-
Map<String, List<ValidationResult>> validationResultsMap = setupTestData();
when(ruleDrivenValidator.validate(TESTDATA_EVENTTYPE_AAI))
@@ -263,16 +257,19 @@ public class TestValidationController {
@Test
public void testExecuteForNullDomain() throws Exception {
- doVerifyMockInteractionsTest(TESTDATA_DOMAIN_NULL, TEST);
+ doVerifyMockInteractionsTest(TESTDATA_DOMAIN_NULL, TEST, 2);
}
- private void doVerifyMockInteractionsTest(String event, String eventSource) throws Exception {
+ private void doVerifyMockInteractionsTest(String event, String eventSource, int eventReaderCallsCount) throws Exception {
validationController.execute(event, eventSource);
- verify(eventReader, times(1)).getEventType(Mockito.anyString());
+ verify(eventReader, times(eventReaderCallsCount)).getEventType(Mockito.anyString());
verify(ruleDrivenValidator, times(0)).validate(Mockito.anyString());
verify(modelDrivenValidator, times(0)).validate(Mockito.anyString());
verify(messagePublisher, times(0)).publishMessage(Mockito.anyString());
+ }
+ private void doVerifyMockInteractionsTest(String event, String eventSource) throws Exception {
+ doVerifyMockInteractionsTest(event, eventSource, 1);
}
@Test
@@ -318,7 +315,7 @@ public class TestValidationController {
@Test
public void testExecuteForEndEventType() throws Exception {
- doVerifyMockInteractionsTest(TESTDATA_EVENTTYPE_END_EVENT, TEST);
+ doVerifyMockInteractionsTest(TESTDATA_EVENTTYPE_END_EVENT, TEST, 2);
}
@Test
@@ -391,4 +388,5 @@ public class TestValidationController {
when(entity.getEntityLink()).thenReturn(ENTITY_LINK);
when(entity.getResourceVersion()).thenReturn(Optional.of(resourceVersion));
}
+
}
diff --git a/src/test/java/org/onap/aai/validation/modeldriven/validator/TestInstanceReader.java b/src/test/java/org/onap/aai/validation/modeldriven/validator/TestInstanceReader.java
index 4d076da..772ccd6 100644
--- a/src/test/java/org/onap/aai/validation/modeldriven/validator/TestInstanceReader.java
+++ b/src/test/java/org/onap/aai/validation/modeldriven/validator/TestInstanceReader.java
@@ -45,7 +45,7 @@ import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
-@TestPropertySource(locations = {"classpath:oxm-reader/schemaIngest.properties"})
+@TestPropertySource(locations = {"classpath:schema-ingest.properties"})
@ContextConfiguration(locations = {"classpath:model-validation/instance-reader/test-validation-service-beans.xml"})
public class TestInstanceReader {
diff --git a/src/test/java/org/onap/aai/validation/modeldriven/validator/TestModelDrivenValidator.java b/src/test/java/org/onap/aai/validation/modeldriven/validator/TestModelDrivenValidator.java
index 5a58f41..ea98a02 100644
--- a/src/test/java/org/onap/aai/validation/modeldriven/validator/TestModelDrivenValidator.java
+++ b/src/test/java/org/onap/aai/validation/modeldriven/validator/TestModelDrivenValidator.java
@@ -55,7 +55,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@SpringBootTest
@RunWith(SpringJUnit4ClassRunner.class)
-@TestPropertySource(locations = {"classpath:oxm-reader/schemaIngest.properties"})
+@TestPropertySource(locations = {"classpath:schema-ingest.properties"})
@ContextConfiguration(locations = {"classpath:model-validation/instance-validator/test-validation-service-beans.xml"})
public class TestModelDrivenValidator {
diff --git a/src/test/java/org/onap/aai/validation/reader/TestEventReader.java b/src/test/java/org/onap/aai/validation/reader/TestEventReader.java
index 844c010..1625cd2 100644
--- a/src/test/java/org/onap/aai/validation/reader/TestEventReader.java
+++ b/src/test/java/org/onap/aai/validation/reader/TestEventReader.java
@@ -45,7 +45,7 @@ import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
-@TestPropertySource(locations = {"classpath:oxm-reader/schemaIngest.properties"})
+@TestPropertySource(locations = {"classpath:schema-ingest.properties"})
@ContextConfiguration(locations = {"classpath:event-reader/test-validation-service-beans.xml"})
public class TestEventReader {
diff --git a/src/test/java/org/onap/aai/validation/reader/TestOxmReader.java b/src/test/java/org/onap/aai/validation/reader/TestOxmReader.java
index bbceae5..4432dfa 100644
--- a/src/test/java/org/onap/aai/validation/reader/TestOxmReader.java
+++ b/src/test/java/org/onap/aai/validation/reader/TestOxmReader.java
@@ -31,7 +31,7 @@ import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
-@TestPropertySource(locations = {"classpath:oxm-reader/schemaIngest.properties"})
+@TestPropertySource(locations = {"classpath:schema-ingest.properties"})
@ContextConfiguration(locations = {"classpath:oxm-reader/oxm-reader-beans.xml"})
public class TestOxmReader {
diff --git a/src/test/java/org/onap/aai/validation/result/TestValidationResult.java b/src/test/java/org/onap/aai/validation/result/TestValidationResult.java
index 7ce0b34..d1833f0 100644
--- a/src/test/java/org/onap/aai/validation/result/TestValidationResult.java
+++ b/src/test/java/org/onap/aai/validation/result/TestValidationResult.java
@@ -54,7 +54,7 @@ import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
-@TestPropertySource(locations = {"classpath:oxm-reader/schemaIngest.properties"})
+@TestPropertySource(locations = {"classpath:schema-ingest.properties"})
@ContextConfiguration(locations = {"classpath:validation-result/test-validation-service-beans.xml"})
public class TestValidationResult {
diff --git a/src/test/java/org/onap/aai/validation/ruledriven/mock/TestDefaultRules.java b/src/test/java/org/onap/aai/validation/ruledriven/mock/TestDefaultRules.java
index b87e4af..3695fca 100644
--- a/src/test/java/org/onap/aai/validation/ruledriven/mock/TestDefaultRules.java
+++ b/src/test/java/org/onap/aai/validation/ruledriven/mock/TestDefaultRules.java
@@ -24,8 +24,9 @@ package org.onap.aai.validation.ruledriven.mock;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
-import static org.mockito.Matchers.anyListOf;
-import static org.mockito.Matchers.anyString;
+import static org.mockito.ArgumentMatchers.anyListOf;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.when;
import com.google.gson.JsonObject;
@@ -41,7 +42,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.invocation.InvocationOnMock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.stubbing.Answer;
import org.onap.aai.validation.Validator;
import org.onap.aai.validation.exception.ValidationServiceException;
@@ -58,7 +59,7 @@ import org.onap.aai.validation.ruledriven.RuleDrivenValidator;
* for both a supported and an unsupported entity type.
*
*/
-@RunWith(MockitoJUnitRunner.class)
+@RunWith(MockitoJUnitRunner.Silent.class)
public class TestDefaultRules {
static {
diff --git a/src/test/java/org/onap/aai/validation/ruledriven/validator/TestDataDictionary.java b/src/test/java/org/onap/aai/validation/ruledriven/validator/TestDataDictionary.java
index 7292dec..108ee30 100644
--- a/src/test/java/org/onap/aai/validation/ruledriven/validator/TestDataDictionary.java
+++ b/src/test/java/org/onap/aai/validation/ruledriven/validator/TestDataDictionary.java
@@ -46,7 +46,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
-@TestPropertySource(locations = {"classpath:oxm-reader/schemaIngest.properties"})
+@TestPropertySource(locations = {"classpath:schema-ingest.properties"})
@ContextConfiguration(locations = {"classpath:data-dictionary/test-data-dictionary-beans.xml"})
public class TestDataDictionary {
diff --git a/src/test/java/org/onap/aai/validation/ruledriven/validator/TestRuleDrivenValidator.java b/src/test/java/org/onap/aai/validation/ruledriven/validator/TestRuleDrivenValidator.java
index 27039a0..f33e9e9 100644
--- a/src/test/java/org/onap/aai/validation/ruledriven/validator/TestRuleDrivenValidator.java
+++ b/src/test/java/org/onap/aai/validation/ruledriven/validator/TestRuleDrivenValidator.java
@@ -53,7 +53,7 @@ import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
-@TestPropertySource(locations = {"classpath:oxm-reader/schemaIngest.properties"})
+@TestPropertySource(locations = {"classpath:schema-ingest.properties"})
@ContextConfiguration(
locations = {"classpath:" + TestRuleDrivenValidator.UNIT_TEST_FOLDER + "/test-rule-driven-validator-beans.xml"})
public class TestRuleDrivenValidator {
diff --git a/src/test/java/org/onap/aai/validation/services/TestInfoService.java b/src/test/java/org/onap/aai/validation/services/TestInfoService.java
index c975d16..6090576 100644
--- a/src/test/java/org/onap/aai/validation/services/TestInfoService.java
+++ b/src/test/java/org/onap/aai/validation/services/TestInfoService.java
@@ -47,7 +47,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@SpringBootTest
@RunWith(SpringJUnit4ClassRunner.class)
-@TestPropertySource(locations = {"classpath:oxm-reader/schemaIngest.properties", "classpath:application.properties"})
+@TestPropertySource(locations = {"classpath:schema-ingest.properties", "classpath:application.properties"})
@ContextConfiguration(locations = {"classpath:/info-service/test-validation-service-beans.xml"})
public class TestInfoService {