summaryrefslogtreecommitdiffstats
path: root/authz-service/src/test/java
diff options
context:
space:
mode:
authorsg481n <sg481n@att.com>2017-08-03 17:27:34 -0400
committersg481n <sg481n@att.com>2017-08-03 17:27:34 -0400
commit43854a9e3310ff7a92257d16c4fc0a8321eaec68 (patch)
tree46af936c5da4f9c60d7d63dade5c61a8fd5ef9f4 /authz-service/src/test/java
parentf691a8b8dfc9eea4c6b3bfa45ea60f07ad347e69 (diff)
 [AAF-21] Initial code import
Change-Id: I63d7d499bbd46f500b5f5a4db966166f613f327a Signed-off-by: sg481n <sg481n@att.com>
Diffstat (limited to 'authz-service/src/test/java')
-rw-r--r--authz-service/src/test/java/com/att/authz/cadi/JU_DirectAAFLur.java66
-rw-r--r--authz-service/src/test/java/com/att/authz/cadi/JU_DirectAAFUserPass.java73
-rw-r--r--authz-service/src/test/java/com/att/authz/cadi/JU_DirectCertIdentity.java73
-rw-r--r--authz-service/src/test/java/com/att/authz/service/JU_AuthAPI.java76
-rw-r--r--authz-service/src/test/java/com/att/authz/service/api/JU_API_Api.java60
-rw-r--r--authz-service/src/test/java/com/att/authz/service/api/JU_API_Approval.java62
-rw-r--r--authz-service/src/test/java/com/att/authz/service/api/JU_API_Creds.java73
-rw-r--r--authz-service/src/test/java/com/att/authz/service/api/JU_API_Delegate.java56
-rw-r--r--authz-service/src/test/java/com/att/authz/service/api/JU_API_History.java62
-rw-r--r--authz-service/src/test/java/com/att/authz/service/api/JU_API_Mgmt.java59
-rw-r--r--authz-service/src/test/java/com/att/authz/service/api/JU_API_NS.java51
-rw-r--r--authz-service/src/test/java/com/att/authz/service/api/JU_API_Perms.java68
-rw-r--r--authz-service/src/test/java/com/att/authz/service/api/JU_API_Roles.java57
-rw-r--r--authz-service/src/test/java/com/att/authz/service/api/JU_API_User.java57
-rw-r--r--authz-service/src/test/java/com/att/authz/service/api/JU_API_UserRole.java53
-rw-r--r--authz-service/src/test/java/com/att/authz/service/mapper/JU_Mapper_2_0.java164
-rw-r--r--authz-service/src/test/java/com/att/authz/service/test/JU_Validator.java161
-rw-r--r--authz-service/src/test/java/com/att/authz/service/validation/JU_Validator.java178
18 files changed, 1449 insertions, 0 deletions
diff --git a/authz-service/src/test/java/com/att/authz/cadi/JU_DirectAAFLur.java b/authz-service/src/test/java/com/att/authz/cadi/JU_DirectAAFLur.java
new file mode 100644
index 00000000..f2e566dd
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/cadi/JU_DirectAAFLur.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.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.powermock.modules.junit4.PowerMockRunner;
+
+import com.att.authz.env.AuthzEnv;
+import com.att.cadi.Permission;
+import com.att.dao.aaf.hl.Question;
+@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/com/att/authz/cadi/JU_DirectAAFUserPass.java b/authz-service/src/test/java/com/att/authz/cadi/JU_DirectAAFUserPass.java
new file mode 100644
index 00000000..bc1eca11
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/cadi/JU_DirectAAFUserPass.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.authz.cadi;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.att.authz.env.AuthzEnv;
+import com.att.cadi.CredVal.Type;
+import com.att.dao.aaf.hl.Question;
+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.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/com/att/authz/cadi/JU_DirectCertIdentity.java b/authz-service/src/test/java/com/att/authz/cadi/JU_DirectCertIdentity.java
new file mode 100644
index 00000000..441a6f3a
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/cadi/JU_DirectCertIdentity.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.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.powermock.modules.junit4.PowerMockRunner;
+
+import com.att.dao.aaf.cached.CachedCertDAO;
+
+@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/com/att/authz/service/JU_AuthAPI.java b/authz-service/src/test/java/com/att/authz/service/JU_AuthAPI.java
new file mode 100644
index 00000000..de3c1ed5
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/service/JU_AuthAPI.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.authz.service;
+
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.att.authz.cadi.DirectAAFUserPass;
+import com.att.authz.env.AuthzEnv;
+import com.att.authz.facade.AuthzFacade_2_0;
+import com.att.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/com/att/authz/service/api/JU_API_Api.java b/authz-service/src/test/java/com/att/authz/service/api/JU_API_Api.java
new file mode 100644
index 00000000..ecd13e68
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/service/api/JU_API_Api.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+
+import com.att.authz.facade.AuthzFacade;
+import com.att.authz.service.AuthAPI;
+
+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/com/att/authz/service/api/JU_API_Approval.java b/authz-service/src/test/java/com/att/authz/service/api/JU_API_Approval.java
new file mode 100644
index 00000000..8ad520ee
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/service/api/JU_API_Approval.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+
+import com.att.authz.facade.AuthzFacade;
+import com.att.authz.service.AuthAPI;
+
+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/com/att/authz/service/api/JU_API_Creds.java b/authz-service/src/test/java/com/att/authz/service/api/JU_API_Creds.java
new file mode 100644
index 00000000..c0105de9
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/service/api/JU_API_Creds.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+
+import com.att.authz.cadi.DirectAAFUserPass;
+import com.att.authz.facade.AuthzFacade;
+import com.att.authz.service.AuthAPI;
+import com.att.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/com/att/authz/service/api/JU_API_Delegate.java b/authz-service/src/test/java/com/att/authz/service/api/JU_API_Delegate.java
new file mode 100644
index 00000000..23d09248
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/service/api/JU_API_Delegate.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.authz.service.api;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+
+import com.att.authz.facade.AuthzFacade;
+import com.att.authz.service.AuthAPI;
+
+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/com/att/authz/service/api/JU_API_History.java b/authz-service/src/test/java/com/att/authz/service/api/JU_API_History.java
new file mode 100644
index 00000000..4cbab1cd
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/service/api/JU_API_History.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+
+import com.att.authz.facade.AuthzFacade;
+import com.att.authz.service.AuthAPI;
+
+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/com/att/authz/service/api/JU_API_Mgmt.java b/authz-service/src/test/java/com/att/authz/service/api/JU_API_Mgmt.java
new file mode 100644
index 00000000..474af92c
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/service/api/JU_API_Mgmt.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+
+import com.att.authz.facade.AuthzFacade;
+import com.att.authz.service.AuthAPI;
+
+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/com/att/authz/service/api/JU_API_NS.java b/authz-service/src/test/java/com/att/authz/service/api/JU_API_NS.java
new file mode 100644
index 00000000..726a7548
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/service/api/JU_API_NS.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.mockito.Mock;
+
+import com.att.authz.facade.AuthzFacade;
+import com.att.authz.service.AuthAPI;
+
+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/com/att/authz/service/api/JU_API_Perms.java b/authz-service/src/test/java/com/att/authz/service/api/JU_API_Perms.java
new file mode 100644
index 00000000..b0f95e5b
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/service/api/JU_API_Perms.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+
+import com.att.authz.facade.AuthzFacade;
+import com.att.authz.service.AuthAPI;
+
+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/com/att/authz/service/api/JU_API_Roles.java b/authz-service/src/test/java/com/att/authz/service/api/JU_API_Roles.java
new file mode 100644
index 00000000..9eed4a27
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/service/api/JU_API_Roles.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+
+import com.att.authz.facade.AuthzFacade;
+import com.att.authz.service.AuthAPI;
+
+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/com/att/authz/service/api/JU_API_User.java b/authz-service/src/test/java/com/att/authz/service/api/JU_API_User.java
new file mode 100644
index 00000000..b1be0dd3
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/service/api/JU_API_User.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+
+import com.att.authz.facade.AuthzFacade;
+import com.att.authz.service.AuthAPI;
+
+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/com/att/authz/service/api/JU_API_UserRole.java b/authz-service/src/test/java/com/att/authz/service/api/JU_API_UserRole.java
new file mode 100644
index 00000000..3ac84a49
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/service/api/JU_API_UserRole.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.authz.service.api;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+
+import com.att.authz.facade.AuthzFacade;
+import com.att.authz.service.AuthAPI;
+
+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/com/att/authz/service/mapper/JU_Mapper_2_0.java b/authz-service/src/test/java/com/att/authz/service/mapper/JU_Mapper_2_0.java
new file mode 100644
index 00000000..aee5d5bd
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/service/mapper/JU_Mapper_2_0.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.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/com/att/authz/service/test/JU_Validator.java b/authz-service/src/test/java/com/att/authz/service/test/JU_Validator.java
new file mode 100644
index 00000000..40ab4517
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/service/test/JU_Validator.java
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.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 com.att.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/com/att/authz/service/validation/JU_Validator.java b/authz-service/src/test/java/com/att/authz/service/validation/JU_Validator.java
new file mode 100644
index 00000000..7c0b2206
--- /dev/null
+++ b/authz-service/src/test/java/com/att/authz/service/validation/JU_Validator.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aai
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * Copyright © 2017 Amdocs
+ * * ===========================================================================
+ * * 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 com.att.authz.service.validation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import com.att.authz.cadi.DirectAAFLur.PermPermission;
+import com.att.authz.env.AuthzTrans;
+import com.att.authz.layer.Result;
+import com.att.authz.org.Organization;
+import com.att.dao.aaf.cass.CredDAO;
+import com.att.dao.aaf.cass.DelegateDAO;
+import com.att.dao.aaf.cass.Namespace;
+import com.att.dao.aaf.cass.PermDAO;
+import com.att.dao.aaf.cass.RoleDAO;
+import com.att.dao.aaf.cass.UserRoleDAO;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.att.authz.service.validation.Validator;
+
+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());
+
+ }
+
+}