2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
\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
21 package org.openecomp.mso.asdc.util.tests;
\r
23 import static org.junit.Assert.assertTrue;
\r
25 import java.util.ArrayList;
\r
26 import java.util.List;
\r
28 import org.junit.Test;
\r
29 import org.openecomp.mso.asdc.installer.IVfModuleData;
\r
30 import org.openecomp.mso.asdc.installer.VfModuleMetaData;
\r
31 import org.openecomp.mso.asdc.util.ASDCNotificationLogging;
\r
32 import org.openecomp.sdc.api.notification.IArtifactInfo;
\r
33 import org.openecomp.sdc.api.notification.INotificationData;
\r
34 import org.openecomp.sdc.api.notification.IResourceInstance;
\r
36 public class ASDCNotificationLoggingTest {
\r
38 public void dumpASDCNotificationTestForNull() throws Exception {
\r
39 INotificationData asdcNotification = iNotificationDataObject();
\r
41 String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification);
\r
43 assertTrue(!result.equalsIgnoreCase("NULL"));
\r
46 private INotificationData iNotificationDataObject() {
\r
47 INotificationData iNotification = new INotificationData() {
\r
50 public String getServiceVersion() {
\r
51 return "DistributionID";
\r
55 public String getServiceUUID() {
\r
60 public String getServiceName() {
\r
61 return "servername";
\r
65 public String getServiceInvariantUUID() {
\r
66 return "ServiceInvariantUUID";
\r
70 public String getServiceDescription() {
\r
71 return "Description";
\r
75 public List<IArtifactInfo> getServiceArtifacts() {
\r
76 return new ArrayList();
\r
80 public List<IResourceInstance> getResources() {
\r
81 return new ArrayList();
\r
85 public String getDistributionID() {
\r
90 public IArtifactInfo getArtifactMetadataByUUID(String arg0) {
\r
95 public String getWorkloadContext() {
\r
96 // TODO Auto-generated method stub
\r
101 public void setWorkloadContext(String arg0) {
\r
102 // TODO Auto-generated method stub
\r
106 return iNotification;
\r
110 public void dumpASDCNotificationTest() throws Exception {
\r
111 INotificationData asdcNotification = iNotificationDataObject();
\r
112 String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification);
\r
114 assertTrue(!result.equalsIgnoreCase("NULL"));
\r
118 public void dumpVfModuleMetaDataListTest() {
\r
119 INotificationData asdcNotification = iNotificationDataObject();
\r
120 List<IVfModuleData> list = new ArrayList<>();
\r
121 list.add(new VfModuleMetaData());
\r
122 String result = null;
\r
124 result = ASDCNotificationLogging.dumpVfModuleMetaDataList(list);
\r
125 } catch (Exception e) {
\r
128 assertTrue(result == null);
\r
132 public IArtifactInfo getIArtifactInfo() {
\r
133 return new IArtifactInfo() {
\r
136 public List<IArtifactInfo> getRelatedArtifacts() {
\r
141 public IArtifactInfo getGeneratedArtifact() {
\r
146 public String getArtifactVersion() {
\r
151 public String getArtifactUUID() {
\r
156 public String getArtifactURL() {
\r
161 public String getArtifactType() {
\r
166 public Integer getArtifactTimeout() {
\r
171 public String getArtifactName() {
\r
176 public String getArtifactDescription() {
\r
181 public String getArtifactChecksum() {
\r