summaryrefslogtreecommitdiffstats
path: root/cadi/core/src/test
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2018-09-06 06:47:30 -0500
committerInstrumental <jonathan.gathman@att.com>2018-09-06 07:24:31 -0500
commit5882678eebcbaa5d640dbc04a56cbd6f8678719e (patch)
tree9f881bdb8587595d9c57ecd380614b9fd4fe295a /cadi/core/src/test
parente0a2e0d0c79dcaf4532d0ca3aeefd3f5546af404 (diff)
Add timing CadiFilter
Issue-ID: AAF-468 Change-Id: I335a1106609ac99e12eeb0640a06c9eb969e9bbb Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'cadi/core/src/test')
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java6
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_AbsTafResp.java7
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java8
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java3
5 files changed, 20 insertions, 8 deletions
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java
index 722ac14f..f35f81c1 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java
@@ -37,10 +37,10 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import org.onap.aaf.cadi.Permission;
-import org.onap.aaf.cadi.PropAccess;
import org.onap.aaf.cadi.AbsUserCache;
import org.onap.aaf.cadi.CredVal.Type;
+import org.onap.aaf.cadi.Permission;
+import org.onap.aaf.cadi.PropAccess;
import org.onap.aaf.cadi.lur.ConfigPrincipal;
import org.onap.aaf.cadi.lur.LocalLur;
import org.onap.aaf.cadi.lur.LocalPermission;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java
index ce49654b..997ebced 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java
@@ -131,7 +131,8 @@ public class JU_DenialOfServiceTaf {
dost = new DenialOfServiceTaf(accessMock);
tafResp = dost.validate(LifeForm.SBLF, reqMock1, respMock);
- assertThat(tafResp.desc(), is("DenialOfServiceTaf is not processing this transaction: This Transaction is not denied"));
+ assertThat(tafResp.desc(), is("Not processing this transaction: This Transaction is not denied"));
+ assertThat(tafResp.taf(), is("DenialOfServiceTaf"));
assertThat(DenialOfServiceTaf.denyIP(ip1), is(true));
@@ -139,7 +140,8 @@ public class JU_DenialOfServiceTaf {
assertThat(tafResp.desc(), is(ip1 + " is on the IP Denial list"));
tafResp = dost.validate(LifeForm.SBLF, reqMock2, respMock);
- assertThat(tafResp.desc(), is("DenialOfServiceTaf is not processing this transaction: This Transaction is not denied"));
+ assertThat(tafResp.desc(), is("Not processing this transaction: This Transaction is not denied"));
+ assertThat(tafResp.taf(), is("DenialOfServiceTaf"));
}
@Test
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_AbsTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_AbsTafResp.java
index 6d0c04b7..e4469d30 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_AbsTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_AbsTafResp.java
@@ -40,6 +40,7 @@ import org.onap.aaf.cadi.taf.TafResp.RESP;
public class JU_AbsTafResp {
+ private static final String JUNIT = "Junit";
private static final String name = "name";
private static final String tag = "tag";
private static final String description = "description";
@@ -58,7 +59,7 @@ public class JU_AbsTafResp {
@Test
public void test() {
- AbsTafResp tafResp = new AbsTafResp(access, taggedPrinc, description) {
+ AbsTafResp tafResp = new AbsTafResp(access, JUNIT, taggedPrinc, description) {
@Override public RESP authenticate() throws IOException {
return null;
}
@@ -66,12 +67,13 @@ public class JU_AbsTafResp {
assertThat(tafResp.isValid(), is(true));
assertThat(tafResp.desc(), is(description));
+ assertThat(tafResp.taf(), is(JUNIT));
assertThat(tafResp.isAuthenticated(), is(RESP.IS_AUTHENTICATED));
assertThat(tafResp.getPrincipal(), is(taggedPrinc));
assertThat(tafResp.getAccess(), is(access));
assertThat(tafResp.isFailedAttempt(), is(false));
- tafResp = new AbsTafResp(null, null, null) {
+ tafResp = new AbsTafResp(null, JUNIT, null, null) {
@Override public RESP authenticate() throws IOException {
return null;
}
@@ -81,6 +83,7 @@ public class JU_AbsTafResp {
assertThat(tafResp.isAuthenticated(), is(RESP.TRY_ANOTHER_TAF));
assertThat(tafResp.getPrincipal(), is(nullValue()));
assertThat(tafResp.getAccess(), is(nullValue()));
+ assertThat(tafResp.taf(), is(JUNIT));
assertThat(tafResp.isFailedAttempt(), is(false));
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java
index a1190590..f8e20cbf 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java
@@ -76,7 +76,10 @@ public class JU_EpiTaf {
@Override public RESP authenticate() throws IOException { return null; }
@Override public TaggedPrincipal getPrincipal() { return null; }
@Override public Access getAccess() { return null; }
- @Override public boolean isFailedAttempt() { return false; }
+ @Override public boolean isFailedAttempt() { return false; }
+ @Override public float timing() { return 0; }
+ @Override public void timing(long start) {}
+ @Override public String taf() {return "JUnit";}
}
class TryAnotherTaf implements Taf {
@@ -91,6 +94,9 @@ public class JU_EpiTaf {
@Override public TaggedPrincipal getPrincipal() { return null; }
@Override public Access getAccess() { return null; }
@Override public boolean isFailedAttempt() { return false; }
+ @Override public float timing() { return 0; }
+ @Override public void timing(long start) {}
+ @Override public String taf() {return "JUnit";}
}
class TryAuthenticatingTaf implements Taf {
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java
index 516f4044..aacce522 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java
@@ -44,7 +44,8 @@ public class JU_PuntTafResp {
assertFalse(punt.isValid());
assertThat(punt.isAuthenticated(), is(RESP.TRY_ANOTHER_TAF));
- assertThat(punt.desc(), is(name + " is not processing this transaction: " + explanation));
+ assertThat(punt.desc(), is("Not processing this transaction: " + explanation));
+ assertThat(punt.taf(), is(name));
assertThat(punt.authenticate(), is(RESP.TRY_ANOTHER_TAF));
assertThat(punt.getPrincipal(), is(nullValue()));
assertThat(punt.getAccess(), is(Access.NULL));