2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.asdc.util;
23 import static org.junit.Assert.assertTrue;
25 import java.util.ArrayList;
26 import java.util.List;
28 import org.junit.Test;
29 import org.onap.sdc.api.notification.IArtifactInfo;
30 import org.onap.sdc.api.notification.INotificationData;
31 import org.onap.sdc.api.notification.IResourceInstance;
32 import org.onap.so.asdc.installer.IVfModuleData;
33 import org.onap.so.asdc.installer.VfModuleMetaData;
34 import org.onap.so.asdc.util.ASDCNotificationLogging;
36 public class ASDCNotificationLoggingTest {
38 public void dumpASDCNotificationTestForNull() throws Exception {
39 INotificationData asdcNotification = iNotificationDataObject();
41 String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification);
43 assertTrue(!result.equalsIgnoreCase("NULL"));
46 private INotificationData iNotificationDataObject() {
47 INotificationData iNotification = new INotificationData() {
50 public String getServiceVersion() {
51 return "DistributionID";
55 public String getServiceUUID() {
60 public String getServiceName() {
65 public String getServiceInvariantUUID() {
66 return "ServiceInvariantUUID";
70 public String getServiceDescription() {
75 public List<IArtifactInfo> getServiceArtifacts() {
76 return new ArrayList();
80 public List<IResourceInstance> getResources() {
81 return new ArrayList();
85 public String getDistributionID() {
90 public IArtifactInfo getArtifactMetadataByUUID(String arg0) {
95 public String getWorkloadContext() {
96 // TODO Auto-generated method stub
101 public void setWorkloadContext(String arg0) {
102 // TODO Auto-generated method stub
106 return iNotification;
110 public void dumpASDCNotificationTest() throws Exception {
111 INotificationData asdcNotification = iNotificationDataObject();
112 String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification);
114 assertTrue(!result.equalsIgnoreCase("NULL"));
118 public void dumpVfModuleMetaDataListTest() {
119 INotificationData asdcNotification = iNotificationDataObject();
120 List<IVfModuleData> list = new ArrayList<>();
121 list.add(new VfModuleMetaData());
122 String result = null;
124 result = ASDCNotificationLogging.dumpVfModuleMetaDataList(list);
125 } catch (Exception e) {
128 assertTrue(result == null);
132 public IArtifactInfo getIArtifactInfo() {
133 return new IArtifactInfo() {
136 public List<IArtifactInfo> getRelatedArtifacts() {
141 public IArtifactInfo getGeneratedArtifact() {
146 public String getArtifactVersion() {
151 public String getArtifactUUID() {
156 public String getArtifactURL() {
161 public String getArtifactType() {
166 public Integer getArtifactTimeout() {
171 public String getArtifactName() {
176 public String getArtifactDescription() {
181 public String getArtifactChecksum() {