1 /*******************************************************************************
2 * ============LICENSE_START====================================================
4 * * ===========================================================================
5 * * Copyright © 2017 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 ******************************************************************************/
22 package org.onap.aaf.client.test;
26 import org.junit.AfterClass;
27 import org.junit.Test;
28 import org.onap.aaf.cadi.Locator.Item;
29 import org.onap.aaf.cadi.locator.PropertyLocator;
31 import static org.junit.Assert.*;
33 public class JU_PropertyLocator {
36 public static void tearDownAfterClass() throws Exception {
40 public void test() throws Exception {
41 PropertyLocator pl = new PropertyLocator("https://localhost:2345,https://fred.wilma.com:26444,https://tom.jerry.com:534");
45 boolean print = false;
46 for(int j=0;j<900000;++j) {
48 for(i = pl.first();i!=null;i=pl.next(i)) {
50 if(print)System.out.println(loc.toString());
53 assertEquals(3,count);
54 assertTrue(pl.hasItems());
55 if(print)System.out.println("---");
56 pl.invalidate(pl.best());
59 for(i = pl.first();i!=null;i=pl.next(i)) {
61 if(print)System.out.println(loc.toString());
65 assertEquals(2,count);
66 assertTrue(pl.hasItems());
67 if(print)System.out.println("---");
68 pl.invalidate(pl.best());
71 for(i = pl.first();i!=null;i=pl.next(i)) {
73 if(print)System.out.println(loc.toString());
77 assertEquals(1,count);
78 assertTrue(pl.hasItems());
79 if(print)System.out.println("---");
80 pl.invalidate(pl.best());
83 for(i = pl.first();i!=null;i=pl.next(i)) {
85 if(print)System.out.println(loc.toString());
89 assertEquals(0,count);
90 assertFalse(pl.hasItems());