summaryrefslogtreecommitdiffstats
path: root/cadi/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'cadi/client/src')
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsAuthentication.java22
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsTransferSS.java12
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/BasicAuth.java4
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/EClient.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/Future.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java70
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/Result.java8
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/Retryable.java10
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HAuthorizationHeader.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HBasicAuthSS.java12
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java56
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java34
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HNoAuthSS.java4
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HRcli.java20
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HSecurityInfoInit.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HTokenSS.java4
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HTransferSS.java8
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HX509SS.java28
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java22
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/HClientHotPeerLocator.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java20
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java24
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java50
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsAuthentication.java22
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsTransferSS.java16
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Future.java12
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java6
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Rcli.java66
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Result.java10
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Retryable.java8
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HAuthorizationHeader.java10
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HBasicAuthSS.java22
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HClient.java4
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HMangr.java18
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HNoAuthSS.java12
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HRcli.java24
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTokenSS.java6
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTransferSS.java16
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HX509SS.java26
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java26
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_HClientHotPeerLocator.java8
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_PropertyLocator.java8
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/routing/test/JU_GreatCircle.java4
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/client/test/JU_ResultTest.java10
46 files changed, 392 insertions, 392 deletions
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsAuthentication.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsAuthentication.java
index da85702d..1db9317a 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsAuthentication.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsAuthentication.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,19 +29,19 @@ import org.onap.aaf.cadi.config.SecurityInfoC;
/**
* AbsAuthentication is a class representing how to Authenticate onto a Client.
- *
+ *
* Methods of setting Authentication on a Client vary, so CLIENT is a Generic Type
- * This allows the ability to apply security onto Different Client Types, as they come
+ * This allows the ability to apply security onto Different Client Types, as they come
* into vogue, or change over time.
- *
+ *
* Password is encrypted at rest.
- *
+ *
* @author Jonathan
*
* @param <CLIENT>
*/
public abstract class AbsAuthentication<CLIENT> implements SecuritySetter<CLIENT> {
- // HTTP Header for Authentication is "Authorization". This was from an early stage of internet where
+ // HTTP Header for Authentication is "Authorization". This was from an early stage of internet where
// Access by Credential "Authorized" you for everything on the site. Since those early days, it became
// clear that "full access" wasn't appropriate, so the split between Authentication and Authorization
// came into being... But the Header remains.
@@ -57,14 +57,14 @@ public abstract class AbsAuthentication<CLIENT> implements SecuritySetter<CLIENT
protected final SecurityInfoC<CLIENT> securityInfo;
protected long lastMiss;
protected int count;
-
+
static {
try {
symm = Symm.encrypt.obtain();
} catch (IOException e) {
throw new RuntimeException("Cannot create critical internal encryption key",e);
}
-
+
}
public AbsAuthentication(final SecurityInfoC<CLIENT> securityInfo, final String user, final byte[] headValue) throws IOException {
@@ -82,11 +82,11 @@ public abstract class AbsAuthentication<CLIENT> implements SecuritySetter<CLIENT
return new String(symm.decode(headValue));
}
}
-
+
protected void setUser(String id) {
user = id;
}
-
+
@Override
public String getID() {
return user;
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsTransferSS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsTransferSS.java
index baac6daa..80234460 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsTransferSS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsTransferSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,10 +29,10 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
/**
* This client represents the ability to Transfer the Identity of the caller to the authenticated
- * user being transferred to. This ability is critical for App-to-App communication to ensure that
+ * user being transferred to. This ability is critical for App-to-App communication to ensure that
* Authorization can happen on the End-Users' credentials when appropriate, even though Authentication
* to App1 by App2 must be by App2's credentials.
- *
+ *
* @author Jonathan
*
* @param <CLIENT>
@@ -59,8 +59,8 @@ public abstract class AbsTransferSS<CLIENT> implements SecuritySetter<CLIENT> {
if (principal==null) {
return;
} else {
- value = principal.getName() + ':' +
- app + ':' +
+ value = principal.getName() + ':' +
+ app + ':' +
principal.tag() + ':' +
"AS";
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/BasicAuth.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/BasicAuth.java
index 1eb8d7c4..021229ce 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/BasicAuth.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/BasicAuth.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/EClient.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/EClient.java
index 9aa9cad6..7a437e39 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/EClient.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/EClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -44,7 +44,7 @@ public interface EClient<CT> {
public<T> Future<T> futureRead(RosettaDF<T> df,Data.TYPE type);
public<T> Future<T> future(T t);
public Future<Void> future(HttpServletResponse resp, int expected) throws APIException;
-
+
public interface Transfer {
public void transfer(OutputStream os) throws IOException, APIException;
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Future.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Future.java
index 39f88687..de32d959 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Future.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Future.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,7 +26,7 @@ import org.onap.aaf.cadi.CadiException;
public abstract class Future<T> {
public T value;
public abstract boolean get(int timeout) throws CadiException;
-
+
public abstract int code();
public abstract String body();
public abstract String header(String tag);
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java
index af97c465..8744e896 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,7 +36,7 @@ public class Holder<T> {
value = t;
return t;
}
-
+
public T get() {
return value;
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java
index 6b486b8e..cfc52fb4 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -94,9 +94,9 @@ public abstract class Rcli<CT> {
rv.apiVersion = apiVersion;
return rv;
}
-
+
protected abstract Rcli<CT> clone(URI uri, SecuritySetter<CT> ss);
-
+
public abstract void invalidate() throws CadiException;
public Rcli<CT> readTimeout(int millis) {
@@ -118,7 +118,7 @@ public abstract class Rcli<CT> {
this.apiVersion = apiVersion;
return this;
}
-
+
public boolean isApiVersion(String prospective) {
return apiVersion.equals(prospective);
}
@@ -294,7 +294,7 @@ public abstract class Rcli<CT> {
/**
* Read String, using POST for keyInfo
- *
+ *
* @param pathinfo
* @param df
* @param t
@@ -335,7 +335,7 @@ public abstract class Rcli<CT> {
*/
public<T,R> Future<R> readPost(String pathinfo, final RosettaDF<T> df, final T t, final RosettaDF<R> resp) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
-
+
EClient<CT> client = client();
client.setMethod(POST);
client.addHeader(CONTENT_TYPE,typeString(df.getTypeClass()));
@@ -371,11 +371,11 @@ public abstract class Rcli<CT> {
public Future<String> read(String pathinfo, String accept, String ... headers) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
-
+
EClient<CT> client = client();
client.setMethod(GET);
client.addHeader(ACCEPT, accept);
-
+
for (int i=1;i<headers.length;i=i+2) {
client.addHeader(headers[i-1],headers[i]);
}
@@ -416,7 +416,7 @@ public abstract class Rcli<CT> {
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
client.setFragment(pp.frag());
-
+
client.setPayload(null);
client.send();
return client.futureRead(df,type);
@@ -430,7 +430,7 @@ public abstract class Rcli<CT> {
client.addHeader(ACCEPT, typeString(cls));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(null);
client.send();
@@ -445,7 +445,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE,contentType);
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
public void transfer(OutputStream os) throws IOException, APIException {
@@ -455,16 +455,16 @@ public abstract class Rcli<CT> {
client.send();
return client.future(t);
}
-
+
public<T> Future<String> updateRespondString(String pathinfo, final RosettaDF<T> df, final T t) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
-
+
EClient<CT> client = client();
client.setMethod(PUT);
client.addHeader(CONTENT_TYPE, typeString(df.getTypeClass()));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
@@ -476,7 +476,7 @@ public abstract class Rcli<CT> {
client.send();
return client.futureReadString();
}
-
+
public Future<String> update(String pathinfo, String contentType, EClient.Transfer content) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
@@ -502,8 +502,8 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, typeString(df.getTypeClass()));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
-
+ client.setFragment(pp.frag());
+
client.setPayload(new EClient.Transfer() {
@Override
public void transfer(OutputStream os) throws IOException, APIException {
@@ -513,16 +513,16 @@ public abstract class Rcli<CT> {
client.send();
return client.future(t);
}
-
+
public<T> Future<T> update(String pathinfo, Class<?> cls, final RosettaDF<T> df, final T t) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
-
+
EClient<CT> client = client();
client.setMethod(PUT);
client.addHeader(CONTENT_TYPE, typeString(cls));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
@@ -533,7 +533,7 @@ public abstract class Rcli<CT> {
client.send();
return client.future(t);
}
-
+
/**
@@ -553,7 +553,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, typeString(Void.class));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
// client.setPayload(new EClient.Transfer() {
// @Override
@@ -563,7 +563,7 @@ public abstract class Rcli<CT> {
client.send();
return client.future(null);
}
-
+
public<T> Future<T> delete(String pathinfo, String contentType, final RosettaDF<T> df, final T t) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
@@ -573,7 +573,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, contentType);
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
@@ -593,7 +593,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, typeString(cls));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
public void transfer(OutputStream os) throws IOException, APIException {
@@ -612,7 +612,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, typeString(df.getTypeClass()));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
public void transfer(OutputStream os) throws IOException, APIException {
@@ -633,7 +633,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, typeString(cls));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(null);
client.send();
@@ -648,7 +648,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, contentType);
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(null);
client.send();
@@ -681,7 +681,7 @@ public abstract class Rcli<CT> {
int read;
// reuse Buffers
Pooled<byte[]> pbuff = buffPool.get();
- try {
+ try {
while ((read=is.read(pbuff.content))>=0) {
os.write(pbuff.content,0,read);
}
@@ -713,13 +713,13 @@ public abstract class Rcli<CT> {
queryEnd = pound>=0?pound:path.length();
if (oneCallQueryParams==null) {
if (query>=0) {
- queryParams = path.substring(query+1,queryEnd);
+ queryParams = path.substring(query+1,queryEnd);
} else {
queryParams=null;
}
} else {
if (query>=0) {
- queryParams = oneCallQueryParams + '&' + path.substring(query+1,queryEnd);
+ queryParams = oneCallQueryParams + '&' + path.substring(query+1,queryEnd);
} else {
queryParams = oneCallQueryParams;
}
@@ -727,7 +727,7 @@ public abstract class Rcli<CT> {
}
}
}
-
+
public String path() {
if (query>=0) {
if (pound>=0) {
@@ -740,11 +740,11 @@ public abstract class Rcli<CT> {
return path;
}
}
-
+
public String query() {
return queryParams;
}
-
+
public String frag() {
if (pound>=0) {
return path.substring(pound+1);
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Result.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Result.java
index 0e2a4b16..5b8bf920 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Result.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Result.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,7 +35,7 @@ public class Result<T> {
public static<T> Result<T> ok(int code,T t) {
return new Result<T>(code,t,null);
}
-
+
public static<T> Result<T> err(int code,String body) {
return new Result<T>(code,null,body);
}
@@ -47,7 +47,7 @@ public class Result<T> {
public boolean isOK() {
return error==null;
}
-
+
public String toString() {
StringBuilder sb = new StringBuilder("Code: ");
sb.append(code);
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Retryable.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Retryable.java
index 58e7718d..6d85a420 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Retryable.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Retryable.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,7 +28,7 @@ import org.onap.aaf.cadi.Locator;
import org.onap.aaf.misc.env.APIException;
/**
- *
+ *
* @author Jonathan
*
* @param <RT>
@@ -38,7 +38,7 @@ public abstract class Retryable<RET> {
// be able to hold state for consistent Connections. Not required for all connection types.
public Rcli<?> lastClient;
private Locator.Item item;
-
+
public Retryable() {
lastClient = null;
item = null;
@@ -57,7 +57,7 @@ public abstract class Retryable<RET> {
public Locator.Item item() {
return item;
}
-
+
public abstract RET code(Rcli<?> client) throws CadiException, ConnectException, APIException;
/**
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HAuthorizationHeader.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HAuthorizationHeader.java
index c2f56458..744aba43 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HAuthorizationHeader.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HAuthorizationHeader.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@ import org.onap.aaf.cadi.client.AbsAuthentication;
import org.onap.aaf.cadi.config.SecurityInfoC;
public class HAuthorizationHeader extends AbsAuthentication<HttpURLConnection> {
-
+
public HAuthorizationHeader(SecurityInfoC<HttpURLConnection> si, String user, String headValue) throws IOException {
super(si,user,headValue==null?null:headValue.getBytes());
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HBasicAuthSS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HBasicAuthSS.java
index 38465da4..d280b9cb 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HBasicAuthSS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HBasicAuthSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -42,12 +42,12 @@ public class HBasicAuthSS extends HAuthorizationHeader implements BasicAuth {
this(si,si.access.getProperty(Config.AAF_APPID, null),
si.access.decrypt(si.access.getProperty(Config.AAF_APPPASS, null), false));
}
-
+
public HBasicAuthSS(SecurityInfoC<HttpURLConnection> si, boolean setDefault) throws IOException {
this(si,si.access.getProperty(Config.AAF_APPID, null),
si.access.decrypt(si.access.getProperty(Config.AAF_APPPASS, null), false),setDefault);
}
-
+
public HBasicAuthSS(SecurityInfoC<HttpURLConnection> si, String user, String pass, boolean asDefault) throws IOException {
this(si, user,pass);
@@ -55,11 +55,11 @@ public class HBasicAuthSS extends HAuthorizationHeader implements BasicAuth {
si.set(this);
}
}
-
+
public HBasicAuthSS(BasicPrincipal bp, SecurityInfoC<HttpURLConnection> si) throws IOException {
this(si, bp.getName(),new String(bp.getCred()));
}
-
+
public HBasicAuthSS(BasicPrincipal bp, SecurityInfoC<HttpURLConnection> si, boolean asDefault) throws IOException {
this(si, bp.getName(),new String(bp.getCred()));
if (asDefault) {
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
index 61112c47..cef4ae47 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -49,7 +49,7 @@ import org.onap.aaf.misc.rosetta.env.RosettaDF;
/**
* Low Level Http Client Mechanism. Chances are, you want the high level "HRcli"
* for Rosetta Object Translation
- *
+ *
* @author Jonathan
*
*/
@@ -72,7 +72,7 @@ public class HClient implements EClient<HttpURLConnection> {
this.uri = uri;
this.ss = ss;
this.connectTimeout = connectTimeout;
- pathinfo = query = fragment = null;
+ pathinfo = query = fragment = null;
}
@Override
@@ -89,7 +89,7 @@ public class HClient implements EClient<HttpURLConnection> {
public void setPayload(Transfer transfer) {
this.transfer = transfer;
}
-
+
@Override
public void addHeader(String tag, String value) {
if (headers == null)
@@ -133,10 +133,10 @@ public class HClient implements EClient<HttpURLConnection> {
huc = getConnection(sendURI, pi);
huc.setRequestMethod(meth);
if (ss!=null) {
- ss.setSecurity(huc);
+ ss.setSecurity(huc);
}
if (headers != null)
- for (Header d : headers) {
+ for (Header d : headers) {
huc.addRequestProperty(d.tag, d.value);
}
huc.setDoInput(true);
@@ -164,11 +164,11 @@ public class HClient implements EClient<HttpURLConnection> {
pathinfo = query = fragment = "";
}
}
-
+
public URI getURI() {
return uri;
}
-
+
public void setURI(URI uri) {
this.uri = uri;
}
@@ -176,31 +176,31 @@ public class HClient implements EClient<HttpURLConnection> {
public int timeout() {
return connectTimeout;
}
-
+
protected HttpURLConnection getConnection(URI uri, StringBuilder pi) throws IOException, URISyntaxException {
URL url = new URI(
- uri.getScheme(),
+ uri.getScheme(),
uri.getAuthority(),
- pi==null?uri.getPath():pi.toString(),
+ pi==null?uri.getPath():pi.toString(),
query,
fragment).toURL();
return (HttpURLConnection) url.openConnection();
}
-
+
public abstract class HFuture<T> extends Future<T> {
protected HttpURLConnection huc;
protected int respCode;
protected IOException exception;
protected StringBuilder errContent;
-
+
public HFuture(final HttpURLConnection huc) {
this.huc = huc;
}
-
+
protected boolean evalInfo(HttpURLConnection huc) throws APIException, IOException{
return respCode == 200;
};
-
+
@Override
public final boolean get(int timeout) throws CadiException {
try {
@@ -219,7 +219,7 @@ public class HClient implements EClient<HttpURLConnection> {
close();
}
}
-
+
private void extractError() {
InputStream is = huc.getErrorStream();
try {
@@ -237,7 +237,7 @@ public class HClient implements EClient<HttpURLConnection> {
exception = e;
}
}
-
+
// Typically only used by Read
public StringBuilder inputStreamToString(InputStream is) {
// Avoids Carriage returns, and is reasonably efficient, given
@@ -260,26 +260,26 @@ public class HClient implements EClient<HttpURLConnection> {
return null;
}
}
-
-
+
+
@Override
public int code() {
return respCode;
}
-
+
public HttpURLConnection huc() {
return huc;
}
-
+
public IOException exception() {
return exception;
}
-
+
@Override
public String header(String tag) {
return huc.getHeaderField(tag);
}
-
+
public void close() {
if (huc!=null) {
huc.disconnect();
@@ -393,7 +393,7 @@ public class HClient implements EClient<HttpURLConnection> {
is = huc.getInputStream();
// reuse Buffers
Pooled<byte[]> pbuff = Rcli.buffPool.get();
- try {
+ try {
while ((read=is.read(pbuff.content))>=0) {
os.write(pbuff.content,0,read);
}
@@ -409,7 +409,7 @@ public class HClient implements EClient<HttpURLConnection> {
if (is!=null) {
errContent = new StringBuilder();
Pooled<byte[]> pbuff = Rcli.buffPool.get();
- try {
+ try {
while ((read=is.read(pbuff.content))>=0) {
os.write(pbuff.content,0,read);
}
@@ -436,12 +436,12 @@ public class HClient implements EClient<HttpURLConnection> {
this.tag = t;
this.value = v;
}
-
+
public String toString() {
return tag + '=' + value;
}
}
-
+
public String toString() {
return "HttpURLConnection Client configured to " + uri.toString();
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java
index 19e40b3a..1d1f2732 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -46,7 +46,7 @@ public class HMangr {
private int readTimeout, connectionTimeout;
public final Locator<URI> loc;
private Access access;
-
+
public HMangr(Access access, Locator<URI> loc) throws LocatorException {
readTimeout = 10000;
connectionTimeout=3000;
@@ -58,18 +58,18 @@ public class HMangr {
}
/**
- * Reuse the same service. This is helpful for multiple calls that change service side cached data so that
+ * Reuse the same service. This is helpful for multiple calls that change service side cached data so that
* there is not a speed issue.
- *
+ *
* If the service goes down, another service will be substituted, if available.
- *
+ *
* @param access
* @param loc
* @param ss
* @param item
* @param retryable
* @return
- * @throws URISyntaxException
+ * @throws URISyntaxException
* @throws Exception
*/
public<RET> RET same(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable) throws APIException, CadiException, LocatorException {
@@ -107,7 +107,7 @@ public class HMangr {
} else {
client.setSecuritySetter(ss);
}
-
+
retry = false;
try {
ret = retryable.code(client);
@@ -118,14 +118,14 @@ public class HMangr {
try {
Throwable ec = e.getCause();
if (ec instanceof java.net.ConnectException) {
- if (client!=null && loc.hasItems()) {
+ if (client!=null && loc.hasItems()) {
access.log(Level.WARN,"Connection refused, trying next available service");
retry = true;
} else {
throw new CadiException("Connection refused, no more services to try");
}
} else if (ec instanceof java.net.SocketException) {
- if (client!=null && loc.hasItems()) {
+ if (client!=null && loc.hasItems()) {
access.log(Level.WARN,"Socket prematurely closed, trying next available service");
retry = true;
} else {
@@ -155,8 +155,8 @@ public class HMangr {
}
return ret;
}
-
-
+
+
public<RET> RET best(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable) throws LocatorException, CadiException, APIException {
retryable.item(loc.best());
return same(ss,retryable);
@@ -168,7 +168,7 @@ public class HMangr {
public<RET> RET all(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable,boolean notify) throws LocatorException, CadiException, APIException {
return call(ss,retryable,notify,null);
}
-
+
public <RET> RET allExcept(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable,boolean notify, String selfHost) throws LocatorException, CadiException, APIException {
return call(ss,retryable,notify,selfHost);
}
@@ -211,12 +211,12 @@ public class HMangr {
access.log(Level.ERROR,"Connection to",uri,"refused during call to all services");
}
}
-
- if (ret == null && notify)
+
+ if (ret == null && notify)
throw new LocatorException("No available clients to call");
return ret;
}
-
+
public void close() {
// TODO Anything here?
@@ -230,7 +230,7 @@ public class HMangr {
public int readTimeout() {
return readTimeout;
}
-
+
public void connectionTimeout(int t) {
connectionTimeout = t;
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HNoAuthSS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HNoAuthSS.java
index 1fecce2b..2b6a9ac2 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HNoAuthSS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HNoAuthSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HRcli.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HRcli.java
index cbd7b33e..70ca4902 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HRcli.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HRcli.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,9 +36,9 @@ import org.onap.aaf.misc.env.Data.TYPE;
/**
* Rosetta Client
- *
+ *
* JAXB defined JSON or XML over HTTP/S
- *
+ *
* @author Jonathan
*
* @param <T>
@@ -74,10 +74,10 @@ public class HRcli extends Rcli<HttpURLConnection> {
/**
- *
+ *
* @return
- * @throws APIException
- * @throws DME2Exception
+ * @throws APIException
+ * @throws DME2Exception
*/
protected EClient<HttpURLConnection> client() throws CadiException {
try {
@@ -93,7 +93,7 @@ public class HRcli extends Rcli<HttpURLConnection> {
throw new CadiException(e);
}
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.cadi.client.Rcli#setSecuritySetter(org.onap.aaf.cadi.SecuritySetter)
*/
@@ -117,7 +117,7 @@ public class HRcli extends Rcli<HttpURLConnection> {
throw new CadiException(e);
}
}
-
+
public HRcli setManager(HMangr hman) {
this.hman = hman;
return this;
@@ -126,5 +126,5 @@ public class HRcli extends Rcli<HttpURLConnection> {
public String toString() {
return uri.toString();
}
-
+
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HSecurityInfoInit.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HSecurityInfoInit.java
index 7c7d391f..0da76e91 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HSecurityInfoInit.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HSecurityInfoInit.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,7 +32,7 @@ import org.onap.aaf.misc.env.APIException;
/**
* This class will pick out the best default SS for Clients per Client type
- *
+ *
* @author Instrumental
*
*/
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTokenSS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTokenSS.java
index cd20585f..99b73ed7 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTokenSS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTokenSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTransferSS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTransferSS.java
index f68c1f61..d8c8d5ad 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTransferSS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTransferSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,7 @@ public class HTransferSS extends AbsTransferSS<HttpURLConnection> {
public HTransferSS(TaggedPrincipal principal, String app) throws IOException {
super(principal, app);
}
-
+
public HTransferSS(TaggedPrincipal principal, String app, SecurityInfoC<HttpURLConnection> si) {
super(principal, app, si);
}
@@ -55,7 +55,7 @@ public class HTransferSS extends AbsTransferSS<HttpURLConnection> {
securityInfo.setSocketFactoryOn((HttpsURLConnection)huc);
}
}
-
+
@Override
public int setLastResponse(int respCode) {
return 0;
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HX509SS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HX509SS.java
index f441186e..89c11b69 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HX509SS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HX509SS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -57,11 +57,11 @@ public class HX509SS implements SecuritySetter<HttpURLConnection> {
public HX509SS(SecurityInfoC<HttpURLConnection> si) throws APIException, CadiException {
this(null,si,false);
}
-
+
public HX509SS(SecurityInfoC<HttpURLConnection> si, boolean asDefault) throws APIException, CadiException {
this(null,si,asDefault);
}
-
+
public HX509SS(final String sendAlias, SecurityInfoC<HttpURLConnection> si) throws APIException, CadiException {
this(sendAlias, si, false);
}
@@ -75,7 +75,7 @@ public class HX509SS implements SecuritySetter<HttpURLConnection> {
alias = si.defaultAlias;
}
}
-
+
priv=null;
X509KeyManager[] xkms = si.getKeyManagers();
if (xkms==null || xkms.length==0) {
@@ -88,9 +88,9 @@ public class HX509SS implements SecuritySetter<HttpURLConnection> {
for (int i=0;cert==null&&i<xkms.length;++i) {
X509Certificate[] chain = xkms[i].getCertificateChain(alias);
if (chain!=null&&chain.length>0) {
- algo = chain[0].getSigAlgName();
+ algo = chain[0].getSigAlgName();
pub = chain[0].getEncoded();
- ByteArrayOutputStream baos = new ByteArrayOutputStream(pub.length*2);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(pub.length*2);
ByteArrayInputStream bais = new ByteArrayInputStream(pub);
Symm.base64noSplit.encode(bais,baos,X509);
cert = baos.toString();
@@ -111,32 +111,32 @@ public class HX509SS implements SecuritySetter<HttpURLConnection> {
}
if (alias==null) { // must be a one-way
huc.setRequestProperty(AbsAuthentication.AUTHORIZATION, cert);
-
+
// Test Signed content
try {
String data = "SignedContent["+ inc() + ']' + Chrono.dateTime();
huc.setRequestProperty("Data", data);
-
+
Signature sig = Signature.getInstance(algo);
sig.initSign(priv);
sig.update(data.getBytes());
byte[] signature = sig.sign();
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream((int)(signature.length*1.3));
ByteArrayInputStream bais = new ByteArrayInputStream(signature);
Symm.base64noSplit.encode(bais, baos);
huc.setRequestProperty("Signature", new String(baos.toByteArray()));
-
+
} catch (Exception e) {
throw new CadiException(e);
}
}
}
-
+
private synchronized int inc() {
return ++count;
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.cadi.SecuritySetter#getID()
*/
@@ -144,7 +144,7 @@ public class HX509SS implements SecuritySetter<HttpURLConnection> {
public String getID() {
return alias;
}
-
+
@Override
public int setLastResponse(int respCode) {
return 0;
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java
index 8053dabf..c0b9f375 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,7 +33,7 @@ import org.onap.aaf.cadi.LocatorException;
public class DNSLocator implements SizedLocator<URI> {
private static enum Status {UNTRIED, OK, INVALID, SLOW};
private static final int CHECK_TIME = 3000;
-
+
private String host, protocol;
private Access access;
private Host[] hosts;
@@ -41,7 +41,7 @@ public class DNSLocator implements SizedLocator<URI> {
private String suffix;
private int size = 1; // initial, until refreshed.
-
+
public DNSLocator(Access access, String protocol, String host, String range) {
this.host = host;
this.protocol = protocol;
@@ -164,7 +164,7 @@ public class DNSLocator implements SizedLocator<URI> {
}
return false;
}
-
+
private String parseHostAndPorts(String aaf_locate, int _start, int defaultPort) throws LocatorException {
int slash, start;
int colon = aaf_locate.indexOf(':',_start);
@@ -193,7 +193,7 @@ public class DNSLocator implements SizedLocator<URI> {
if(slash>=0) {
suffix = aaf_locate.substring(slash);
}
-
+
} else {
slash = aaf_locate.indexOf('/', start);
if (slash == start) {
@@ -211,7 +211,7 @@ public class DNSLocator implements SizedLocator<URI> {
host = slash<_start?aaf_locate.substring(_start):aaf_locate.substring(_start,slash);
startPort = endPort = defaultPort;
}
-
+
return host;
}
@@ -219,18 +219,18 @@ public class DNSLocator implements SizedLocator<URI> {
private URI uri;
private InetAddress ia;
private Status status;
-
+
public Host(InetAddress inetAddress, int port, String suffix) throws URISyntaxException {
ia = inetAddress;
uri = new URI(protocol,null,inetAddress.getCanonicalHostName(),port,suffix,null,null);
status = Status.UNTRIED;
}
-
+
public String toString() {
return uri.toString() + " - " + status.name();
}
}
-
+
private class DLItem implements Item {
public DLItem(int i) {
cnt = i;
@@ -238,7 +238,7 @@ public class DNSLocator implements SizedLocator<URI> {
private int cnt;
}
-
+
public void destroy() {}
public int size() {
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/HClientHotPeerLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/HClientHotPeerLocator.java
index 488d35d5..57eca417 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/HClientHotPeerLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/HClientHotPeerLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,7 +35,7 @@ public class HClientHotPeerLocator extends HotPeerLocator<HClient> {
public HClientHotPeerLocator(Access access, String urlstr, long invalidateTime, String localLatitude,
String localLongitude, HX509SS ss) throws LocatorException {
super(access, urlstr, invalidateTime, localLatitude, localLongitude);
-
+
this.ss = ss;
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java
index 34889138..d332a7f3 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -54,7 +54,7 @@ public class PropertyLocator implements Locator<URI> {
}
/**
* comma delimited root url list
- *
+ *
* @param locList
* @throws LocatorException
*/
@@ -67,9 +67,9 @@ public class PropertyLocator implements Locator<URI> {
}
String[] locarray = Split.split(',',locList);
List<URI> uriList = new ArrayList<>();
-
+
random = new SecureRandom();
-
+
for (int i=0;i<locarray.length;++i) {
try {
int range = locarray[i].indexOf(":[");
@@ -234,7 +234,7 @@ public class PropertyLocator implements Locator<URI> {
} else {
newCurrent = current;
}
-
+
for (int i=0; i< end; ++i) {
if (newCurrent[i]==null){
newCurrent[i]=new PLItem(i);
@@ -257,14 +257,14 @@ public class PropertyLocator implements Locator<URI> {
protected Socket createSocket() {
return new Socket();
}
-
+
private class PLItem implements Item {
public int idx,order;
-
+
public PLItem(int i) {
idx = order =i;
}
-
+
public String toString() {
return "Item: " + idx + " order: " + order;
}
@@ -294,7 +294,7 @@ public class PropertyLocator implements Locator<URI> {
}
return sb.toString();
}
-
+
public void destroy() {
}
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java
index b0654cfa..862868f0 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,19 +28,19 @@ import org.onap.aaf.cadi.LocatorException;
public class SingleEndpointLocator implements SizedLocator<URI> {
private final URI uri;
- private final static Item item = new Item() {};
+ private final static Item item = new Item() {};
private Date noRetryUntil;
-
+
public SingleEndpointLocator(final URI uri) {
this.uri = uri;
}
-
+
public SingleEndpointLocator(final String endpoint) throws LocatorException {
try {
- this.uri = new URI(endpoint);
- } catch (URISyntaxException e) {
- throw new LocatorException(e);
- }
+ this.uri = new URI(endpoint);
+ } catch (URISyntaxException e) {
+ throw new LocatorException(e);
+ }
}
@Override
@@ -63,7 +63,7 @@ public class SingleEndpointLocator implements SizedLocator<URI> {
@Override
public void invalidate(Item item) throws LocatorException {
// one minute timeout, because there is no other item
- noRetryUntil = new Date(System.currentTimeMillis()+60000);
+ noRetryUntil = new Date(System.currentTimeMillis()+60000);
}
@Override
@@ -87,10 +87,10 @@ public class SingleEndpointLocator implements SizedLocator<URI> {
// Never refreshed
return true;
}
-
+
@Override
public int size() {
- return 1;
+ return 1;
}
@Override
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java
index 65a34738..40792649 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,5 +24,5 @@ package org.onap.aaf.cadi.locator;
import org.onap.aaf.cadi.Locator;
public interface SizedLocator<T> extends Locator<T> {
- public abstract int size();
+ public abstract int size();
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java b/cadi/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java
index 27eb507f..f72e5290 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,33 +24,33 @@ package org.onap.aaf.cadi.routing;
import org.onap.aaf.misc.env.util.Split;
public class GreatCircle {
- // Note: multiplying by this constant is faster than calling Math equivalent function
+ // Note: multiplying by this constant is faster than calling Math equivalent function
private static final double DEGREES_2_RADIANS = Math.PI/180.0;
-
+
public static final double DEGREES_2_NM = 60;
public static final double DEGREES_2_KM = DEGREES_2_NM * 1.852; // 1.852 is exact ratio per 1929 Standard Treaty, adopted US 1954
- public static final double DEGREES_2_MI = DEGREES_2_NM * 1.1507795;
-
+ public static final double DEGREES_2_MI = DEGREES_2_NM * 1.1507795;
+
/**
- *
+ *
* Calculate the length of an arc on a perfect sphere based on Latitude and Longitudes of two points
* Parameters are in Degrees (i.e. the coordinate system you get from GPS, Mapping WebSites, Phones, etc)
- *
+ *
* L1 = Latitude of point A
* G1 = Longitude of point A
* L2 = Latitude of point B
* G2 = Longitude of point B
- *
+ *
* d = acos (sin(L1)*sin(L2) + cos(L1)*cos(L2)*cos(G1 - G2))
- *
+ *
* Returns answer in Degrees
- *
+ *
* Since there are 60 degrees per nautical miles, you can convert to NM by multiplying by 60
- *
- * Essential formula from a Princeton website, the "Law of Cosines" method.
- *
+ *
+ * Essential formula from a Princeton website, the "Law of Cosines" method.
+ *
* Refactored cleaned up for speed Jonathan 3/8/2013
- *
+ *
* @param latA
* @param lonA
* @param latB
@@ -66,19 +66,19 @@ public class GreatCircle {
lonB *= DEGREES_2_RADIANS;
return Math.acos(
- Math.sin(latA) * Math.sin(latB) +
+ Math.sin(latA) * Math.sin(latB) +
Math.cos(latA) * Math.cos(latB) * Math.cos(lonA-lonB)
)
/ DEGREES_2_RADIANS;
}
-
- /**
+
+ /**
* Convert from "Lat,Long Lat,Long" String format
* "Lat,Long,Lat,Long" Format
* or all four entries "Lat Long Lat Long"
- *
+ *
* (Convenience function)
- *
+ *
* Since Distance is positive, a "-1" indicates an error in String formatting
*/
public static double calc(String ... coords) {
@@ -111,7 +111,7 @@ public class GreatCircle {
Double.parseDouble(coords[2]),
Double.parseDouble(coords[3])
);
-
+
default:
return -1;
}
@@ -124,7 +124,7 @@ public class GreatCircle {
///**
//* Haverside method, from Princeton
-//*
+//*
//* @param alat
//* @param alon
//* @param blat
@@ -169,16 +169,16 @@ public class GreatCircle {
// alon *= DEGREES_2_RADIANS;
// blat *= DEGREES_2_RADIANS;
// blon *= DEGREES_2_RADIANS;
-//
+//
// // Reused values
// double cosAlat,cosBlat;
-//
+//
// return Math.acos(
// ((cosAlat=Math.cos(alat))*Math.cos(alon)*(cosBlat=Math.cos(blat))*Math.cos(blon)) +
// (cosAlat*Math.sin(alon)*cosBlat*Math.sin(blon)) +
// (Math.sin(alat)*Math.sin(blat))
// )/DEGREES_2_RADIANS;
-//
+//
//}
/*
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsAuthentication.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsAuthentication.java
index 65daa7b6..9c293c92 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsAuthentication.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsAuthentication.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,20 +34,20 @@ import java.io.PrintStream;
import java.net.HttpURLConnection;
public class JU_AbsAuthentication {
-
+
private final static String ID = "id";
private final static String PASSWORD = "password";
private final static String WARNING = "Your service has 1000 consecutive bad service " +
"logins to AAF. AAF Access will be disabled after 10000\n";
-
+
private static ByteArrayOutputStream errStream;
-
+
@Before
public void setup() {
errStream = new ByteArrayOutputStream();
System.setErr(new PrintStream(errStream));
}
-
+
@After
public void tearDown() {
System.setErr(System.err);
@@ -59,7 +59,7 @@ public class JU_AbsAuthentication {
assertThat(stub.getID(), is(nullValue()));
assertThat(stub.headValue(), is(""));
assertThat(stub.count(), is(0));
-
+
stub.setUser(ID);
assertThat(stub.getID(), is(ID));
@@ -67,7 +67,7 @@ public class JU_AbsAuthentication {
assertThat(stub.getID(), is(ID));
assertThat(stub.headValue(), is(PASSWORD));
assertThat(stub.count(), is(0));
-
+
assertThat(stub.setLastResponse(200), is(0));
assertThat(stub.isDenied(), is(false));
@@ -81,12 +81,12 @@ public class JU_AbsAuthentication {
stub.setCount(999);
assertThat(stub.setLastResponse(401), is(1000));
assertThat(errStream.toString(), is(WARNING));
-
+
// coverage...
stub.setLastMiss(1);
assertThat(stub.isDenied(), is(false));
}
-
+
private class AuthStub extends AbsAuthentication<HttpURLConnection> {
public AuthStub(SecurityInfoC<HttpURLConnection> securityInfo, String user, byte[] headValue)
@@ -95,7 +95,7 @@ public class JU_AbsAuthentication {
@Override public void setSecurity(HttpURLConnection client) throws CadiException { }
@Override public void setUser(String id) { super.setUser(id); }
@Override public String headValue() throws IOException { return super.headValue(); }
-
+
public void setLastMiss(long lastMiss) { this.lastMiss = lastMiss; }
public void setCount(int count) { this.count = count; }
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsTransferSS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsTransferSS.java
index c7720775..6d09b379 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsTransferSS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsTransferSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,18 +34,18 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
import java.net.HttpURLConnection;
public class JU_AbsTransferSS {
-
+
@Mock TaggedPrincipal princMock;
@Mock SecurityInfoC<HttpURLConnection> siMock;
-
+
private static final String princName = "name";
private static final String princTag = "tag";
private static final String app = "app";
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
-
+
when(princMock.getName()).thenReturn(princName);
when(princMock.tag()).thenReturn(princTag);
}
@@ -55,12 +55,12 @@ public class JU_AbsTransferSS {
TransferSSStub stub = new TransferSSStub(princMock, app);
assertThat(stub.getID(), is(princName));
assertThat(stub.getValue(), is(princName + ':' + app + ':' + princTag + ':' + "AS"));
-
+
stub = new TransferSSStub(null, app, siMock);
assertThat(stub.getID(), is(""));
assertThat(stub.getValue(), is(nullValue()));
}
-
+
private class TransferSSStub extends AbsTransferSS<HttpURLConnection> {
public TransferSSStub(TaggedPrincipal principal, String app) { super(principal, app); }
public TransferSSStub(TaggedPrincipal principal, String app, SecurityInfoC<HttpURLConnection> si) { super(principal, app, si); }
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Future.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Future.java
index 97fa9d21..a631dfbc 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Future.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Future.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,11 +34,11 @@ public class JU_Future {
@SuppressWarnings("unused")
Future<Integer> f = new FutureStub();
}
-
+
private class FutureStub extends Future<Integer> {
- @Override public boolean get(int timeout) throws CadiException { return false; }
- @Override public int code() { return 0; }
- @Override public String body() { return null; }
+ @Override public boolean get(int timeout) throws CadiException { return false; }
+ @Override public int code() { return 0; }
+ @Override public String body() { return null; }
@Override public String header(String tag) { return null; }
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java
index 6412d243..d8c5a598 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,7 @@ public class JU_Holder {
Holder<String> holder = new Holder<String>(str1);
assertThat(holder.get(), is(str1));
assertThat(holder.toString(), is(str1));
-
+
holder.set(str2);
assertThat(holder.get(), is(str2));
assertThat(holder.toString(), is(str2));
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Rcli.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Rcli.java
index d33811e3..8fe0190c 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Rcli.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Rcli.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -61,24 +61,24 @@ public class JU_Rcli {
@Mock HttpServletRequest reqMock;
@Mock HttpServletResponse respMock;
@Mock ServletInputStream isMock;
-
+
private final static String uriString = "example.com";
private final static String apiVersion = "v1.0";
private final static String contentType = "contentType";
-
+
private static URI uri;
private static Enumeration<String> enumeration;
private Client client;
-
+
@Before
public void setup() throws URISyntaxException, IOException {
MockitoAnnotations.initMocks(this);
-
+
when(dfMock.getTypeClass()).thenReturn(HttpURLConnection.class);
when(dfMock.newData()).thenReturn(dataMock);
when(dataMock.out((TYPE) any())).thenReturn(dataMock);
-
+
when(reqMock.getInputStream()).thenReturn(isMock);
when(isMock.read((byte[]) any())).thenReturn(-1);
@@ -86,7 +86,7 @@ public class JU_Rcli {
enumeration = new CustomEnumeration();
client = new Client();
}
-
+
@Test
public void createTest() throws APIException, CadiException {
RcliStub rcli = new RcliStub(uri);
@@ -112,7 +112,7 @@ public class JU_Rcli {
rcli.create("No question mark", contentType);
rcli.create("question?mark", contentType);
}
-
+
@Test
public void postFormTest() throws APIException, CadiException {
RcliStub rcli = new RcliStub(uri);
@@ -121,7 +121,7 @@ public class JU_Rcli {
rcli.postForm(null, dfMock);
rcli.postForm("No question mark", dfMock);
rcli.postForm("question?mark", dfMock);
-
+
rcli.type(Data.TYPE.JSON);
rcli.postForm("question?mark", dfMock);
@@ -145,7 +145,7 @@ public class JU_Rcli {
rcli.readPost("First string", "Second string");
}
-
+
@Test
public void readTest() throws APIException, CadiException {
RcliStub rcli = new RcliStub(uri);
@@ -189,7 +189,7 @@ public class JU_Rcli {
when(reqMock.getRequestURI()).thenReturn(uriString);
when(reqMock.getHeaderNames()).thenReturn(enumeration);
rcli.transfer(reqMock, respMock, "string", 200);
-
+
// coverage...
when(reqMock.getMethod()).thenReturn("GET");
rcli.transfer(reqMock, respMock, "string", 200);
@@ -207,13 +207,13 @@ public class JU_Rcli {
public void accessorMutatorTest() throws URISyntaxException {
RcliStub rcli = new RcliStub();
Rcli<?> rcliClone = rcli.forUser(null);
-
+
rcli = new RcliStub(uri);
assertThat(rcli.toString(), is(uriString));
assertThat(rcli.getURI(), is(uri));
assertThat(rcli.getReadTimeout(), is(5000));
assertThat(rcli.getConnectionTimeout(), is(3000));
-
+
rcli.connectionTimeout(3001);
assertThat(rcli.getConnectionTimeout(), is(3001));
rcli.readTimeout(5001);
@@ -224,7 +224,7 @@ public class JU_Rcli {
assertThat(rcli.typeString(HttpURLConnection.class), is("application/HttpURLConnection+xml;version=" + apiVersion));
rcli.apiVersion(null);
assertThat(rcli.typeString(HttpURLConnection.class), is("application/HttpURLConnection+xml"));
-
+
rcliClone = rcli.forUser(null);
assertThat(rcliClone.toString(), is(uriString));
}
@@ -232,15 +232,15 @@ public class JU_Rcli {
private class RcliStub extends Rcli<HttpURLConnection> {
public RcliStub() { super(); }
public RcliStub(URI uri) { this.uri = uri; }
- @Override public void setSecuritySetter(SecuritySetter<HttpURLConnection> ss) { }
- @Override public SecuritySetter<HttpURLConnection> getSecuritySetter() { return null; }
- @Override protected Rcli<HttpURLConnection> clone(URI uri, SecuritySetter<HttpURLConnection> ss) { return this; }
- @Override public void invalidate() throws CadiException { }
- @Override protected EClient<HttpURLConnection> client() throws CadiException { return client; }
+ @Override public void setSecuritySetter(SecuritySetter<HttpURLConnection> ss) { }
+ @Override public SecuritySetter<HttpURLConnection> getSecuritySetter() { return null; }
+ @Override protected Rcli<HttpURLConnection> clone(URI uri, SecuritySetter<HttpURLConnection> ss) { return this; }
+ @Override public void invalidate() throws CadiException { }
+ @Override protected EClient<HttpURLConnection> client() throws CadiException { return client; }
public int getReadTimeout() { return readTimeout; }
public int getConnectionTimeout() { return connectionTimeout; }
}
-
+
private class CustomEnumeration implements Enumeration<String> {
private int idx = 0;
private final String[] elements = {"This", "is", "a", "test"};
@@ -257,11 +257,11 @@ public class JU_Rcli {
private class Client implements EClient<HttpURLConnection> {
private Transfer transfer;
@Override public void setPayload(Transfer transfer) { this.transfer = transfer; }
- @Override public void setMethod(String meth) { }
- @Override public void setPathInfo(String pathinfo) { }
- @Override public void addHeader(String tag, String value) { }
- @Override public void setQueryParams(String q) { }
- @Override public void setFragment(String f) { }
+ @Override public void setMethod(String meth) { }
+ @Override public void setPathInfo(String pathinfo) { }
+ @Override public void addHeader(String tag, String value) { }
+ @Override public void setQueryParams(String q) { }
+ @Override public void setFragment(String f) { }
@Override public void send() throws APIException {
try {
if (transfer != null) {
@@ -269,14 +269,14 @@ public class JU_Rcli {
}
} catch (IOException e) {
}
- }
- @Override public <T> Future<T> futureCreate(Class<T> t) { return null; }
- @Override public Future<String> futureReadString() { return null; }
- @Override public <T> Future<T> futureRead(RosettaDF<T> df, TYPE type) { return null; }
- @Override public <T> Future<T> future(T t) { return null; }
- @Override public Future<Void> future(HttpServletResponse resp, int expected) throws APIException { return null; }
+ }
+ @Override public <T> Future<T> futureCreate(Class<T> t) { return null; }
+ @Override public Future<String> futureReadString() { return null; }
+ @Override public <T> Future<T> futureRead(RosettaDF<T> df, TYPE type) { return null; }
+ @Override public <T> Future<T> future(T t) { return null; }
+ @Override public Future<Void> future(HttpServletResponse resp, int expected) throws APIException { return null; }
}
-
+
//private class FutureStub implements Future<String> {
//}
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Result.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Result.java
index 41570980..1da04064 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Result.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Result.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,7 +28,7 @@ import org.junit.*;
import org.onap.aaf.cadi.client.Result;
public class JU_Result {
-
+
private static final int OK = 200;
private static final int NOT_FOUND = 404;
@@ -38,7 +38,7 @@ public class JU_Result {
result = Result.ok(OK, 10);
assertThat(result.toString(), is("Code: 200"));
assertThat(result.isOK(), is(true));
-
+
result = Result.err(NOT_FOUND, "File not found");
assertThat(result.toString(), is("Code: 404 = File not found"));
assertThat(result.isOK(), is(false));
@@ -47,5 +47,5 @@ public class JU_Result {
assertThat(result.toString(), is("Code: 404 = File not found"));
assertThat(result.isOK(), is(false));
}
-
+
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Retryable.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Retryable.java
index 200b393d..b876710d 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Retryable.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Retryable.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,10 +40,10 @@ public class JU_Retryable {
RetryableStub retry = new RetryableStub();
assertThat(retry.item(), is(nullValue()));
assertThat(retry.lastClient(), is(nullValue()));
-
+
Locator.Item item = null;
assertThat(retry.item(item), is(item));
-
+
retry = new RetryableStub(retry);
assertThat(retry.item(), is(nullValue()));
assertThat(retry.lastClient(), is(nullValue()));
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HAuthorizationHeader.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HAuthorizationHeader.java
index 4bb44e10..c2f75002 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HAuthorizationHeader.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HAuthorizationHeader.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,10 +41,10 @@ public class JU_HAuthorizationHeader {
@Mock
HttpsURLConnection hucsMock;
-
+
@Mock
HttpURLConnection hucMock;
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
@@ -59,7 +59,7 @@ public class JU_HAuthorizationHeader {
header = new HAuthorizationHeader(null, null, null);
header.setSecurity(hucsMock);
}
-
+
@Test(expected = CadiException.class)
public void throwsWhenDeniedTest() throws CadiException, IOException {
HAuthorizationHeader header = new HAuthorizationHeader(siMock, "string1", "string2") {
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HBasicAuthSS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HBasicAuthSS.java
index d0655979..9d3b5a4e 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HBasicAuthSS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HBasicAuthSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,23 +39,23 @@ import org.onap.aaf.cadi.http.HSecurityInfoInit;
import org.onap.aaf.cadi.principal.BasicPrincipal;
public class JU_HBasicAuthSS {
-
+
@Mock
BasicPrincipal bpMock;
-
+
private SecurityInfoC<HttpURLConnection> si;
private PropAccess access;
-
+
private final static String id = "id";
private final static String password = "password";
-
+
@Before
public void setup() throws CadiException, IOException {
MockitoAnnotations.initMocks(this);
-
+
when(bpMock.getName()).thenReturn(id);
when(bpMock.getCred()).thenReturn(password.getBytes());
-
+
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
access.setProperty(Config.AAF_APPID, id);
access.setProperty(Config.AAF_APPPASS, access.encrypt(password));
@@ -68,7 +68,7 @@ public class JU_HBasicAuthSS {
// All the constructors accomplish the same thing
@SuppressWarnings("unused")
HBasicAuthSS auth = new HBasicAuthSS(si);
-
+
// TODO: While these test _should_ pass, and they _do_ pass on my local machine, they won't
// pass when then onap jobbuilder runs them. Good luck!
// assertThat(auth.getID(), is(id));
@@ -84,10 +84,10 @@ public class JU_HBasicAuthSS {
auth = new HBasicAuthSS(bpMock, si);
// assertThat(auth.getID(), is(id));
-
+
auth = new HBasicAuthSS(bpMock, si, false);
// assertThat(auth.getID(), is(id));
-
+
auth = new HBasicAuthSS(bpMock, si, true);
// assertThat(auth.getID(), is(id));
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HClient.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HClient.java
index c32abe43..c224676c 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HClient.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HClient.java
@@ -99,7 +99,7 @@ public class JU_HClient {
HClientStub client;
client = new HClientStub(ssMock, uri, 0, null);
client.send();
-
+
client.setPathInfo("/pathinfo");
client.send();
@@ -116,7 +116,7 @@ public class JU_HClient {
client.setPayload(transferMock);
client.send();
}
-
+
@Test(expected = APIException.class)
public void sendThrows1Test() throws APIException, LocatorException, URISyntaxException {
HClientStub client = new HClientStub(ssMock, new URI("mailto:me@domain.com"), 0, null);
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HMangr.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HMangr.java
index 10eb8184..98070d6b 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HMangr.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HMangr.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -58,14 +58,14 @@ import org.onap.aaf.misc.env.APIException;
import junit.framework.Assert;
public class JU_HMangr {
-
+
@Mock Locator<URI> locMock;
@Mock SecuritySetter<HttpURLConnection> ssMock;
@Mock Retryable<Void> retryableMock;
@Mock Retryable<Integer> goodRetry;
@Mock Locator.Item itemMock;
@Mock Rcli<Object> clientMock;
-
+
private PropAccess access;
private URI uri;
private final static String uriString = "http://example.com";
@@ -84,11 +84,11 @@ public class JU_HMangr {
when(retryableMock.item()).thenReturn(itemMock);
when(locMock.get(itemMock)).thenReturn(uri);
assertThat(hman.same(ssMock, retryableMock), is(nullValue()));
-
+
//coverage...
when(retryableMock.lastClient()).thenReturn(clientMock);
assertThat(hman.same(ssMock, retryableMock), is(nullValue()));
-
+
CadiException cadiException;
ConnectException connectException = new ConnectException();
@@ -210,7 +210,7 @@ public class JU_HMangr {
assertThat(hman.oneOf(ssMock, retryableMock, false, "host"), is(nullValue()));
assertThat(hman.oneOf(ssMock, retryableMock, false, uriString.substring(7)), is(nullValue()));
-
+
CadiException cadiException;
cadiException = new CadiException(new ConnectException());
@@ -244,7 +244,7 @@ public class JU_HMangr {
fail("Should've thrown an exception");
} catch (CadiException e) {
}
-
+
doThrow(new ConnectException()).when(retryableMock).code((Rcli<?>) any());
assertThat(hman.oneOf(ssMock, retryableMock, false, uriString.substring(7)), is(nullValue()));
@@ -274,5 +274,5 @@ public class JU_HMangr {
return null;
}
}
-
+
} \ No newline at end of file
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HNoAuthSS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HNoAuthSS.java
index 923dd1a0..e1a1e70b 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HNoAuthSS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HNoAuthSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,21 +33,21 @@ import org.onap.aaf.cadi.config.SecurityInfoC;
import org.onap.aaf.cadi.http.HNoAuthSS;
public class JU_HNoAuthSS {
-
+
@Mock
SecurityInfoC<HttpURLConnection> siMock;
-
+
@Mock
HttpURLConnection httpMock;
@Mock
HttpsURLConnection httpsMock;
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
}
-
+
@Test
public void test() throws IOException, CadiException {
HNoAuthSS noAuth = new HNoAuthSS(null);
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HRcli.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HRcli.java
index ab6a39c0..92f7dd63 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HRcli.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HRcli.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -44,22 +44,22 @@ import org.onap.aaf.cadi.http.HMangr;
import org.onap.aaf.cadi.http.HRcli;
public class JU_HRcli {
-
+
@Mock
SecuritySetter<HttpURLConnection> ssMock;
-
+
@Mock
Locator<URI> locMock;
-
+
@Mock
Locator.Item itemMock;
-
+
private HMangr hman;
private PropAccess access;
private static URI uri;
-
+
private static final String uriString = "example.com";
-
+
@Before
public void setup() throws LocatorException, URISyntaxException {
MockitoAnnotations.initMocks(this);
@@ -79,20 +79,20 @@ public class JU_HRcli {
hrcli.setSecuritySetter(ssMock);
assertThat(hrcli.getSecuritySetter(), is(ssMock));
-
+
// No throw
hrcli.invalidate();
// Throw
doThrow(CadiException.class).when(locMock).invalidate(itemMock);
hrcli.invalidate();
}
-
+
@Test(expected = CadiException.class)
public void protectedInterfaceTest() throws CadiException, LocatorException {
HRcliStub hrcli = new HRcliStub(hman, uri, itemMock, ssMock);
HRcli clone = hrcli.clone(uri, ssMock);
assertThat(clone.toString(), is(hrcli.toString()));
-
+
EClient<HttpURLConnection> eclient = hrcli.client();
assertThat(eclient, is(not(nullValue())));
@@ -105,7 +105,7 @@ public class JU_HRcli {
when(locMock.best()).thenReturn(null);
eclient = hrcli.client();
}
-
+
private class HRcliStub extends HRcli {
public HRcliStub(HMangr hman, URI uri, Item locItem, SecuritySetter<HttpURLConnection> secSet) {
super(hman, uri, locItem, secSet);
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTokenSS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTokenSS.java
index 9f2c9a71..eaf668e0 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTokenSS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTokenSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,7 +36,7 @@ public class JU_HTokenSS {
@Mock
SecurityInfoC<HttpURLConnection> siMock;
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTransferSS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTransferSS.java
index 77fac567..809863e4 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTransferSS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTransferSS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,10 +41,10 @@ import org.onap.aaf.cadi.http.HTransferSS;
import org.onap.aaf.cadi.principal.TaggedPrincipal;
public class JU_HTransferSS {
-
+
@Mock
TaggedPrincipal princMock;
-
+
@Mock
HttpURLConnection hucMock;
@@ -53,15 +53,15 @@ public class JU_HTransferSS {
@Mock
SecurityInfoC<HttpURLConnection> siMock;
-
+
@Mock
SecurityInfoC<HttpURLConnection> siMockNoDefSS;
@Mock
SecuritySetter<HttpURLConnection> ssMock;
-
+
private static final String princName = "name";
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
@@ -73,7 +73,7 @@ public class JU_HTransferSS {
public void test() throws IOException, CadiException {
HTransferSS transfer = new HTransferSS(princMock, "string1");
assertThat(transfer.setLastResponse(0), is(0));
-
+
transfer = new HTransferSS(princMock, "string1", siMock);
transfer.setSecurity(hucsMock);
assertThat(transfer.getID(), is(princName));
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HX509SS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HX509SS.java
index fd102a95..f85697ae 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HX509SS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HX509SS.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -48,33 +48,33 @@ import org.onap.aaf.cadi.http.HX509SS;
import org.onap.aaf.misc.env.APIException;
public class JU_HX509SS {
-
+
@Mock X509Certificate x509Mock;
@Mock X509KeyManager keyManagerMock;
@Mock PrivateKey privateKeyMock;
@Mock SecurityInfoC<HttpURLConnection> siMock;
@Mock HttpURLConnection hucMock;
@Mock HttpsURLConnection hucsMock;
-
+
private final static String alias = "Some alias";
private final static String algName = "Some algName";
private final static byte[] publicKeyBytes = "a public key".getBytes();
-
+
private PropAccess access;
private SecurityInfoC<HttpURLConnection> si;
-
+
@Before
public void setup() throws IOException, CadiException, CertificateEncodingException {
MockitoAnnotations.initMocks(this);
-
+
when(x509Mock.getSigAlgName()).thenReturn(algName);
when(x509Mock.getEncoded()).thenReturn(publicKeyBytes);
-
+
when(keyManagerMock.getCertificateChain(alias)).thenReturn(new X509Certificate[] {x509Mock});
when(keyManagerMock.getPrivateKey(alias)).thenReturn(privateKeyMock);
when(siMock.getKeyManagers()).thenReturn(new X509KeyManager[] {keyManagerMock});
-
+
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
access.setProperty(Config.CADI_ALIAS, alias);
// si = SecurityInfoC.instance(access, HttpURLConnectionStub.class);
@@ -87,12 +87,12 @@ public class JU_HX509SS {
assertThat(x509.setLastResponse(0), is(0));
assertThat(x509.setLastResponse(1), is(0));
assertThat(x509.setLastResponse(2), is(0));
-
+
// coverage...
x509.setSecurity(hucMock);
x509.setSecurity(hucsMock);
}
-
+
// TODO: Test the setSecurity method - Ian
// @Test
// public void test2() throws APIException, CadiException {
@@ -100,7 +100,7 @@ public class JU_HX509SS {
// x509.setSecurity(hucMock);
// x509.setSecurity(hucsMock);
// }
-
+
@Test(expected = APIException.class)
public void throws1Test() throws APIException, CadiException {
@SuppressWarnings("unused")
@@ -113,5 +113,5 @@ public class JU_HX509SS {
@SuppressWarnings("unused")
HX509SS x509 = new HX509SS(alias, siMock);
}
-
+
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java
index b786cf68..e2c8f828 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,9 +38,9 @@ import org.onap.aaf.cadi.PropAccess;
import org.onap.aaf.cadi.locator.DNSLocator;
public class JU_DNSLocator {
-
+
private PropAccess access;
-
+
@Before
public void setup() {
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
@@ -53,7 +53,7 @@ public class JU_DNSLocator {
URI uri;
dl = new DNSLocator(access, "https", "localhost", "8100-8101");
-
+
item = dl.best();
uri = dl.get(item);
assertThat(uri.toString(), is("https://localhost:8100"));
@@ -66,10 +66,10 @@ public class JU_DNSLocator {
}
assertThat(dl.hasItems(), is(false));
- // This doesn't actually do anything besides increase coverage
+ // This doesn't actually do anything besides increase coverage
dl.destroy();
}
-
+
@Test
public void constructorTest() throws LocatorException {
// For coverage
@@ -84,20 +84,20 @@ public class JU_DNSLocator {
new DNSLocator(access, "https://localhost:8000/");
new DNSLocator(access, "https://aaf-locatexx.onapxxx:8095/locate");
try {
- new DNSLocator(access, "https:localhost:8000");
- fail("Invalid URL should not pass");
+ new DNSLocator(access, "https:localhost:8000");
+ fail("Invalid URL should not pass");
} catch (LocatorException e) {
- access.log(Level.DEBUG, "Valid Exception");
-
+ access.log(Level.DEBUG, "Valid Exception");
+
}
}
-
+
@Test
public void refreshTest() throws LocatorException {
DNSLocator dl = new DNSLocator(access, "https", "bogushost", "8100-8101");
assertThat(dl.refresh(), is(false));
}
-
+
@Test(expected = LocatorException.class)
public void throws1Test() throws LocatorException {
new DNSLocator(access, null);
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_HClientHotPeerLocator.java b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_HClientHotPeerLocator.java
index d85a84a2..496017a8 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_HClientHotPeerLocator.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_HClientHotPeerLocator.java
@@ -86,7 +86,7 @@ public class JU_HClientHotPeerLocator {
item = loc.first();
loc.invalidate(item);
-
+
loc.invalidate(loc.bestClient());
loc.invalidate(loc.get(loc.next(item)));
loc.destroy();
@@ -106,13 +106,13 @@ public class JU_HClientHotPeerLocator {
assertThat(alternate2, is("Alternate Client is " + goodURL2));
outStream.reset();
-
+
loc.invalidate(loc.first());
loc.destroy();
loc.best();
}
-
+
@Test
public void hasNoItemTest() throws LocatorException {
HClientHotPeerLocator loc;
@@ -134,7 +134,7 @@ public class JU_HClientHotPeerLocator {
loc = new CoverageLocator(access, urlStr, 0, "38.627", "-90.199", ssMock);
assertThat(loc._invalidate(null), is(nullValue()));
loc._destroy(null);
-
+
loc._newClient("bad string");
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_PropertyLocator.java b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_PropertyLocator.java
index 0eae1198..26673dd5 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_PropertyLocator.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_PropertyLocator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -85,7 +85,7 @@ public class JU_PropertyLocator {
pl.refresh();
assertThat(pl.hasItems(), is(true));
-
+
assertThat(pl.next(null), is(nullValue()));
// coverage...
@@ -97,7 +97,7 @@ public class JU_PropertyLocator {
pl.destroy();
pl = new PropertyLocator(uris);
-
+
}
@Test(expected=LocatorException.class)
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/routing/test/JU_GreatCircle.java b/cadi/client/src/test/java/org/onap/aaf/cadi/routing/test/JU_GreatCircle.java
index 31fda501..1cc74e56 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/routing/test/JU_GreatCircle.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/routing/test/JU_GreatCircle.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/cadi/client/src/test/java/org/onap/aaf/client/test/JU_ResultTest.java b/cadi/client/src/test/java/org/onap/aaf/client/test/JU_ResultTest.java
index 575bc2ee..ef26f475 100644
--- a/cadi/client/src/test/java/org/onap/aaf/client/test/JU_ResultTest.java
+++ b/cadi/client/src/test/java/org/onap/aaf/client/test/JU_ResultTest.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,7 +52,7 @@ public class JU_ResultTest {
assertFalse(t.isOK());
assertThat(t.toString(), is("Code: 1 = Error Body"));
}
-
+
@Test
public void testOk1() {
Result<String> t = Result.ok(1, "Ok");
@@ -70,7 +70,7 @@ public class JU_ResultTest {
assertFalse(t.isOK());
assertThat(t.toString(), is("Code: 1 = Error Body"));
}
-
+
@Test
public void testOk2() {
Result<String> t = Result.ok(1, "Ok");
@@ -88,7 +88,7 @@ public class JU_ResultTest {
assertFalse(t.isOK());
assertThat(t.toString(), is("Code: 1 = Error Body"));
}
-
+
@Test
public void testOk3() {
Result<String> t = Result.ok(1, "Ok");