summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/aai/validation/config/TestTopicConfig.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/onap/aai/validation/config/TestTopicConfig.java')
-rw-r--r--src/test/java/org/onap/aai/validation/config/TestTopicConfig.java42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/test/java/org/onap/aai/validation/config/TestTopicConfig.java b/src/test/java/org/onap/aai/validation/config/TestTopicConfig.java
index 30e28d8..f323331 100644
--- a/src/test/java/org/onap/aai/validation/config/TestTopicConfig.java
+++ b/src/test/java/org/onap/aai/validation/config/TestTopicConfig.java
@@ -1,20 +1,24 @@
-/*
- * ============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;
@@ -23,17 +27,21 @@ import static org.junit.Assert.assertThat;
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 {
@@ -41,26 +49,22 @@ public class TestTopicConfig {
}
@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();
@@ -81,7 +85,7 @@ public class TestTopicConfig {
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));
}
@@ -96,10 +100,8 @@ public class TestTopicConfig {
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));
}
-
-
}