2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt mountpoint-registrar
4 * =================================================================================================
5 * Copyright (C) 2021 Samsung Electronics Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
19 package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test;
21 import static org.junit.Assert.*;
23 import org.junit.Test;
24 import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.CMBasicHeaderFieldsNotification;
25 import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.CMNotification;
27 public class TestCMNotificationBuilder {
29 private CMNotification cmNotification;
32 public void testCMNotificationBuilderWithAllDefinedFields() {
33 cmNotification = cmNotification.builder()
34 .withCMBasicHeaderFieldsNotification(CMBasicHeaderFieldsNotification.builder()
35 .withCMNodeId("test-node")
37 .withCMOccurrenceTime("2021-10-18T15:25:19.948Z")
38 .withSourceId("src_device_id_1732")
39 .withNotificationType("notifyMOIChanges")
41 .withCMNotificationId("123")
42 .withCMSourceIndicator("UNKNOWN")
43 .withCMPath("http://samsung.com/ves=1")
44 .withCMOperation("CREATE")
48 assertEquals("test-node", cmNotification.getBasicHeaderFields().getCmNodeId());
49 assertEquals("1", cmNotification.getBasicHeaderFields().getCmSequence());
50 assertEquals("src_device_id_1732", cmNotification.getBasicHeaderFields().getSourceId());
51 assertEquals("2021-10-18T15:25:19.948Z", cmNotification.getBasicHeaderFields().getCmOccurrenceTime());
52 assertEquals("notifyMOIChanges", cmNotification.getBasicHeaderFields().getNotificationType());
53 assertEquals("123", cmNotification.getCmNotificationId());
54 assertEquals("UNKNOWN", cmNotification.getCmSourceIndicator());
55 assertEquals("http://samsung.com/ves=1", cmNotification.getCmPath());
56 assertEquals("CREATE", cmNotification.getCmOperation());
57 assertEquals("value", cmNotification.getCmValue());
61 public void testCMNotificationBuilderWithDefaultCMOperation() {
62 cmNotification = cmNotification.builder()
63 .withCMBasicHeaderFieldsNotification(CMBasicHeaderFieldsNotification.builder()
64 .withCMNodeId("test-node")
66 .withCMOccurrenceTime("2021-10-18T15:25:19.948Z")
67 .withSourceId("src_device_id_1732")
68 .withNotificationType("notifyMOIChanges")
70 .withCMNotificationId("123")
71 .withCMSourceIndicator("UNKNOWN")
72 .withCMPath("http://samsung.com/ves=1")
75 assertEquals("test-node", cmNotification.getBasicHeaderFields().getCmNodeId());
76 assertEquals("NULL", cmNotification.getCmOperation());
77 assertNull(cmNotification.getCmValue());