summaryrefslogtreecommitdiffstats
path: root/authz-service/src/test/java
diff options
context:
space:
mode:
authorsg481n <sg481n@att.com>2017-08-28 12:11:35 -0400
committersg481n <sg481n@att.com>2017-08-28 12:11:47 -0400
commitbd890c575163e4d87ac24198b9c68a39cf4bbc4d (patch)
tree2d6c5baa66d1df8f8c841d39646e93020ed203bc /authz-service/src/test/java
parent72b21f2ac109b0d95fef3ef608c0c343337d4ce2 (diff)
Update project structure to org.onap.aaf
Update project structure of authz module in aaf from com.att to org.onap.aaf and add distribution management and repositories. Issue-id: AAF-21 Change-Id: Ia2486954e99f2bd60f18122ed60d32d5590781e9 Signed-off-by: sg481n <sg481n@att.com>
Diffstat (limited to 'authz-service/src/test/java')
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/cadi/JU_DirectAAFLur.java66
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/cadi/JU_DirectAAFUserPass.java74
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/cadi/JU_DirectCertIdentity.java72
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/service/JU_AuthAPI.java75
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Api.java59
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Approval.java61
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Creds.java73
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Delegate.java55
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_History.java61
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Mgmt.java58
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_NS.java50
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Perms.java67
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Roles.java56
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_User.java56
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_UserRole.java52
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/service/mapper/JU_Mapper_2_0.java163
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/service/test/JU_Validator.java159
-rw-r--r--authz-service/src/test/java/org/onap/aaf/authz/service/validation/JU_Validator.java175
18 files changed, 1432 insertions, 0 deletions
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/cadi/JU_DirectAAFLur.java b/authz-service/src/test/java/org/onap/aaf/authz/cadi/JU_DirectAAFLur.java
new file mode 100644
index 00000000..166e92a0
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/cadi/JU_DirectAAFLur.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.cadi;
+
+import static org.junit.Assert.*;
+
+import java.security.Principal;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.onap.aaf.authz.cadi.DirectAAFLur;
+import org.onap.aaf.authz.env.AuthzEnv;
+import org.onap.aaf.dao.aaf.hl.Question;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import org.onap.aaf.cadi.Permission;
+@RunWith(PowerMockRunner.class)
+public class JU_DirectAAFLur {
+
+public static AuthzEnv env;
+public static Question question;
+public DirectAAFLur directAAFLur;
+
+
+
+ @Before
+ public void setUp()
+ {
+ directAAFLur = new DirectAAFLur(env, question);
+ }
+
+ @Test
+ public void testFish()
+ {
+
+ Principal bait = null;
+ Permission pond=null;
+ directAAFLur.fish(bait, pond);
+
+ assertTrue(true);
+
+ }
+
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/cadi/JU_DirectAAFUserPass.java b/authz-service/src/test/java/org/onap/aaf/authz/cadi/JU_DirectAAFUserPass.java
new file mode 100644
index 00000000..5a0811ce
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/cadi/JU_DirectAAFUserPass.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.cadi;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.aaf.cadi.CredVal.Type;
+
+import static org.mockito.Mockito.*;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aaf.authz.cadi.DirectAAFUserPass;
+import org.onap.aaf.authz.env.AuthzEnv;
+import org.onap.aaf.dao.aaf.hl.Question;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+
+@RunWith(PowerMockRunner.class)
+public class JU_DirectAAFUserPass {
+
+//public static AuthzEnv env;
+//public static Question question;
+public static String string;
+public DirectAAFUserPass directAAFUserPass;
+
+@Mock
+AuthzEnv env;
+Question question;
+String user;
+Type type;
+byte[] pass;
+ @Before
+ public void setUp() {
+ directAAFUserPass = new DirectAAFUserPass(env, question, string);
+ }
+
+ @Test
+ public void testvalidate(){
+
+// Boolean bolVal = directAAFUserPass.validate(user, type, pass);
+ // assertEquals((bolVal==null),true);
+
+ assertTrue(true);
+
+ }
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/cadi/JU_DirectCertIdentity.java b/authz-service/src/test/java/org/onap/aaf/authz/cadi/JU_DirectCertIdentity.java
new file mode 100644
index 00000000..b6f22b7d
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/cadi/JU_DirectCertIdentity.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.cadi;
+
+import static org.junit.Assert.*;
+
+import java.security.Principal;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.onap.aaf.authz.cadi.DirectCertIdentity;
+import org.onap.aaf.dao.aaf.cached.CachedCertDAO;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class JU_DirectCertIdentity {
+
+ public DirectCertIdentity directCertIdentity;
+
+ @Before
+ public void setUp(){
+ directCertIdentity = new DirectCertIdentity();
+ }
+
+
+ @Mock
+ HttpServletRequest req;
+ X509Certificate cert;
+ byte[] _certBytes;
+
+ @Test
+ public void testidentity(){
+
+ try {
+ Principal p = directCertIdentity.identity(req, cert, _certBytes);
+ assertEquals(( (p) == null),true);
+
+ } catch (CertificateException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ //assertTrue(true);
+
+ }
+
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/service/JU_AuthAPI.java b/authz-service/src/test/java/org/onap/aaf/authz/service/JU_AuthAPI.java
new file mode 100644
index 00000000..364869c9
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/service/JU_AuthAPI.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.service;
+
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.aaf.authz.cadi.DirectAAFUserPass;
+import org.onap.aaf.authz.env.AuthzEnv;
+import org.onap.aaf.authz.facade.AuthzFacade_2_0;
+import org.onap.aaf.authz.service.AuthAPI;
+import org.onap.aaf.dao.aaf.hl.Question;
+
+public class JU_AuthAPI {
+
+ public AuthAPI authAPI;
+ AuthzEnv env;
+ private static final String ORGANIZATION = "Organization.";
+ private static final String DOMAIN = "openecomp.org";
+
+ public Question question;
+ private AuthzFacade_2_0 facade;
+ private AuthzFacade_2_0 facade_XML;
+ private DirectAAFUserPass directAAFUserPass;
+ public Properties props;
+ @Before
+ public void setUp(){
+ try {
+ authAPI = new AuthAPI(env);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testStartDME2(Properties props){
+ try {
+ authAPI.startDME2(props);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ //assertTrue(true);
+
+ }
+
+
+
+
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Api.java b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Api.java
new file mode 100644
index 00000000..08e8b4f7
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Api.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.aaf.authz.facade.AuthzFacade;
+import org.onap.aaf.authz.service.AuthAPI;
+import org.onap.aaf.authz.service.api.API_Api;
+
+public class JU_API_Api {
+ API_Api api_Api;
+ @Mock
+ AuthAPI authzAPI;
+ AuthzFacade facade;
+
+ @Before
+ public void setUp(){
+ //api_Api = new API_Api();
+ }
+
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void testInit()
+ {
+ try {
+ api_Api.init(authzAPI, facade);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+ }
+
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Approval.java b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Approval.java
new file mode 100644
index 00000000..e210bbc2
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Approval.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.aaf.authz.facade.AuthzFacade;
+import org.onap.aaf.authz.service.AuthAPI;
+import org.onap.aaf.authz.service.api.API_Approval;
+
+public class JU_API_Approval {
+ API_Approval api_Approval;
+
+ @Mock
+ AuthAPI authzAPI;
+ AuthzFacade facade;
+
+ @Before
+ public void setUp()
+ {
+
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void testInit() {
+
+ try {
+ api_Approval.init(authzAPI, facade);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ //assertTrue(true);
+ }
+
+
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Creds.java b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Creds.java
new file mode 100644
index 00000000..442de9ef
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Creds.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.aaf.authz.cadi.DirectAAFUserPass;
+import org.onap.aaf.authz.facade.AuthzFacade;
+import org.onap.aaf.authz.service.AuthAPI;
+import org.onap.aaf.authz.service.api.API_Creds;
+
+import org.onap.aaf.inno.env.Env;
+
+public class JU_API_Creds {
+
+API_Creds api_Creds;
+@Mock
+AuthAPI authzAPI;
+AuthzFacade facade;
+Env env;
+DirectAAFUserPass directAAFUserPass;
+ @Before
+ public void setUp(){
+
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void testInit(){
+ try {
+ api_Creds.init(authzAPI, facade);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void testTimeSensitiveInit(){
+
+ try {
+ api_Creds.timeSensitiveInit(env, authzAPI, facade, directAAFUserPass);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Delegate.java b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Delegate.java
new file mode 100644
index 00000000..79c716a6
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Delegate.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.service.api;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.aaf.authz.facade.AuthzFacade;
+import org.onap.aaf.authz.service.AuthAPI;
+import org.onap.aaf.authz.service.api.API_Delegate;
+
+public class JU_API_Delegate {
+API_Delegate api_Delegate;
+@Mock
+AuthAPI authzAPI;
+AuthzFacade facade;
+ @Before
+ public void setUp() {
+
+
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void testInit(){
+
+ try {
+ api_Delegate.init(authzAPI, facade);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_History.java b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_History.java
new file mode 100644
index 00000000..99bc9bff
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_History.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.aaf.authz.facade.AuthzFacade;
+import org.onap.aaf.authz.service.AuthAPI;
+import org.onap.aaf.authz.service.api.API_History;
+
+public class JU_API_History {
+ API_History api_History;
+
+ @Mock
+ AuthAPI authzAPI;
+ AuthzFacade facade;
+
+ @Before
+ public void setUp(){
+
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void testInit(){
+
+ try {
+ api_History.init(authzAPI, facade);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+ }
+
+
+
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Mgmt.java b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Mgmt.java
new file mode 100644
index 00000000..d99818c4
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Mgmt.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.aaf.authz.facade.AuthzFacade;
+import org.onap.aaf.authz.service.AuthAPI;
+import org.onap.aaf.authz.service.api.API_Mgmt;
+
+public class JU_API_Mgmt {
+ API_Mgmt api_Mgmt;
+
+ @Mock
+ AuthAPI authzAPI;
+ AuthzFacade facade;
+
+ @Before
+ public void setUp(){
+
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void testInit(){
+
+ try {
+ api_Mgmt.init(authzAPI, facade);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_NS.java b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_NS.java
new file mode 100644
index 00000000..d2cb4e2f
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_NS.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.aaf.authz.facade.AuthzFacade;
+import org.onap.aaf.authz.service.AuthAPI;
+import org.onap.aaf.authz.service.api.API_NS;
+
+public class JU_API_NS {
+ API_NS api_Ns;
+ @Mock
+ AuthAPI authzAPI;
+ AuthzFacade facade;
+
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void testInit(){
+ try {
+ api_Ns.init(authzAPI, facade);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Perms.java b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Perms.java
new file mode 100644
index 00000000..b1b3f5b5
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Perms.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.aaf.authz.facade.AuthzFacade;
+import org.onap.aaf.authz.service.AuthAPI;
+import org.onap.aaf.authz.service.api.API_Perms;
+
+public class JU_API_Perms {
+ API_Perms api_Perms;
+ @Mock
+ AuthAPI authzAPI;
+ AuthzFacade facade;
+
+ @Before
+ public void setUp(){
+
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void testInit(){
+ try {
+ api_Perms.init(authzAPI, facade);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void testTimeSensitiveInit(){
+ try {
+ api_Perms.timeSensitiveInit(authzAPI, facade);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Roles.java b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Roles.java
new file mode 100644
index 00000000..f52f7f65
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_Roles.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.aaf.authz.facade.AuthzFacade;
+import org.onap.aaf.authz.service.AuthAPI;
+import org.onap.aaf.authz.service.api.API_Roles;
+
+public class JU_API_Roles {
+ API_Roles api_Roles;
+ @Mock
+ AuthAPI authzAPI;
+ AuthzFacade facade;
+
+
+ @Before
+ public void setUp() {
+ assertTrue(true);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void testInit(){
+ try {
+ api_Roles.init(authzAPI, facade);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } }
+
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_User.java b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_User.java
new file mode 100644
index 00000000..2348effe
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_User.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.aaf.authz.facade.AuthzFacade;
+import org.onap.aaf.authz.service.AuthAPI;
+import org.onap.aaf.authz.service.api.API_User;
+
+public class JU_API_User {
+ API_User api_User;
+ @Mock
+ AuthAPI authzAPI;
+ AuthzFacade facade;
+
+ @Before
+ public void setUp() {
+ //assertTrue(true);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void testInit(){
+ try {
+ api_User.init(authzAPI, facade);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_UserRole.java b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_UserRole.java
new file mode 100644
index 00000000..16b8ba45
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/service/api/JU_API_UserRole.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.aaf.authz.facade.AuthzFacade;
+import org.onap.aaf.authz.service.AuthAPI;
+import org.onap.aaf.authz.service.api.API_UserRole;
+
+public class JU_API_UserRole {
+ API_UserRole api_UserRole;
+ @Mock
+ AuthAPI authzAPI;
+ AuthzFacade facade;
+
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void testInit(){
+ try {
+ api_UserRole.init(authzAPI, facade);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/service/mapper/JU_Mapper_2_0.java b/authz-service/src/test/java/org/onap/aaf/authz/service/mapper/JU_Mapper_2_0.java
new file mode 100644
index 00000000..90e14295
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/service/mapper/JU_Mapper_2_0.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.service.mapper;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class JU_Mapper_2_0 {
+
+ @Test
+ public void test() {
+ assertTrue(true);
+ }
+
+ @Test
+ public void testApprovals(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testCert(){
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCred(){
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testDelegate(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testErrorFromMessage(){
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testFuture(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testGetClass(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testGetExpires(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testGetMarshal(){
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testHistory(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testKeys(){
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testNewInstance(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testNs(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testNss(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testPerm(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testPermFromRPRequest(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testPermKey(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testPerms(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testRole(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testRoleFromRPRequest(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testRoles(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testUserRole(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testUserRoles(){
+ assertTrue(true);
+ }
+
+ @Test
+ public void testUsers(){
+ assertTrue(true);
+ }
+
+
+
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/service/test/JU_Validator.java b/authz-service/src/test/java/org/onap/aaf/authz/service/test/JU_Validator.java
new file mode 100644
index 00000000..6c5cc000
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/service/test/JU_Validator.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.service.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.aaf.authz.service.validation.Validator;
+
+public class JU_Validator {
+
+
+ @Test
+ public void test() {
+ assertTrue(Validator.ACTION_CHARS.matcher("HowdyDoody").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("Howd?yDoody").matches());
+ assertTrue(Validator.ACTION_CHARS.matcher("_HowdyDoody").matches());
+ assertTrue(Validator.INST_CHARS.matcher("HowdyDoody").matches());
+ assertFalse(Validator.INST_CHARS.matcher("Howd?yDoody").matches());
+ assertTrue(Validator.INST_CHARS.matcher("_HowdyDoody").matches());
+
+ //
+ assertTrue(Validator.ACTION_CHARS.matcher("*").matches());
+ assertTrue(Validator.INST_CHARS.matcher("*").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(":*").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":*").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(":*:*").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":*:*").matches());
+
+ assertFalse(Validator.ACTION_CHARS.matcher(":hello").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":hello").matches());
+ assertFalse(Validator.INST_CHARS.matcher("hello:").matches());
+ assertFalse(Validator.INST_CHARS.matcher("hello:d").matches());
+
+ assertFalse(Validator.ACTION_CHARS.matcher(":hello:*").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":hello:*").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(":hello:d*:*").matches());
+ assertFalse(Validator.INST_CHARS.matcher(":hello:d*d:*").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":hello:d*:*").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("HowdyDoody*").matches());
+ assertFalse(Validator.INST_CHARS.matcher("Howdy*Doody").matches());
+ assertTrue(Validator.INST_CHARS.matcher("HowdyDoody*").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("*HowdyDoody").matches());
+ assertFalse(Validator.INST_CHARS.matcher("*HowdyDoody").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(":h*").matches());
+ assertFalse(Validator.INST_CHARS.matcher(":h*h*").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":h*").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(":h:h*:*").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":h:h*:*").matches());
+ assertFalse(Validator.INST_CHARS.matcher(":h:h*h:*").matches());
+ assertFalse(Validator.INST_CHARS.matcher(":h:h*h*:*").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(":h:*:*h").matches());
+ assertFalse(Validator.INST_CHARS.matcher(":h:*:*h").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":com.test.*:ns:*").matches());
+
+
+ assertFalse(Validator.ACTION_CHARS.matcher("1234+235gd").matches());
+ assertTrue(Validator.ACTION_CHARS.matcher("1234-235gd").matches());
+ assertTrue(Validator.ACTION_CHARS.matcher("1234-23_5gd").matches());
+ assertTrue(Validator.ACTION_CHARS.matcher("1234-235g,d").matches());
+ assertTrue(Validator.ACTION_CHARS.matcher("1234-235gd(Version12)").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("123#4-23@5g:d").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("123#4-23@5g:d").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("1234-23 5gd").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("1234-235gd ").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(" 1234-235gd").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(" ").matches());
+
+ // Allow % and = (Needed for Escaping & Base64 usages) jg
+ assertTrue(Validator.ACTION_CHARS.matcher("1234%235g=d").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(":1234%235g=d").matches());
+ assertTrue(Validator.INST_CHARS.matcher("1234%235g=d").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":1234%235g=d").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":1234%235g=d:%20==").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":1234%235g=d:==%20:=%23").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":1234%235g=d:*:=%23").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":1234%235g=d:==%20:*").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":*:==%20:*").matches());
+
+ // Allow / instead of : (more natural instance expression) jg
+ assertFalse(Validator.INST_CHARS.matcher("1234/a").matches());
+ assertTrue(Validator.INST_CHARS.matcher("/1234/a").matches());
+ assertTrue(Validator.INST_CHARS.matcher("/1234/*/a/").matches());
+ assertTrue(Validator.INST_CHARS.matcher("/1234//a").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("1234/a").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("/1234/*/a/").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("1234//a").matches());
+
+
+ assertFalse(Validator.INST_CHARS.matcher("1234+235gd").matches());
+ assertTrue(Validator.INST_CHARS.matcher("1234-235gd").matches());
+ assertTrue(Validator.INST_CHARS.matcher("1234-23_5gd").matches());
+ assertTrue(Validator.INST_CHARS.matcher("1234-235g,d").matches());
+ assertTrue(Validator.INST_CHARS.matcher("m1234@shb.dd.com").matches());
+ assertTrue(Validator.INST_CHARS.matcher("1234-235gd(Version12)").matches());
+ assertFalse(Validator.INST_CHARS.matcher("123#4-23@5g:d").matches());
+ assertFalse(Validator.INST_CHARS.matcher("123#4-23@5g:d").matches());
+ assertFalse(Validator.INST_CHARS.matcher("").matches());
+
+
+ for( char c=0x20;c<0x7F;++c) {
+ boolean b;
+ switch(c) {
+ case '?':
+ case '|':
+ case '*':
+ continue; // test separately
+ case '~':
+ case ',':
+ b = false;
+ break;
+ default:
+ b=true;
+ }
+ }
+
+ assertFalse(Validator.ID_CHARS.matcher("abc").matches());
+ assertFalse(Validator.ID_CHARS.matcher("").matches());
+ assertTrue(Validator.ID_CHARS.matcher("abc@att.com").matches());
+ assertTrue(Validator.ID_CHARS.matcher("ab-me@att.com").matches());
+ assertTrue(Validator.ID_CHARS.matcher("ab-me_.x@att._-com").matches());
+
+ assertFalse(Validator.NAME_CHARS.matcher("ab-me_.x@att._-com").matches());
+ assertTrue(Validator.NAME_CHARS.matcher("ab-me").matches());
+ assertTrue(Validator.NAME_CHARS.matcher("ab-me_.xatt._-com").matches());
+
+
+ // 7/22/2016
+ assertTrue(Validator.INST_CHARS.matcher(
+ "/!com.att.*/role/write").matches());
+ assertTrue(Validator.INST_CHARS.matcher(
+ ":!com.att.*:role:write").matches());
+
+ }
+
+}
diff --git a/authz-service/src/test/java/org/onap/aaf/authz/service/validation/JU_Validator.java b/authz-service/src/test/java/org/onap/aaf/authz/service/validation/JU_Validator.java
new file mode 100644
index 00000000..1277b978
--- /dev/null
+++ b/authz-service/src/test/java/org/onap/aaf/authz/service/validation/JU_Validator.java
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 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====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+package org.onap.aaf.authz.service.validation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.aaf.authz.cadi.DirectAAFLur.PermPermission;
+import org.onap.aaf.authz.env.AuthzTrans;
+import org.onap.aaf.authz.layer.Result;
+import org.onap.aaf.authz.org.Organization;
+import org.onap.aaf.authz.service.validation.Validator;
+import org.onap.aaf.dao.aaf.cass.CredDAO;
+import org.onap.aaf.dao.aaf.cass.DelegateDAO;
+import org.onap.aaf.dao.aaf.cass.Namespace;
+import org.onap.aaf.dao.aaf.cass.PermDAO;
+import org.onap.aaf.dao.aaf.cass.RoleDAO;
+import org.onap.aaf.dao.aaf.cass.UserRoleDAO;
+
+public class JU_Validator {
+
+ @Before
+ public void setUp(){
+ Validator validator = new Validator();
+ }
+
+
+ @Test
+ public void test() {
+ assertTrue(Validator.ACTION_CHARS.matcher("HowdyDoody").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("Howd?yDoody").matches());
+ assertTrue(Validator.ACTION_CHARS.matcher("_HowdyDoody").matches());
+ assertTrue(Validator.INST_CHARS.matcher("HowdyDoody").matches());
+ assertFalse(Validator.INST_CHARS.matcher("Howd?yDoody").matches());
+ assertTrue(Validator.INST_CHARS.matcher("_HowdyDoody").matches());
+
+ //
+ assertTrue(Validator.ACTION_CHARS.matcher("*").matches());
+ assertTrue(Validator.INST_CHARS.matcher("*").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(":*").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":*").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(":*:*").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":*:*").matches());
+
+ assertFalse(Validator.ACTION_CHARS.matcher(":hello").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":hello").matches());
+ assertFalse(Validator.INST_CHARS.matcher("hello:").matches());
+ assertFalse(Validator.INST_CHARS.matcher("hello:d").matches());
+
+ assertFalse(Validator.ACTION_CHARS.matcher(":hello:*").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":hello:*").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(":hello:d*:*").matches());
+ assertFalse(Validator.INST_CHARS.matcher(":hello:d*d:*").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":hello:d*:*").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("HowdyDoody*").matches());
+ assertFalse(Validator.INST_CHARS.matcher("Howdy*Doody").matches());
+ assertTrue(Validator.INST_CHARS.matcher("HowdyDoody*").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("*HowdyDoody").matches());
+ assertFalse(Validator.INST_CHARS.matcher("*HowdyDoody").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(":h*").matches());
+ assertFalse(Validator.INST_CHARS.matcher(":h*h*").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":h*").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(":h:h*:*").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":h:h*:*").matches());
+ assertFalse(Validator.INST_CHARS.matcher(":h:h*h:*").matches());
+ assertFalse(Validator.INST_CHARS.matcher(":h:h*h*:*").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(":h:*:*h").matches());
+ assertFalse(Validator.INST_CHARS.matcher(":h:*:*h").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":com.test.*:ns:*").matches());
+
+
+ assertFalse(Validator.ACTION_CHARS.matcher("1234+235gd").matches());
+ assertTrue(Validator.ACTION_CHARS.matcher("1234-235gd").matches());
+ assertTrue(Validator.ACTION_CHARS.matcher("1234-23_5gd").matches());
+ assertTrue(Validator.ACTION_CHARS.matcher("1234-235g,d").matches());
+ assertTrue(Validator.ACTION_CHARS.matcher("1234-235gd(Version12)").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("123#4-23@5g:d").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("123#4-23@5g:d").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("1234-23 5gd").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("1234-235gd ").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(" 1234-235gd").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(" ").matches());
+
+ // Allow % and = (Needed for Escaping & Base64 usages) jg
+ assertTrue(Validator.ACTION_CHARS.matcher("1234%235g=d").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher(":1234%235g=d").matches());
+ assertTrue(Validator.INST_CHARS.matcher("1234%235g=d").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":1234%235g=d").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":1234%235g=d:%20==").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":1234%235g=d:==%20:=%23").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":1234%235g=d:*:=%23").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":1234%235g=d:==%20:*").matches());
+ assertTrue(Validator.INST_CHARS.matcher(":*:==%20:*").matches());
+
+ // Allow / instead of : (more natural instance expression) jg
+ assertFalse(Validator.INST_CHARS.matcher("1234/a").matches());
+ assertTrue(Validator.INST_CHARS.matcher("/1234/a").matches());
+ assertTrue(Validator.INST_CHARS.matcher("/1234/*/a/").matches());
+ assertTrue(Validator.INST_CHARS.matcher("/1234//a").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("1234/a").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("/1234/*/a/").matches());
+ assertFalse(Validator.ACTION_CHARS.matcher("1234//a").matches());
+
+
+ assertFalse(Validator.INST_CHARS.matcher("1234+235gd").matches());
+ assertTrue(Validator.INST_CHARS.matcher("1234-235gd").matches());
+ assertTrue(Validator.INST_CHARS.matcher("1234-23_5gd").matches());
+ assertTrue(Validator.INST_CHARS.matcher("1234-235g,d").matches());
+ assertTrue(Validator.INST_CHARS.matcher("m1234@shb.dd.com").matches());
+ assertTrue(Validator.INST_CHARS.matcher("1234-235gd(Version12)").matches());
+ assertFalse(Validator.INST_CHARS.matcher("123#4-23@5g:d").matches());
+ assertFalse(Validator.INST_CHARS.matcher("123#4-23@5g:d").matches());
+ assertFalse(Validator.INST_CHARS.matcher("").matches());
+
+
+ for( char c=0x20;c<0x7F;++c) {
+ boolean b;
+ switch(c) {
+ case '?':
+ case '|':
+ case '*':
+ continue; // test separately
+ case '~':
+ case ',':
+ b = false;
+ break;
+ default:
+ b=true;
+ }
+ }
+
+ assertFalse(Validator.ID_CHARS.matcher("abc").matches());
+ assertFalse(Validator.ID_CHARS.matcher("").matches());
+ assertTrue(Validator.ID_CHARS.matcher("abc@att.com").matches());
+ assertTrue(Validator.ID_CHARS.matcher("ab-me@att.com").matches());
+ assertTrue(Validator.ID_CHARS.matcher("ab-me_.x@att._-com").matches());
+
+ assertFalse(Validator.NAME_CHARS.matcher("ab-me_.x@att._-com").matches());
+ assertTrue(Validator.NAME_CHARS.matcher("ab-me").matches());
+ assertTrue(Validator.NAME_CHARS.matcher("ab-me_.xatt._-com").matches());
+
+
+ // 7/22/2016
+ assertTrue(Validator.INST_CHARS.matcher(
+ "/!com.att.*/role/write").matches());
+ assertTrue(Validator.INST_CHARS.matcher(
+ ":!com.att.*:role:write").matches());
+
+ }
+
+}