f5a42bbb78c1105eeb9200ce87c5687050344390
[dcaegen2/services.git] /
1 /*\r
2 * ============LICENSE_START=======================================================\r
3 * ONAP : DataLake\r
4 * ================================================================================\r
5 * Copyright 2019 China Mobile\r
6 *=================================================================================\r
7 * Licensed under the Apache License, Version 2.0 (the "License");\r
8 * you may not use this file except in compliance with the License.\r
9 * You may obtain a copy of the License at\r
10 *\r
11 *     http://www.apache.org/licenses/LICENSE-2.0\r
12 *\r
13 * Unless required by applicable law or agreed to in writing, software\r
14 * distributed under the License is distributed on an "AS IS" BASIS,\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16 * See the License for the specific language governing permissions and\r
17 * limitations under the License.\r
18 * ============LICENSE_END=========================================================\r
19 */\r
20 package org.onap.datalake.feeder.util;\r
21 \r
22 import static org.junit.Assert.assertEquals;\r
23 import static org.junit.Assert.assertNotNull;\r
24 \r
25 import org.apache.velocity.VelocityContext;\r
26 import org.junit.Test;\r
27 import org.junit.runner.RunWith; \r
28 import org.onap.datalake.feeder.config.ApplicationConfiguration;\r
29 import org.springframework.beans.factory.annotation.Autowired; \r
30 import org.springframework.boot.test.context.SpringBootTest; \r
31 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;\r
32 \r
33 /**\r
34  * Test DruidSupervisorGenerator\r
35  * @author Guobiao Mo\r
36  *\r
37  */\r
38 \r
39 @RunWith(SpringJUnit4ClassRunner.class)\r
40 @SpringBootTest(classes = ApplicationConfiguration.class)\r
41 \r
42 public class DruidSupervisorGeneratorTest {\r
43 \r
44         @Autowired\r
45         private ApplicationConfiguration config;\r
46 \r
47     @Test\r
48         public void testConstructor() {\r
49                 DruidSupervisorGenerator gen = new DruidSupervisorGenerator();\r
50                 VelocityContext context= gen.getContext();\r
51 \r
52                 assertNotNull(context);\r
53                 assertNotNull(gen.getDimensions() );\r
54                 assertNotNull(gen.getTemplate() );\r
55                 \r
56                 String host = (String) context.get("host");             \r
57                 assertEquals(host, config.getDmaapKafkaHostPort());                                             \r
58         }\r
59 }\r