Add Notice of aaf/cadi source moving to aaf/authz
[aaf/cadi.git] / client / src / test / java / org / onap / aaf / client / test / JU_TestAccess.java
1 /*******************************************************************************\r
2  * ============LICENSE_START====================================================\r
3  * * org.onap.aaf\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
10  * * \r
11  *  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * * \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
19  * *\r
20  * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
21  * *\r
22  ******************************************************************************/\r
23 package org.onap.aaf.client.test;\r
24 \r
25 import java.io.IOException;\r
26 import java.io.InputStream;\r
27 \r
28 import org.onap.aaf.cadi.Access;\r
29 import org.onap.aaf.cadi.Symm;\r
30 \r
31 public class JU_TestAccess implements Access {\r
32         private Symm symm;\r
33 \r
34         public JU_TestAccess() {\r
35                 symm = Symm.obtain(this);\r
36         }\r
37         \r
38         public void log(Level level, Object... elements) {\r
39                 boolean first = true;\r
40                 for(int i=0;i<elements.length;++i) {\r
41                         if(first)first = false;\r
42                         else System.out.print(' ');\r
43                         System.out.print(elements[i].toString());\r
44                 }\r
45                 System.out.println();\r
46         }\r
47 \r
48         public void log(Exception e, Object... elements) {\r
49                 e.printStackTrace();\r
50                 log(Level.ERROR,elements);\r
51         }\r
52 \r
53         public void setLogLevel(Level level) {\r
54                 \r
55         }\r
56 \r
57         public ClassLoader classLoader() {\r
58                 return ClassLoader.getSystemClassLoader();\r
59         }\r
60 \r
61         public String getProperty(String string, String def) {\r
62                 String rv = System.getProperty(string);\r
63                 return rv==null?def:rv;\r
64         }\r
65 \r
66         public void load(InputStream is) throws IOException {\r
67                 \r
68         }\r
69 \r
70         public String decrypt(String encrypted, boolean anytext) throws IOException {\r
71                 return (encrypted!=null && (anytext==true || encrypted.startsWith(Symm.ENC)))\r
72                         ? symm.depass(encrypted)\r
73                         : encrypted;\r
74         }\r
75 \r
76         /* (non-Javadoc)\r
77          * @see com.att.cadi.Access#willLog(com.att.cadi.Access.Level)\r
78          */\r
79         @Override\r
80         public boolean willLog(Level level) {\r
81                 return true;\r
82         }\r
83 \r
84         @Override\r
85         public void printf(Level level, String fmt, Object... elements) {\r
86                 // TODO Auto-generated method stub\r
87                 \r
88         }\r
89 \r
90 }\r