1 /*******************************************************************************
2 * ============LICENSE_START=======================================================
3 * ONAP : ccsdk feature sdnr wt
4 * ================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property.
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=========================================================
20 ******************************************************************************/
21 package org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeConnector.test;
23 import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.DcaeConfig;
24 import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.DcaeMessages;
25 import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.DcaeSenderImpl;
27 public class DcaeTestClient {
29 private static final boolean TESTCOLLECTOR_YES = true;
31 public static void main(String[] args) {
33 System.out.println("Test program to verify DCAE https connectivity");
36 DcaeConfig configuration = DcaeConfig.getDefaultConfiguration();
38 if (configuration != null) {
41 System.out.println("Configuration: "+configuration);
43 DcaeSenderImpl dcaeClient = new DcaeSenderImpl(configuration.getEventReveicerUrl(), configuration.getUserCredentials());
45 if (TESTCOLLECTOR_YES) {
46 System.out.println("Connect to testclient and send notifications");
48 DcaeMessages dcaeMessages = new DcaeMessages(dcaeClient, "ControllerName", 31, null);
50 for (int t=0; t < 2; t++) {
52 Thread.sleep(1000); //1000 milliseconds is one second.
53 } catch(InterruptedException ex) {
54 Thread.currentThread().interrupt();
56 System.out.println(t+". Send notification and receive answer message");
57 System.out.println("Heartbeat message: "+dcaeMessages.postHeartBeat());
58 System.out.println("Status of ECOMP Client: "+dcaeClient.getStatusAsString());
63 System.out.println("Connect to server and receive initial answer.");
64 System.out.println("Message: "+dcaeClient.testConnectServer());