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.cadi.aaf.v2_0;
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertFalse;
25 import static org.junit.Assert.assertNull;
26 import static org.junit.Assert.assertTrue;
27 import static org.mockito.MockitoAnnotations.initMocks;
30 import java.net.URISyntaxException;
32 import org.junit.Before;
33 import org.junit.Test;
34 import org.mockito.Mock;
35 import org.mockito.Mockito;
36 import org.onap.aaf.cadi.AbsUserCache;
37 import org.onap.aaf.cadi.Locator;
38 import org.onap.aaf.cadi.LocatorException;
39 import org.onap.aaf.cadi.PropAccess;
40 import org.onap.aaf.cadi.aaf.AAFPermission;
43 public class JU_AAFSingleLocator {
49 AbsUserCache<AAFPermission> cache;
52 PropAccess propaccess;
55 AAFSingleLocator authnObj;
61 authnObj = new AAFSingleLocator("http://www.google.com");
62 } catch (URISyntaxException e) {
63 // TODO Auto-generated catch block
69 public void testGetRealm() {
71 URI retVal = authnObj.get(Mockito.mock( Locator.Item.class));
72 assertEquals("www.google.com",retVal.getHost());
73 } catch (LocatorException e) {
74 // TODO Auto-generated catch block
80 public void testHasItem() {
81 boolean retVal = authnObj.hasItems();
86 public void testInvalidate() {
88 authnObj.invalidate(Mockito.mock( Locator.Item.class));
89 } catch (LocatorException e) {
90 // TODO Auto-generated catch block
96 public void testBest() {
98 Locator.Item retVal = authnObj.best();
99 assertTrue(retVal.toString().contains("org.onap.aaf.cadi.aaf.v2_0.AAFSingleLocator$SingleItem"));
100 } catch (LocatorException e) {
101 // TODO Auto-generated catch block
106 public void testFirst() {
108 Locator.Item retVal = authnObj.first();
109 assertTrue(retVal.toString().contains("org.onap.aaf.cadi.aaf.v2_0.AAFSingleLocator$SingleItem"));
110 } catch (LocatorException e) {
111 // TODO Auto-generated catch block
116 public void testNext() {
118 Locator.Item retVal = authnObj.next(Mockito.mock( Locator.Item.class));
120 } catch (LocatorException e) {
121 // TODO Auto-generated catch block
127 public void testRefres() {
128 boolean retVal = authnObj.refresh();
133 public void testdestroy() {