1 /*******************************************************************************
2 * ============LICENSE_START====================================================
4 * * ===========================================================================
5 * * Copyright © 2017 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
11 * * http://www.apache.org/licenses/LICENSE-2.0
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====================================================
21 ******************************************************************************/
22 package org.onap.aaf.client.test;
24 import java.io.IOException;
25 import java.io.InputStream;
26 import java.util.Properties;
28 import org.onap.aaf.cadi.Access;
29 import org.onap.aaf.cadi.CadiException;
30 import org.onap.aaf.cadi.Symm;
32 // TODO: Ian [JUnit] JU_TestAccess isn't implementing all abstract methdods of Access
33 public class JU_TestAccess implements Access {
36 public JU_TestAccess() throws CadiException {
37 symm = Symm.obtain(this);
40 public void log(Level level, Object... elements) {
42 for(int i=0;i<elements.length;++i) {
43 if(first)first = false;
44 else System.out.print(' ');
45 System.out.print(elements[i].toString());
50 public void log(Exception e, Object... elements) {
52 log(Level.ERROR,elements);
56 public void printf(Level level, String fmt, Object... elements) {
58 System.out.printf(fmt, elements);
62 public void setLogLevel(Level level) {
66 public ClassLoader classLoader() {
67 return ClassLoader.getSystemClassLoader();
70 public String getProperty(String string, String def) {
71 String rv = System.getProperty(string);
72 return rv==null?def:rv;
75 public void load(InputStream is) throws IOException {
79 public String decrypt(String encrypted, boolean anytext) throws IOException {
80 return (encrypted!=null && (anytext==true || encrypted.startsWith(Symm.ENC)))
81 ? symm.depass(encrypted)
86 * @see org.onap.aaf.cadi.Access#willLog(org.onap.aaf.cadi.Access.Level)
89 public boolean willLog(Level level) {
94 public Properties getProperties() {
95 return System.getProperties();