2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2018 AT&T Intellectual Property. 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.aaf.auth.batch.test;
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNull;
25 import static org.junit.Assert.assertTrue;
26 import static org.mockito.Mockito.when;
27 import static org.mockito.MockitoAnnotations.initMocks;
29 import org.junit.Before;
30 import org.junit.Test;
31 import org.mockito.Mock;
32 import org.onap.aaf.auth.batch.actions.Message;
33 import org.onap.aaf.auth.batch.helpers.Creator;
34 import org.onap.aaf.auth.batch.helpers.Notification;
35 import org.onap.aaf.auth.batch.helpers.Notification.TYPE;
36 import org.onap.aaf.auth.env.AuthzTrans;
37 import org.onap.aaf.misc.env.Env;
38 import org.onap.aaf.misc.env.LogTarget;
39 import org.onap.aaf.misc.env.TimeTaken;
41 public class JU_NotificationTest {
44 private AuthzTrans trans;
46 private Creator<Notification> creator;
51 private LogTarget logTarget;
55 public void setUp() throws Exception {
59 msg.line("%n", "Message");
61 when(trans.info()).thenReturn(logTarget);
62 when(trans.start("Load Notify", Env.REMOTE)).thenReturn(tt);
67 Notification notification = Notification.create("user", TYPE.CN);
68 assertEquals(notification.checksum(), 0);
69 notification.set(msg);
70 assertEquals(notification.checksum(), 10);
71 assertNull(Notification.get("user", TYPE.CN));
72 assertTrue(notification.update(trans, null, true));
73 assertTrue(notification.toString().contains("\"user\",\"CN\","));