8a9f07791ab79353d7375f866773b41696aa500b
[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 org.apache.velocity.VelocityContext;\r
23 import org.junit.Test;\r
24 import org.junit.runner.RunWith;\r
25 import org.onap.datalake.feeder.config.ApplicationConfiguration;\r
26 import org.springframework.beans.factory.annotation.Autowired;\r
27 import org.springframework.boot.test.context.SpringBootTest;\r
28 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;\r
29 \r
30 import java.io.IOException;\r
31 \r
32 import static org.junit.Assert.assertNotNull;\r
33 import static org.junit.Assert.assertEquals;\r
34 \r
35 /**\r
36  * Test DruidSupervisorGenerator\r
37  *\r
38  * @author Guobiao Mo\r
39  */\r
40 \r
41 @RunWith(SpringJUnit4ClassRunner.class)\r
42 @SpringBootTest(classes = ApplicationConfiguration.class)\r
43 \r
44 public class DruidSupervisorGeneratorTest {\r
45 \r
46     @Autowired\r
47     private ApplicationConfiguration config;\r
48 \r
49     @Test\r
50     public void testConstructor() throws IOException {\r
51         DruidSupervisorGenerator gen = new DruidSupervisorGenerator();\r
52         VelocityContext context = gen.getContext();\r
53 \r
54         assertNotNull(context);\r
55         assertNotNull(gen.getDimensions());\r
56         assertNotNull(gen.getTemplate());\r
57 \r
58         String host = (String) context.get("host");\r
59         assertEquals(host, config.getDmaapKafkaHostPort());\r
60 \r
61         String[] strArray2 = {"test1", "test2", "test3"};\r
62 \r
63         DruidSupervisorGenerator.main(strArray2);\r
64     }\r
65 }\r