2  * ============LICENSE_START=======================================================
\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 
  11  *     http://www.apache.org/licenses/LICENSE-2.0
\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 
  20 package org.onap.datalake.feeder.util;
\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 
  30 import java.io.IOException;
\r 
  32 import static org.junit.Assert.assertNotNull;
\r 
  33 import static org.junit.Assert.assertEquals;
\r 
  36  * Test DruidSupervisorGenerator
\r 
  38  * @author Guobiao Mo
\r 
  41 @RunWith(SpringJUnit4ClassRunner.class)
\r 
  42 @SpringBootTest(classes = ApplicationConfiguration.class)
\r 
  44 public class DruidSupervisorGeneratorTest {
\r 
  47     private ApplicationConfiguration config;
\r 
  50     public void testConstructor() throws IOException {
\r 
  51         DruidSupervisorGenerator gen = new DruidSupervisorGenerator();
\r 
  52         VelocityContext context = gen.getContext();
\r 
  54         assertNotNull(context);
\r 
  55         assertNotNull(gen.getDimensions());
\r 
  56         assertNotNull(gen.getTemplate());
\r 
  58         String host = (String) context.get("host");
\r 
  59         assertEquals(host, config.getDmaapKafkaHostPort());
\r 
  61         String[] strArray2 = {"test1", "test2", "test3"};
\r 
  63         DruidSupervisorGenerator.main(strArray2);
\r