1 /*******************************************************************************
\r
2 * ============LICENSE_START====================================================
\r
4 * * ===========================================================================
\r
5 * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * * Copyright © 2017 Amdocs
\r
7 * * ===========================================================================
\r
8 * * Licensed under the Apache License, Version 2.0 (the "License");
\r
9 * * you may not use this file except in compliance with the License.
\r
10 * * You may obtain a copy of the License at
\r
12 * * http://www.apache.org/licenses/LICENSE-2.0
\r
14 * * Unless required by applicable law or agreed to in writing, software
\r
15 * * distributed under the License is distributed on an "AS IS" BASIS,
\r
16 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
17 * * See the License for the specific language governing permissions and
\r
18 * * limitations under the License.
\r
19 * * ============LICENSE_END====================================================
\r
21 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
23 ******************************************************************************/
\r
24 package com.osaaf.defOrg;
\r
26 import static org.junit.Assert.*;
\r
28 import java.io.File;
\r
29 import java.io.IOException;
\r
30 import java.util.ArrayList;
\r
31 import java.util.List;
\r
32 import java.util.regex.Matcher;
\r
34 import javax.mail.Address;
\r
35 import javax.mail.internet.InternetAddress;
\r
37 import org.junit.Before;
\r
38 import org.junit.Test;
\r
39 import org.junit.runner.RunWith;
\r
40 import org.mockito.Matchers;
\r
41 import org.mockito.Mock;
\r
42 import org.mockito.MockitoAnnotations;
\r
43 import org.powermock.api.mockito.PowerMockito;
\r
44 import org.powermock.modules.junit4.PowerMockRunner;
\r
46 import com.att.authz.env.AuthzEnv;
\r
47 import com.att.authz.env.AuthzTrans;
\r
48 import com.att.authz.org.Executor;
\r
49 import com.att.authz.org.OrganizationException;
\r
50 import com.att.authz.org.Organization.Identity;
\r
51 import com.att.authz.org.Organization.Policy;
\r
52 import com.osaaf.defOrg.Identities.Data;
\r
54 @RunWith(PowerMockRunner.class)
\r
55 public class JU_DefaultOrg {
\r
57 DefaultOrg defaultOrg;
\r
58 //private DefaultOrg defaultOrgMock;
\r
60 AuthzEnv authzEnvMock;
\r
62 private static final String PROPERTY_IS_REQUIRED = " property is Required";
\r
63 private static final String DOMAIN = "osaaf.com";
\r
64 private static final String REALM = "com.osaaf";
\r
65 private static final String NAME = "Default Organization";
\r
66 private static final String NO_PASS = NAME + " does not support Passwords. Use AAF";
\r
67 String mailHost,mailFromUserId,supportAddress;
\r
68 private String SUFFIX;
\r
72 File fIdentitiesMock;
\r
75 public void setUp() throws OrganizationException{
\r
76 MockitoAnnotations.initMocks(this);
\r
77 PowerMockito.when(authzEnvMock.getProperty(s=(REALM + ".mailHost"), null)).thenReturn("hello");
\r
78 PowerMockito.when(authzEnvMock.getProperty(s=(REALM + ".supportEmail"), null)).thenReturn("notnull");
\r
79 PowerMockito.when(authzEnvMock.getProperty(Matchers.anyString())).thenReturn("C:/Users/sv8675/Desktop/AAF-Code-Sai/AAF-master/authz/authz-defOrg/src/main/java/test.txt");
\r
80 PowerMockito.when(fIdentitiesMock.exists()).thenReturn(true);
\r
81 //PowerMockito.when((fIdentitiesMock!=null && fIdentitiesMock.exists())).thenReturn(true);
\r
82 defaultOrg = new DefaultOrg(authzEnvMock);
\r
85 @Test //(expected=OrganizationException.class)
\r
86 public void test() throws OrganizationException{
\r
87 //PowerMockito.when(authzEnvMock.getProperty(Matchers.anyString())).thenReturn(" ");
\r
88 //defaultOrg = new DefaultOrg(authzEnvMock);
\r
93 public void testIsValidID(){
\r
94 String Result = defaultOrg.isValidID(Matchers.anyString());
\r
95 System.out.println("value of res " +Result);
\r
96 assertNotNull(Result);
\r
100 AuthzTrans authzTransMock;
\r