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