<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-library</artifactId>
+ <scope>test</scope>
+ </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.10.19</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
/**
- * ============LICENSE_START===================================================
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved.
* Copyright (c) 2018-2019 European Software Marketing Ltd.
- * ============================================================================
+ * ================================================================================
* 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
* 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.
- * ============LICENSE_END=====================================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.validation;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestPropertySource;
/**
* Invoke the Spring Boot Application (primarily for code coverage).
*
*/
+@SpringBootTest(classes = ValidationServiceApplication.class)
+@TestPropertySource(locations = {"classpath:oxm-reader/schemaIngest.properties", "classpath:application.properties"})
+@ContextConfiguration(locations = {"classpath:validation-service-beans.xml"})
public class TestApplication {
@Rule
public void init() {
System.setProperty("CONFIG_HOME", "src/test/resources/model-validation/instance-validator");
System.setProperty("APP_HOME", ".");
+ System.setProperty("schema.translator.list", "config");
System.clearProperty("KEY_STORE_PASSWORD");
}
ValidationServiceApplication.main(null);
}
+ @Test
+ public void testApplicationWithNullKeyStorePassword() {
+ expectedEx.expect(IllegalArgumentException.class);
+ expectedEx.expectMessage("roperty KEY_STORE_PASSWORD not set");
+ ValidationServiceApplication.main(new String[] {});
+ }
+
}
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2018-2019 European Software Marketing Ltd.
+ * ================================================================================
* 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
+ * 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.
- * ============LICENSE_END=====================================================
+ * ============LICENSE_END=========================================================
*/
+
package org.onap.aai.validation.config;
import static org.hamcrest.Matchers.containsInAnyOrder;
import java.util.List;
import java.util.Properties;
-import javax.annotation.Resource;
import javax.inject.Inject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.validation.config.TopicConfig.Topic;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Import;
import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
+@SpringBootTest
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:/topic-config/test-validation-service-beans.xml"})
+@Import(TopicPropertiesConfig.class)
+@TestPropertySource(locations = { "classpath:test-application.properties" })
+@ContextConfiguration(locations = { "classpath:topic-config/test-validation-service-beans.xml" })
public class TestTopicConfig {
static {
}
@Inject
- private TopicConfig topicConfigurations;
+ private TopicConfig topicConfig;
- @Resource(name = "topicProperties")
+ @Inject
private Properties topicProperties;
-
@Test
public void testGetTopicProperties() throws Exception {
assertThat(topicProperties.getProperty("aai-event.name"), is("aai-event"));
assertThat(topicProperties.getProperty("aai-data-export.name"), is("aai-data-export"));
}
-
-
@Test
public void testGetConsumerTopicsFromTopicConfig() throws Exception {
- assertThat(topicConfigurations.getConsumerTopicNames(), containsInAnyOrder("aai-event", "aai-data-export"));
+ assertThat(topicConfig.getConsumerTopicNames(), containsInAnyOrder("aai-event", "aai-data-export"));
}
-
@Test
public void testGetConsumerTopicConfigurationObjects() throws Exception {
Topic eventTopic = new TopicConfig("aai-event", "aai-data-integrity").new Topic();
exportTopic.setConsumerId("export-dummy-consumer-id");
exportTopic.setTransportType("export-dummy-transport-type");
- List<Topic> consumerTopics = topicConfigurations.getConsumerTopics();
+ List<Topic> consumerTopics = topicConfig.getConsumerTopics();
assertThat(consumerTopics, containsInAnyOrder(eventTopic, exportTopic));
}
integrityTopic.setPassword("integrity-dummy-password");
integrityTopic.setTransportType("integrity-dummy-transport-type");
- List<Topic> publisherTopics = topicConfigurations.getPublisherTopics();
+ List<Topic> publisherTopics = topicConfig.getPublisherTopics();
assertThat(publisherTopics, containsInAnyOrder(integrityTopic));
}
-
-
}
/**
- * ============LICENSE_START===================================================
- * Copyright (c) 2018-2019 Amdocs
- * ============================================================================
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2018-2019 European Software Marketing Ltd.
+ * ================================================================================
* 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
* 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.
- * ============LICENSE_END=====================================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.validation.modeldriven.validator;
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.MockitoAnnotations;
import org.onap.aai.validation.controller.ValidationController;
import org.onap.aai.validation.result.ValidationResult;
import org.onap.aai.validation.result.Violation;
import org.onap.aai.validation.test.util.TestUtil;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+@SpringBootTest
@RunWith(SpringJUnit4ClassRunner.class)
@TestPropertySource(locations = {"classpath:oxm-reader/schemaIngest.properties"})
@ContextConfiguration(locations = {"classpath:model-validation/instance-validator/test-validation-service-beans.xml"})
private static final String MODEL_ID_ATTRIBUTE_MNV = "model-name-version-id";
private static final String MODEL_ID_ATTRIBUTE_MID = "model-id";
- @Mock
+ @MockBean
private ModelCacheManager mockModelCacheManager;
- @InjectMocks
@Inject
private ModelDrivenValidator modelDrivenValidator;
/**
- * ============LICENSE_START===================================================
- * Copyright (c) 2018-2019 Amdocs
- * ============================================================================
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2018-2019 European Software Marketing Ltd.
+ * ================================================================================
* 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
* 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.
- * ============LICENSE_END=====================================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.validation.services;
import org.onap.aai.validation.publisher.MockEventPublisher;
import org.onap.aai.validation.test.util.TestEntity;
import org.onap.aai.validation.test.util.TestUtil;
+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;
+@SpringBootTest
@RunWith(SpringJUnit4ClassRunner.class)
-@TestPropertySource(locations = {"classpath:oxm-reader/schemaIngest.properties", "classpath:application.properties"})
-@ContextConfiguration(locations = {"classpath:/info-service/test-validation-service-beans.xml"})
+@TestPropertySource(locations = { "classpath:oxm-reader/schemaIngest.properties", "classpath:application.properties" })
+@ContextConfiguration(locations = { "classpath:/info-service/test-validation-service-beans.xml" })
public class TestInfoService {
static {
}
enum TestData {
- // @formatter:off
- VSERVER("rule-driven-validator/test_events/vserver-create-event.json");
- // @formatter:on
+ VSERVER(
+ "rule-driven-validator/test_events/vserver-create-event.json"
+ );
private String filename;
--- /dev/null
+consumer.topic.names=aai-event,aai-data-export
+publisher.topic.names=aai-data-integrity
+
+topics.properties.location=src/test/resources/topic-config/
+
+server.ssl.key-store=