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 org.onap.aaf.client.test;
\r
25 import java.net.URI;
\r
27 import org.junit.AfterClass;
\r
28 import org.junit.Test;
\r
29 import org.onap.aaf.cadi.Locator.Item;
\r
30 import org.onap.aaf.cadi.locator.PropertyLocator;
\r
32 import static org.junit.Assert.*;
\r
34 public class JU_PropertyLocator {
\r
37 public static void tearDownAfterClass() throws Exception {
\r
41 public void test() throws Exception {
\r
42 PropertyLocator pl = new PropertyLocator("https://localhost:2345,https://fred.wilma.com:26444,https://tom.jerry.com:534");
\r
46 boolean print = false;
\r
47 for(int j=0;j<900000;++j) {
\r
49 for(i = pl.first();i!=null;i=pl.next(i)) {
\r
50 URI loc = pl.get(i);
\r
51 if(print)System.out.println(loc.toString());
\r
54 assertEquals(3,count);
\r
55 assertTrue(pl.hasItems());
\r
56 if(print)System.out.println("---");
\r
57 pl.invalidate(pl.best());
\r
60 for(i = pl.first();i!=null;i=pl.next(i)) {
\r
61 URI loc = pl.get(i);
\r
62 if(print)System.out.println(loc.toString());
\r
66 assertEquals(2,count);
\r
67 assertTrue(pl.hasItems());
\r
68 if(print)System.out.println("---");
\r
69 pl.invalidate(pl.best());
\r
72 for(i = pl.first();i!=null;i=pl.next(i)) {
\r
73 URI loc = pl.get(i);
\r
74 if(print)System.out.println(loc.toString());
\r
78 assertEquals(1,count);
\r
79 assertTrue(pl.hasItems());
\r
80 if(print)System.out.println("---");
\r
81 pl.invalidate(pl.best());
\r
84 for(i = pl.first();i!=null;i=pl.next(i)) {
\r
85 URI loc = pl.get(i);
\r
86 if(print)System.out.println(loc.toString());
\r
90 assertEquals(0,count);
\r
91 assertFalse(pl.hasItems());
\r