2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2017 AT&T Intellectual Property. All rights
 
   7  * ================================================================================
 
   8  * Licensed under the Apache License, Version 2.0 (the "License");
 
   9  * you may not use this file except in compliance with the License.
 
  10  * You may obtain a copy of the License at
 
  12  *      http://www.apache.org/licenses/LICENSE-2.0
 
  14  * Unless required by applicable law or agreed to in writing, software
 
  15  * distributed under the License is distributed on an "AS IS" BASIS,
 
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  17  * See the License for the specific language governing permissions and
 
  18  * limitations under the License.
 
  19  * ============LICENSE_END=========================================================
 
  22 package org.openecomp.appc.listener.CL.impl;
 
  24 import static org.junit.Assert.assertNotNull;
 
  26 import java.util.Properties;
 
  28 import org.junit.Before;
 
  29 import org.junit.Test;
 
  30 import org.openecomp.appc.configuration.ConfigurationFactory;
 
  31 import org.openecomp.appc.listener.EventHandler;
 
  32 import org.openecomp.appc.listener.ListenerProperties;
 
  33 import org.openecomp.appc.listener.CL.impl.ProviderOperations;
 
  34 import org.openecomp.appc.listener.CL.impl.WorkerImpl;
 
  35 import org.openecomp.appc.listener.CL.model.IncomingMessage;
 
  36 import org.openecomp.appc.listener.impl.EventHandlerImpl;
 
  37 import org.slf4j.Logger;
 
  38 import org.slf4j.LoggerFactory;
 
  40 public class TestWorker {
 
  42     private static final Logger LOG = LoggerFactory.getLogger(WorkerImpl.class);
 
  44     private IncomingMessage msg;
 
  45     private EventHandler dmaap;
 
  49         Properties props = ConfigurationFactory.getConfiguration().getProperties();
 
  50         String activeEndpoint = props.getProperty("appc.ClosedLoop.provider.url");
 
  51         assertNotNull(activeEndpoint);
 
  52         ProviderOperations.setUrl(activeEndpoint);
 
  54         String vmUrl = props.getProperty("test.vm_url");
 
  56         msg = new IncomingMessage();
 
  57         // Client and Time are for ID
 
  58         msg.setRequestClient("APPC");
 
  59         msg.setRequestTime("TEST");
 
  60         msg.setRequest("Restart");
 
  63         dmaap = new EventHandlerImpl(new ListenerProperties("appc.ClosedLoop", props));
 
  67     public void testWorker() {
 
  68         WorkerImpl w = new WorkerImpl(msg, dmaap);