summaryrefslogtreecommitdiffstats
path: root/auth/auth-batch/src
diff options
context:
space:
mode:
authorgabe.maurer <gabe.maurer@att.com>2018-05-14 15:28:52 -0500
committergabe.maurer <gabe.maurer@att.com>2018-05-14 15:31:17 -0500
commit3a4fad5b7ea6fa2eead2e53e17ed2d0fa476715d (patch)
tree074d982238d4fbd33e824d3e5deaf772611bd246 /auth/auth-batch/src
parent1cbf57f33370386fcdfe3097d19aac899b44736b (diff)
Increased auth batch coverage
Issue-ID: AAF-233 Change-Id: I70070ff98cb9590cd0318c7936ab73c90f60b596 Signed-off-by: gabe.maurer <gabe.maurer@att.com>
Diffstat (limited to 'auth/auth-batch/src')
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_MonthData.java22
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_NS.java79
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_NsAttrib.java55
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Perm.java98
4 files changed, 254 insertions, 0 deletions
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_MonthData.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_MonthData.java
index 21ead4f2..e858d408 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_MonthData.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_MonthData.java
@@ -28,6 +28,9 @@ import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.onap.aaf.auth.helpers.MonthData;
+import org.onap.aaf.auth.helpers.MonthData.Row;
+
+import junit.framework.Assert;
import static org.mockito.Mockito.*;
@@ -42,12 +45,14 @@ public class JU_MonthData {
File f;
MonthData mData;
+ Row row;
BufferedWriter bw = null;
FileWriter fw = null;
@Before
public void setUp() throws IOException {
mData = new MonthData("env");
+ row = new Row("target", 10,2,1);
f = new File("Monthlyenv.dat");
f.createNewFile();
bw = new BufferedWriter(new FileWriter(f));
@@ -69,6 +74,23 @@ public class JU_MonthData {
mData.notExists(2);
}
+ @Test
+ public void testWrite() throws IOException {
+ mData.write();
+ }
+
+ @Test
+ public void testCompareTo() {
+ Row testrow = new Row("testtar",1,1,1);
+ Assert.assertEquals(-4, row.compareTo(testrow));
+ Assert.assertEquals(0, row.compareTo(row));
+ }
+
+ @Test
+ public void testToString() {
+ Assert.assertEquals("target|10|1|2", row.toString());
+ }
+
@After
public void cleanUp() {
if(f.exists()) {
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_NS.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_NS.java
new file mode 100644
index 00000000..32c8a122
--- /dev/null
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_NS.java
@@ -0,0 +1,79 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+
+package org.onap.aaf.auth.helpers.test;
+
+import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.auth.helpers.NS;
+import org.onap.aaf.auth.helpers.NS.NSSplit;
+
+import junit.framework.Assert;
+
+import static org.mockito.Mockito.*;
+import org.junit.Test;
+
+public class JU_NS {
+
+ NS ns;
+ NSSplit nSSplit;
+
+ @Before
+ public void setUp() {
+ ns = new NS("name", "description", "parent", 1, 1);
+ nSSplit = new NSSplit("string",1);
+ }
+
+ @Test
+ public void testToString() {
+ Assert.assertEquals("name", ns.toString());
+ }
+
+ @Test
+ public void testHashCode() {
+ Assert.assertEquals(3373707, ns.hashCode());
+ }
+
+ @Test
+ public void testEquals() {
+ Assert.assertEquals(true, ns.equals("name"));
+ Assert.assertEquals(false, ns.equals("name1"));
+ }
+
+ @Test
+ public void testCompareTo() {
+ NS nsValid = new NS("name", "description", "parent", 1, 1);
+ Assert.assertEquals(0, ns.compareTo(nsValid));
+
+ NS nsInvalid = new NS("name1", "description", "parent", 1, 1);
+ Assert.assertEquals(-1, ns.compareTo(nsInvalid));
+ }
+
+ @Test
+ public void testDeriveParent() {
+ ns.deriveParent("d.ot.te.d");
+ }
+
+}
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_NsAttrib.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_NsAttrib.java
new file mode 100644
index 00000000..b9c09dd9
--- /dev/null
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_NsAttrib.java
@@ -0,0 +1,55 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+
+package org.onap.aaf.auth.helpers.test;
+
+import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.auth.helpers.Creator;
+import org.onap.aaf.auth.helpers.NsAttrib;
+import org.onap.aaf.misc.env.Trans;
+
+import com.datastax.driver.core.Session;
+
+import junit.framework.Assert;
+
+import static org.mockito.Mockito.*;
+import org.junit.Test;
+
+public class JU_NsAttrib {
+
+ NsAttrib nsAttrib;
+
+ @Before
+ public void setUp() {
+ nsAttrib = new NsAttrib("ns", "key", "value");
+ }
+
+ @Test
+ public void testToString() {
+ Assert.assertEquals("\"ns\",\"key\",\"value\"", nsAttrib.toString());
+ }
+
+}
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Perm.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Perm.java
new file mode 100644
index 00000000..313eb978
--- /dev/null
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Perm.java
@@ -0,0 +1,98 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+
+package org.onap.aaf.auth.helpers.test;
+
+import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.auth.helpers.Perm;
+
+import junit.framework.Assert;
+
+import static org.mockito.Mockito.*;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Test;
+
+public class JU_Perm {
+
+ Perm perm;
+ Set set;
+
+ @Before
+ public void setUp() {
+ set = new HashSet();
+ perm = new Perm("ns","type", "instance", "action","description", set);
+ }
+
+ @Test
+ public void testFullType() {
+ Assert.assertEquals("ns.type", perm.fullType());
+ }
+
+ @Test
+ public void testFullPerm() {
+ Assert.assertEquals("ns.type|instance|action", perm.fullPerm());
+ }
+
+ @Test
+ public void testEncode() {
+ Assert.assertEquals("ns|type|instance|action", perm.encode());
+ }
+
+ @Test
+ public void testHashCode() {
+ Assert.assertEquals(850667666, perm.hashCode());
+ }
+
+ @Test
+ public void testToString() {
+ Assert.assertEquals("ns|type|instance|action", perm.toString());
+ }
+
+ @Test
+ public void testEquals() {
+ Perm perm1 = new Perm("ns","type", "instance", "action","description", set);
+ Assert.assertEquals(false, perm.equals(perm1));
+ }
+
+ @Test
+ public void testCompareTo() {
+ Perm perm1 = new Perm("ns","type", "instance", "action","description", set);
+ Perm perm2 = new Perm("ns1","type", "instance", "action","description", set);
+
+ Assert.assertEquals(0, perm.compareTo(perm1));
+ Assert.assertEquals(75, perm.compareTo(perm2));
+ }
+
+ @Test
+ public void testStageRemove() {
+ Perm perm1 = new Perm("ns","type", "instance", "action","description", set);
+ perm.stageRemove(perm1);
+ }
+
+}