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.client.test;
\r
25 import java.net.URI;
\r
27 import org.junit.AfterClass;
\r
28 import org.junit.Test;
\r
30 import static org.junit.Assert.*;
\r
32 import com.att.cadi.Locator.Item;
\r
33 import com.att.cadi.locator.PropertyLocator;
\r
35 public class JU_PropertyLocator {
\r
38 public static void tearDownAfterClass() throws Exception {
\r
42 public void test() throws Exception {
\r
43 PropertyLocator pl = new PropertyLocator("https://localhost:2345,https://fred.wilma.com:26444,https://tom.jerry.com:534");
\r
47 boolean print = false;
\r
48 for(int j=0;j<900000;++j) {
\r
50 for(i = pl.first();i!=null;i=pl.next(i)) {
\r
51 URI loc = pl.get(i);
\r
52 if(print)System.out.println(loc.toString());
\r
55 assertEquals(3,count);
\r
56 assertTrue(pl.hasItems());
\r
57 if(print)System.out.println("---");
\r
58 pl.invalidate(pl.best());
\r
61 for(i = pl.first();i!=null;i=pl.next(i)) {
\r
62 URI loc = pl.get(i);
\r
63 if(print)System.out.println(loc.toString());
\r
67 assertEquals(2,count);
\r
68 assertTrue(pl.hasItems());
\r
69 if(print)System.out.println("---");
\r
70 pl.invalidate(pl.best());
\r
73 for(i = pl.first();i!=null;i=pl.next(i)) {
\r
74 URI loc = pl.get(i);
\r
75 if(print)System.out.println(loc.toString());
\r
79 assertEquals(1,count);
\r
80 assertTrue(pl.hasItems());
\r
81 if(print)System.out.println("---");
\r
82 pl.invalidate(pl.best());
\r
85 for(i = pl.first();i!=null;i=pl.next(i)) {
\r
86 URI loc = pl.get(i);
\r
87 if(print)System.out.println(loc.toString());
\r
91 assertEquals(0,count);
\r
92 assertFalse(pl.hasItems());
\r