e8fbbbd573ab1e145b6c59ba09b841cd108c7f97
[aaf/authz.git] / cadi / aaf / src / test / java / org / onap / aaf / cadi / oauth / test / JU_TokenClientFactoryTest.java
1 /**
2  * ============LICENSE_START====================================================
3  * org.onap.aaf
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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====================================================
19  *
20  */
21
22 package org.onap.aaf.cadi.oauth.test;
23
24 import java.io.IOException;
25 import java.net.URISyntaxException;
26 import java.security.GeneralSecurityException;
27
28 import org.junit.Test;
29 import org.onap.aaf.cadi.CadiException;
30 import org.onap.aaf.cadi.LocatorException;
31 import org.onap.aaf.cadi.PropAccess;
32 import org.onap.aaf.cadi.aaf.v2_0.AAFLocator;
33 import org.onap.aaf.cadi.config.Config;
34 import org.onap.aaf.cadi.locator.PropertyLocator;
35 import org.onap.aaf.cadi.oauth.TokenClientFactory;
36 import org.onap.aaf.misc.env.APIException;
37
38 import junit.framework.Assert;
39
40 public class JU_TokenClientFactoryTest  {
41
42     /**
43      * Acceptable Locator Patterns for choosing AAFLocator over others
44      */
45     @Test
46     public void testLocatorString() {
47         /*
48         PropAccess access = new PropAccess();
49         access.setProperty(Config.AAF_LOCATE_URL, "https://xytz.sbbc.dd:8095/locate");
50         access.setProperty(Config.CADI_LATITUDE, "39.000");
51         access.setProperty(Config.CADI_LONGITUDE, "-72.000");
52         TokenClientFactory tcf;
53         try {
54             System.out.println("one");
55             tcf = TokenClientFactory.instance(access);
56             System.out.println("two");
57             Assert.assertEquals(true, tcf.bestLocator("https://xytz.sbbc.dd/locate/hello") instanceof AAFLocator);
58             System.out.println("three");
59             Assert.assertEquals(true, tcf.bestLocator("https://xytz.sbbc.dd:8234/locate/hello") instanceof AAFLocator);
60             System.out.println("four");
61             Assert.assertEquals(true, tcf.bestLocator("https://AAF_LOCATE_URL/hello") instanceof AAFLocator);
62             System.out.println("five");
63             Assert.assertEquals(true, tcf.bestLocator("https://AAF_LOCATE_URL/AAF_FS.hello/2.0") instanceof AAFLocator);
64             System.out.println("six");
65             Assert.assertEquals(true, tcf.bestLocator("https://xytz.sbbc.dd:8234/locate") instanceof PropertyLocator);
66             System.out.println("seven");
67             Assert.assertEquals(true, tcf.bestLocator("https://xytz.sbbc.dd:8234/Something") instanceof PropertyLocator);
68         } catch (APIException | GeneralSecurityException | IOException | CadiException | LocatorException | URISyntaxException e) {
69             e.printStackTrace();
70             Assert.fail();
71         }
72         */
73     }
74
75 }