1 /*******************************************************************************
\r
2 * ============LICENSE_START====================================================
\r
4 * * ===========================================================================
\r
5 * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * * Copyright © 2017 Amdocs
\r
7 * * ===========================================================================
\r
8 * * Licensed under the Apache License, Version 2.0 (the "License");
\r
9 * * you may not use this file except in compliance with the License.
\r
10 * * You may obtain a copy of the License at
\r
12 * * http://www.apache.org/licenses/LICENSE-2.0
\r
14 * * Unless required by applicable law or agreed to in writing, software
\r
15 * * distributed under the License is distributed on an "AS IS" BASIS,
\r
16 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
17 * * See the License for the specific language governing permissions and
\r
18 * * limitations under the License.
\r
19 * * ============LICENSE_END====================================================
\r
21 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
23 ******************************************************************************/
\r
24 package com.client.test;
\r
26 import java.net.URI;
\r
28 import org.junit.AfterClass;
\r
29 import org.junit.Test;
\r
31 import static org.junit.Assert.*;
\r
33 import com.att.cadi.Locator.Item;
\r
34 import com.att.cadi.locator.PropertyLocator;
\r
36 public class JU_PropertyLocator {
\r
39 public static void tearDownAfterClass() throws Exception {
\r
43 public void test() throws Exception {
\r
44 PropertyLocator pl = new PropertyLocator("https://localhost:2345,https://fred.wilma.com:26444,https://tom.jerry.com:534");
\r
48 boolean print = false;
\r
49 for(int j=0;j<900000;++j) {
\r
51 for(i = pl.first();i!=null;i=pl.next(i)) {
\r
52 URI loc = pl.get(i);
\r
53 if(print)System.out.println(loc.toString());
\r
56 assertEquals(3,count);
\r
57 assertTrue(pl.hasItems());
\r
58 if(print)System.out.println("---");
\r
59 pl.invalidate(pl.best());
\r
62 for(i = pl.first();i!=null;i=pl.next(i)) {
\r
63 URI loc = pl.get(i);
\r
64 if(print)System.out.println(loc.toString());
\r
68 assertEquals(2,count);
\r
69 assertTrue(pl.hasItems());
\r
70 if(print)System.out.println("---");
\r
71 pl.invalidate(pl.best());
\r
74 for(i = pl.first();i!=null;i=pl.next(i)) {
\r
75 URI loc = pl.get(i);
\r
76 if(print)System.out.println(loc.toString());
\r
80 assertEquals(1,count);
\r
81 assertTrue(pl.hasItems());
\r
82 if(print)System.out.println("---");
\r
83 pl.invalidate(pl.best());
\r
86 for(i = pl.first();i!=null;i=pl.next(i)) {
\r
87 URI loc = pl.get(i);
\r
88 if(print)System.out.println(loc.toString());
\r
92 assertEquals(0,count);
\r
93 assertFalse(pl.hasItems());
\r