1 /*******************************************************************************
\r
2 * ============LICENSE_START====================================================
\r
4 * * ===========================================================================
\r
5 * * Copyright © 2017 AT&T Intellectual Property. 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
20 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
22 ******************************************************************************/
\r
23 package com.onap.aaf.cadi.aaf;
\r
25 import static org.junit.Assert.*;
\r
27 import org.junit.Test;
\r
29 import static org.junit.Assert.*;
\r
30 import static org.mockito.Mockito.when;
\r
32 import java.io.IOException;
\r
33 import java.security.Principal;
\r
35 import org.junit.Before;
\r
36 import org.junit.Test;
\r
37 import org.mockito.Mock;
\r
38 import org.mockito.MockitoAnnotations;
\r
39 import org.onap.aaf.cadi.aaf.AAFTransmutate;
\r
40 import org.onap.aaf.cadi.lur.ConfigPrincipal;
\r
41 import org.onap.aaf.cadi.principal.BasicPrincipal;
\r
43 public class AAFTransmutateTest {
\r
46 Principal principal ;
\r
49 public void setup() {
\r
50 MockitoAnnotations.initMocks(this);
\r
51 when(principal.getName()).thenReturn("Value");
\r
55 public void testMutate() throws IOException {
\r
56 BasicPrincipal p = new BasicPrincipal("content", "domain");
\r
57 AAFTransmutate transmutate = new AAFTransmutate();
\r
58 // assertNotNull(transmutate.mutate(p));
\r
60 ConfigPrincipal cp = new ConfigPrincipal("content", "cred");
\r
61 // assertNotNull(transmutate.mutate(cp));
\r
63 assertNull(transmutate.mutate(principal));
\r
68 public void testMutate4() throws IOException {
\r
69 BasicPrincipal p = new BasicPrincipal("content", "domain");
\r
70 AAFTransmutate transmutate = new AAFTransmutate();
\r
71 // assertNotNull(transmutate.mutate(p));
\r
73 ConfigPrincipal cp = new ConfigPrincipal("content", "cred");
\r
74 // assertNotNull(transmutate.mutate(cp));
\r
76 assertNull(transmutate.mutate(principal));
\r
81 public void testMutate1() throws IOException {
\r
82 BasicPrincipal p = new BasicPrincipal("content", "domain");
\r
83 AAFTransmutate transmutate = new AAFTransmutate();
\r
84 // assertNotNull(transmutate.mutate(p));
\r
86 ConfigPrincipal cp = new ConfigPrincipal("content", "cred");
\r
87 // assertNotNull(transmutate.mutate(cp));
\r
89 assertNull(transmutate.mutate(principal));
\r
94 public void testMutate2() throws IOException {
\r
95 BasicPrincipal p = new BasicPrincipal("content", "domain");
\r
96 AAFTransmutate transmutate = new AAFTransmutate();
\r
97 // assertNotNull(transmutate.mutate(p));
\r
99 ConfigPrincipal cp = new ConfigPrincipal("content", "cred");
\r
100 // assertNotNull(transmutate.mutate(cp));
\r
102 assertNull(transmutate.mutate(principal));
\r
107 public void testMutate3() throws IOException {
\r
108 BasicPrincipal p = new BasicPrincipal("content", "domain");
\r
109 AAFTransmutate transmutate = new AAFTransmutate();
\r
110 // assertNotNull(transmutate.mutate(p));
\r
112 ConfigPrincipal cp = new ConfigPrincipal("content", "cred");
\r
113 // assertNotNull(transmutate.mutate(cp));
\r
115 assertNull(transmutate.mutate(principal));
\r