diff options
author | Instrumental <jonathan.gathman@att.com> | 2018-09-07 12:21:34 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2018-09-07 12:22:50 -0500 |
commit | 4b5a7d721d994a49057e9bfb403c7bff1b376660 (patch) | |
tree | a36d03227b63a3e60346d6c3ca87b061087dae85 /auth/auth-deforg/src/test | |
parent | 824dc7b5fc0e1ccdf7f460479aff344727f0f01e (diff) |
Mass removal of all Tabs (Style Warnings)
Issue-ID: AAF-473
Change-Id: Iaf0ef8120882937959bb0065f2f6ba74a021940f
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/auth-deforg/src/test')
5 files changed, 380 insertions, 380 deletions
diff --git a/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrg.java b/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrg.java index b0ade8c0..e52f3cca 100644 --- a/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrg.java +++ b/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrg.java @@ -53,219 +53,219 @@ import org.powermock.modules.junit4.PowerMockRunner; public class JU_DefaultOrg { - private DefaultOrg defaultOrg; + private DefaultOrg defaultOrg; - Identities.Data data; + Identities.Data data; - @Mock - Env envMock; + @Mock + Env envMock; - @Mock - AuthzTrans authzTransMock; + @Mock + AuthzTrans authzTransMock; - @Mock - TimeTaken ttMock; + @Mock + TimeTaken ttMock; - @Mock - LogTarget logTargetMock; + @Mock + LogTarget logTargetMock; - private static final String PROPERTY_IS_REQUIRED = " property is Required"; - private static final String DOMAIN = "osaaf.com"; - private static final String REALM = "com.osaaf"; - private static final String NAME = "Default Organization"; - private static final String NO_PASS = NAME + " does not support Passwords. Use AAF"; + private static final String PROPERTY_IS_REQUIRED = " property is Required"; + private static final String DOMAIN = "osaaf.com"; + private static final String REALM = "com.osaaf"; + private static final String NAME = "Default Organization"; + private static final String NO_PASS = NAME + " does not support Passwords. Use AAF"; - private static final String URL = "www.deforg.com"; - private static final String IDENT = "ccontra|iowna"; - private static final String CCS = "mmanager|bdevl"; - String mailHost,mailFromUserId,summary,supportAddress; + private static final String URL = "www.deforg.com"; + private static final String IDENT = "ccontra|iowna"; + private static final String CCS = "mmanager|bdevl"; + String mailHost,mailFromUserId,summary,supportAddress; - private final static int TIMEOUT = Integer.parseInt(Config.AAF_CONN_TIMEOUT_DEF); + private final static int TIMEOUT = Integer.parseInt(Config.AAF_CONN_TIMEOUT_DEF); - @Before - public void setUp() throws OrganizationException{ + @Before + public void setUp() throws OrganizationException{ - mailFromUserId = "frommail"; - mailHost = "hostmail"; - File file = new File("src/test/resources/"); - when(envMock.getProperty(REALM + ".name","Default Organization")).thenReturn(NAME); - when(envMock.getProperty(REALM + ".mailHost",null)).thenReturn(mailHost); - when(envMock.getProperty(REALM + ".mailFrom",null)).thenReturn(mailFromUserId); - when(envMock.getProperty("aaf_data_dir")).thenReturn(file.getAbsolutePath()); - when(envMock.warn()).thenReturn(logTargetMock); - when(authzTransMock.warn()).thenReturn(logTargetMock); - when(authzTransMock.start(any(String.class),any(Integer.class))).thenReturn(ttMock); - when(authzTransMock.error()).thenReturn(logTargetMock); - when(authzTransMock.getProperty("CASS_ENV", "")).thenReturn("Cassandra env"); + mailFromUserId = "frommail"; + mailHost = "hostmail"; + File file = new File("src/test/resources/"); + when(envMock.getProperty(REALM + ".name","Default Organization")).thenReturn(NAME); + when(envMock.getProperty(REALM + ".mailHost",null)).thenReturn(mailHost); + when(envMock.getProperty(REALM + ".mailFrom",null)).thenReturn(mailFromUserId); + when(envMock.getProperty("aaf_data_dir")).thenReturn(file.getAbsolutePath()); + when(envMock.warn()).thenReturn(logTargetMock); + when(authzTransMock.warn()).thenReturn(logTargetMock); + when(authzTransMock.start(any(String.class),any(Integer.class))).thenReturn(ttMock); + when(authzTransMock.error()).thenReturn(logTargetMock); + when(authzTransMock.getProperty("CASS_ENV", "")).thenReturn("Cassandra env"); - defaultOrg = new DefaultOrg(envMock, REALM); + defaultOrg = new DefaultOrg(envMock, REALM); - } + } - @Test - public void testDefOrg_returnDataIdentityNotNull() throws OrganizationException { + @Test + public void testDefOrg_returnDataIdentityNotNull() throws OrganizationException { - try { - defaultOrg.identities.open(authzTransMock, TIMEOUT); - try { - Reuse r = defaultOrg.identities.reuse(); - data = defaultOrg.identities.find("iowna", defaultOrg.identities.reuse()); - System.out.println("here is identities data: "+ data.toString()); + try { + defaultOrg.identities.open(authzTransMock, TIMEOUT); + try { + Reuse r = defaultOrg.identities.reuse(); + data = defaultOrg.identities.find("iowna", defaultOrg.identities.reuse()); + System.out.println("here is identities data: "+ data.toString()); - } finally { - defaultOrg.identities.close(authzTransMock); - } - } catch (IOException e) { - throw new OrganizationException(e); - } + } finally { + defaultOrg.identities.close(authzTransMock); + } + } catch (IOException e) { + throw new OrganizationException(e); + } - assertTrue(data.toString() != null); + assertTrue(data.toString() != null); - } + } - @Test - public void testDefOrg_returnDefOrgEntity() { + @Test + public void testDefOrg_returnDefOrgEntity() { - assertTrue(defaultOrg != null); + assertTrue(defaultOrg != null); - } + } - @Test - public void testDefOrgNotifyApproval_returnResponseOK() { + @Test + public void testDefOrgNotifyApproval_returnResponseOK() { - summary = "Approval"; - Boolean urgent = false; - DefaultOrg.Response response = defaultOrg.notify(authzTransMock, DefaultOrg.Notify.Approval, URL, IDENT.split("\\|"), CCS.split("\\|"), summary, urgent); - assertEquals(response.name(), "OK"); + summary = "Approval"; + Boolean urgent = false; + DefaultOrg.Response response = defaultOrg.notify(authzTransMock, DefaultOrg.Notify.Approval, URL, IDENT.split("\\|"), CCS.split("\\|"), summary, urgent); + assertEquals(response.name(), "OK"); - } - - @Test - public void testDefOrgPasswords() { - assertEquals(defaultOrg.isValidPassword(authzTransMock, null, "new2You!", "Pilgrim"),""); - assertEquals(defaultOrg.isValidPassword(authzTransMock, null, "new2you!", "Pilgrim"),""); - assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "newtoyou", "Pilgrim"),""); - } + } + + @Test + public void testDefOrgPasswords() { + assertEquals(defaultOrg.isValidPassword(authzTransMock, null, "new2You!", "Pilgrim"),""); + assertEquals(defaultOrg.isValidPassword(authzTransMock, null, "new2you!", "Pilgrim"),""); + assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "newtoyou", "Pilgrim"),""); + } - @Test - public void testDefOrgNotifyPasswordExpiration_returnResponseOK() { + @Test + public void testDefOrgNotifyPasswordExpiration_returnResponseOK() { - summary = "PasswordExpiration"; - Boolean urgent = false; - DefaultOrg.Response response = defaultOrg.notify(authzTransMock, DefaultOrg.Notify.PasswordExpiration, URL, IDENT.split("\\|"), CCS.split("\\|"), summary, urgent); - assertEquals(response.name(), "OK"); + summary = "PasswordExpiration"; + Boolean urgent = false; + DefaultOrg.Response response = defaultOrg.notify(authzTransMock, DefaultOrg.Notify.PasswordExpiration, URL, IDENT.split("\\|"), CCS.split("\\|"), summary, urgent); + assertEquals(response.name(), "OK"); - } + } - @Test - public void testDefOrgNotifyRoleExpiration_returnResponseOK() { + @Test + public void testDefOrgNotifyRoleExpiration_returnResponseOK() { - summary = "RoleExpiration"; - Boolean urgent = false; - DefaultOrg.Response response = defaultOrg.notify(authzTransMock, DefaultOrg.Notify.RoleExpiration, URL, IDENT.split("\\|"), CCS.split("\\|"), summary, urgent); - assertEquals(response.name(), "OK"); - } + summary = "RoleExpiration"; + Boolean urgent = false; + DefaultOrg.Response response = defaultOrg.notify(authzTransMock, DefaultOrg.Notify.RoleExpiration, URL, IDENT.split("\\|"), CCS.split("\\|"), summary, urgent); + assertEquals(response.name(), "OK"); + } - @Test - public void testDefOrgNotifyRoleExpirationUrgent_returnResponseOK() { + @Test + public void testDefOrgNotifyRoleExpirationUrgent_returnResponseOK() { - summary = "RoleExpirationUrgent"; - Boolean urgent = true; - when(authzTransMock.info()).thenReturn(logTargetMock); - DefaultOrg.Response response = defaultOrg.notify(authzTransMock, DefaultOrg.Notify.RoleExpiration, URL, IDENT.split("\\|"), CCS.split("\\|"), summary, urgent); - assertEquals(response.name(), "OK"); + summary = "RoleExpirationUrgent"; + Boolean urgent = true; + when(authzTransMock.info()).thenReturn(logTargetMock); + DefaultOrg.Response response = defaultOrg.notify(authzTransMock, DefaultOrg.Notify.RoleExpiration, URL, IDENT.split("\\|"), CCS.split("\\|"), summary, urgent); + assertEquals(response.name(), "OK"); - } - - @Test - public void testDefOrgNotifyModeTest_returnResponseOK() { - - summary = "ModeTest"; - Boolean urgent = false; - when(authzTransMock.info()).thenReturn(logTargetMock); - defaultOrg.setTestMode(true); - DefaultOrg.Response response = defaultOrg.notify(authzTransMock, DefaultOrg.Notify.RoleExpiration, URL, IDENT.split("\\|"), CCS.split("\\|"), summary, urgent); - assertEquals(response.name(), "OK"); + } + + @Test + public void testDefOrgNotifyModeTest_returnResponseOK() { + + summary = "ModeTest"; + Boolean urgent = false; + when(authzTransMock.info()).thenReturn(logTargetMock); + defaultOrg.setTestMode(true); + DefaultOrg.Response response = defaultOrg.notify(authzTransMock, DefaultOrg.Notify.RoleExpiration, URL, IDENT.split("\\|"), CCS.split("\\|"), summary, urgent); + assertEquals(response.name(), "OK"); - } + } - //@Test //(expected=OrganizationException.class) - public void testMultipleCreds() throws OrganizationException{ - String id = "test"; - boolean canHaveMultipleCreds; - canHaveMultipleCreds = defaultOrg.canHaveMultipleCreds(id ); - System.out.println("value of canHaveMultipleCreds: " + canHaveMultipleCreds); - assertTrue(canHaveMultipleCreds); - } - + //@Test //(expected=OrganizationException.class) + public void testMultipleCreds() throws OrganizationException{ + String id = "test"; + boolean canHaveMultipleCreds; + canHaveMultipleCreds = defaultOrg.canHaveMultipleCreds(id ); + System.out.println("value of canHaveMultipleCreds: " + canHaveMultipleCreds); + assertTrue(canHaveMultipleCreds); + } + - //@Test - public void testGetIdentityTypes() throws OrganizationException{ - Set<String> identityTypes = defaultOrg.getIdentityTypes(); - System.out.println("value of IdentityTypes: " + identityTypes); - assertTrue(identityTypes.size() == 4); - } + //@Test + public void testGetIdentityTypes() throws OrganizationException{ + Set<String> identityTypes = defaultOrg.getIdentityTypes(); + System.out.println("value of IdentityTypes: " + identityTypes); + assertTrue(identityTypes.size() == 4); + } - //@Test - public void testGetRealm() throws OrganizationException{ - String realmTest = defaultOrg.getRealm(); - System.out.println("value of realm: " + realmTest); - assertTrue(realmTest == REALM); - } - - public void supportsRealm() { - String otherRealm = "org.ossaf.something"; - defaultOrg.addSupportedRealm(otherRealm); - assertTrue(defaultOrg.supportsRealm(otherRealm)); - } - //@Test - public void testGetName() throws OrganizationException{ - String testName = defaultOrg.getName(); - System.out.println("value of name: " + testName); - assertTrue(testName == NAME); - } - - - //@Test - public void testGetDomain() throws OrganizationException{ - String testDomain = defaultOrg.getDomain(); - System.out.println("value of domain: " + testDomain); - assertTrue(testDomain == DOMAIN); - } - - // @Test - // public void testIsValidID(){ - // String Result = defaultOrg.isValidID(Matchers.anyString()); - // System.out.println("value of res " +Result); - // assertNotNull(Result); - // } - - @Test - public void testResponsible() throws OrganizationException { - Identity id = defaultOrg.getIdentity(authzTransMock, "osaaf"); - Identity rt = id.responsibleTo(); - assertTrue(rt.id().equals("bdevl")); - - } - - //@Test - public void notYetImplemented() { - fail("Tests in this file should not be trusted"); - } + //@Test + public void testGetRealm() throws OrganizationException{ + String realmTest = defaultOrg.getRealm(); + System.out.println("value of realm: " + realmTest); + assertTrue(realmTest == REALM); + } + + public void supportsRealm() { + String otherRealm = "org.ossaf.something"; + defaultOrg.addSupportedRealm(otherRealm); + assertTrue(defaultOrg.supportsRealm(otherRealm)); + } + //@Test + public void testGetName() throws OrganizationException{ + String testName = defaultOrg.getName(); + System.out.println("value of name: " + testName); + assertTrue(testName == NAME); + } + + + //@Test + public void testGetDomain() throws OrganizationException{ + String testDomain = defaultOrg.getDomain(); + System.out.println("value of domain: " + testDomain); + assertTrue(testDomain == DOMAIN); + } + + // @Test + // public void testIsValidID(){ + // String Result = defaultOrg.isValidID(Matchers.anyString()); + // System.out.println("value of res " +Result); + // assertNotNull(Result); + // } + + @Test + public void testResponsible() throws OrganizationException { + Identity id = defaultOrg.getIdentity(authzTransMock, "osaaf"); + Identity rt = id.responsibleTo(); + assertTrue(rt.id().equals("bdevl")); + + } + + //@Test + public void notYetImplemented() { + fail("Tests in this file should not be trusted"); + } } diff --git a/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrgIdentity.java b/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrgIdentity.java index 3e5c74b5..d0d08075 100644 --- a/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrgIdentity.java +++ b/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrgIdentity.java @@ -44,120 +44,120 @@ import java.io.IOException; @RunWith(PowerMockRunner.class) public class JU_DefaultOrgIdentity { - private DefaultOrg defaultOrgMock; + private DefaultOrg defaultOrgMock; - @Mock - private Reuse rMock; + @Mock + private Reuse rMock; - @Mock - AuthzTrans authzTransMock; + @Mock + AuthzTrans authzTransMock; - @Mock - private Data dataMock; + @Mock + private Data dataMock; - @Mock - private DefaultOrgIdentity defaultOrgIdentity; + @Mock + private DefaultOrgIdentity defaultOrgIdentity; - static String key = "iowna@deforg"; - static String orgDomain = "@deforg"; + static String key = "iowna@deforg"; + static String orgDomain = "@deforg"; - @Before - public void setUp() throws IOException, OrganizationException { - MockitoAnnotations.initMocks(this); - defaultOrgMock = PowerMockito.mock(DefaultOrg.class); - defaultOrgMock.identities = mock(Identities.class); + @Before + public void setUp() throws IOException, OrganizationException { + MockitoAnnotations.initMocks(this); + defaultOrgMock = PowerMockito.mock(DefaultOrg.class); + defaultOrgMock.identities = mock(Identities.class); - authzTransMock = PowerMockito.mock(AuthzTrans.class); + authzTransMock = PowerMockito.mock(AuthzTrans.class); - when(defaultOrgMock.getDomain()).thenReturn(orgDomain); - when(defaultOrgMock.identities.reuse()).thenReturn(rMock); - when(defaultOrgMock.identities.find(eq(key),any(Reuse.class))).thenReturn(dataMock); + when(defaultOrgMock.getDomain()).thenReturn(orgDomain); + when(defaultOrgMock.identities.reuse()).thenReturn(rMock); + when(defaultOrgMock.identities.find(eq(key),any(Reuse.class))).thenReturn(dataMock); - defaultOrgIdentity = new DefaultOrgIdentity(authzTransMock, key, defaultOrgMock); + defaultOrgIdentity = new DefaultOrgIdentity(authzTransMock, key, defaultOrgMock); - } + } - @Test - public void testIdentify_returnIdentifiedEntity() { + @Test + public void testIdentify_returnIdentifiedEntity() { - assertTrue(defaultOrgIdentity.id() != null); + assertTrue(defaultOrgIdentity.id() != null); - } + } - @Test - public void testIdentify_returnIdentifiedEntityWithDataNull() throws IOException, OrganizationException { + @Test + public void testIdentify_returnIdentifiedEntityWithDataNull() throws IOException, OrganizationException { - when(defaultOrgMock.identities.find(eq(key),any(Reuse.class))).thenReturn(null); + when(defaultOrgMock.identities.find(eq(key),any(Reuse.class))).thenReturn(null); - DefaultOrgIdentity defaultOrgIdentityDataNull = new DefaultOrgIdentity(authzTransMock, key, defaultOrgMock); - assertTrue(defaultOrgIdentityDataNull.id() != null); + DefaultOrgIdentity defaultOrgIdentityDataNull = new DefaultOrgIdentity(authzTransMock, key, defaultOrgMock); + assertTrue(defaultOrgIdentityDataNull.id() != null); - } + } - @Test(expected = OrganizationException.class) - public void testIdentify_returnThrowIOException() throws OrganizationException { + @Test(expected = OrganizationException.class) + public void testIdentify_returnThrowIOException() throws OrganizationException { - when(defaultOrgMock.getDomain()).thenReturn(orgDomain); - when(defaultOrgMock.identities.reuse()).thenThrow(IOException.class); - DefaultOrgIdentity defaultOrgIdentityException = new DefaultOrgIdentity(authzTransMock, key, defaultOrgMock); + when(defaultOrgMock.getDomain()).thenReturn(orgDomain); + when(defaultOrgMock.identities.reuse()).thenThrow(IOException.class); + DefaultOrgIdentity defaultOrgIdentityException = new DefaultOrgIdentity(authzTransMock, key, defaultOrgMock); - } + } - @Test - public void testEquals_returnTrue() { + @Test + public void testEquals_returnTrue() { - Object b = defaultOrgIdentity; - assertTrue(defaultOrgIdentity.equals(b) == true ); - } + Object b = defaultOrgIdentity; + assertTrue(defaultOrgIdentity.equals(b) == true ); + } - @Test - public void testStatus_returnUnknown() { + @Test + public void testStatus_returnUnknown() { - assertEquals(defaultOrgIdentity.type(), "Unknown"); + assertEquals(defaultOrgIdentity.type(), "Unknown"); - } + } - @Test - public void testHash_returnHashCode() { + @Test + public void testHash_returnHashCode() { - assertTrue(defaultOrgIdentity.hashCode() != 0 ); + assertTrue(defaultOrgIdentity.hashCode() != 0 ); - } + } - @Test - public void testFullId_returnFullId() throws IOException, OrganizationException{ - String key="toto@deforg"; - String orgDomain="@deforg"; - when(defaultOrgMock.getDomain()).thenReturn(orgDomain); - when(defaultOrgMock.identities.reuse()).thenReturn(rMock); - when(defaultOrgMock.identities.find(eq(key),any(Reuse.class))).thenReturn(dataMock); - defaultOrgIdentity = new DefaultOrgIdentity(authzTransMock, key, defaultOrgMock); + @Test + public void testFullId_returnFullId() throws IOException, OrganizationException{ + String key="toto@deforg"; + String orgDomain="@deforg"; + when(defaultOrgMock.getDomain()).thenReturn(orgDomain); + when(defaultOrgMock.identities.reuse()).thenReturn(rMock); + when(defaultOrgMock.identities.find(eq(key),any(Reuse.class))).thenReturn(dataMock); + defaultOrgIdentity = new DefaultOrgIdentity(authzTransMock, key, defaultOrgMock); - assertTrue(defaultOrgIdentity.fullID().contains("@") ); - } + assertTrue(defaultOrgIdentity.fullID().contains("@") ); + } - @Test - public void testEmail_returnEmail() { + @Test + public void testEmail_returnEmail() { - assertTrue(defaultOrgIdentity.email() != null ); - } + assertTrue(defaultOrgIdentity.email() != null ); + } - @Test - public void testFullName_returnFullName() { + @Test + public void testFullName_returnFullName() { - assertTrue(defaultOrgIdentity.fullName() != null ); - } + assertTrue(defaultOrgIdentity.fullName() != null ); + } - @Test - public void testFirstName_returnFirstName() { + @Test + public void testFirstName_returnFirstName() { - assertTrue(defaultOrgIdentity.firstName() != null ); - } + assertTrue(defaultOrgIdentity.firstName() != null ); + } diff --git a/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrgWarnings.java b/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrgWarnings.java index 2692d608..ad92c3e1 100644 --- a/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrgWarnings.java +++ b/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrgWarnings.java @@ -34,50 +34,50 @@ import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) public class JU_DefaultOrgWarnings { - private DefaultOrgWarnings defaultOrgWarningsMock; - private DefaultOrgWarnings defaultOrgWarnings; + private DefaultOrgWarnings defaultOrgWarningsMock; + private DefaultOrgWarnings defaultOrgWarnings; - @Before - public void setUp(){ - MockitoAnnotations.initMocks(this); + @Before + public void setUp(){ + MockitoAnnotations.initMocks(this); - defaultOrgWarningsMock = PowerMockito.mock(DefaultOrgWarnings.class); + defaultOrgWarningsMock = PowerMockito.mock(DefaultOrgWarnings.class); - defaultOrgWarnings = new DefaultOrgWarnings(); - } + defaultOrgWarnings = new DefaultOrgWarnings(); + } - @Test - public void testApprEmailInterval() { + @Test + public void testApprEmailInterval() { - assertEquals(259200000, defaultOrgWarnings.apprEmailInterval() ); - } + assertEquals(259200000, defaultOrgWarnings.apprEmailInterval() ); + } - @Test - public void testCredEmailInterval() { - assertEquals(604800000, defaultOrgWarnings.credEmailInterval()); + @Test + public void testCredEmailInterval() { + assertEquals(604800000, defaultOrgWarnings.credEmailInterval()); - } + } - @Test - public void testCredExpirationWarning() { - assertEquals(2592000000L, defaultOrgWarnings.credExpirationWarning()); - } + @Test + public void testCredExpirationWarning() { + assertEquals(2592000000L, defaultOrgWarnings.credExpirationWarning()); + } - @Test - public void testEmailUrgentWarning() { - assertEquals(1209600000L, defaultOrgWarnings.emailUrgentWarning()); - } + @Test + public void testEmailUrgentWarning() { + assertEquals(1209600000L, defaultOrgWarnings.emailUrgentWarning()); + } - @Test - public void testRoleEmailInterval() { - assertEquals(604800000L, defaultOrgWarnings.roleEmailInterval()); - } + @Test + public void testRoleEmailInterval() { + assertEquals(604800000L, defaultOrgWarnings.roleEmailInterval()); + } - @Test - public void testRoleExpirationWarning() { - assertEquals(2592000000L, defaultOrgWarnings.roleExpirationWarning()); - } + @Test + public void testRoleExpirationWarning() { + assertEquals(2592000000L, defaultOrgWarnings.roleExpirationWarning()); + } } diff --git a/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_Identities.java b/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_Identities.java index 458d3b25..6fa7a347 100644 --- a/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_Identities.java +++ b/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_Identities.java @@ -44,67 +44,67 @@ import org.onap.aaf.org.Identities.Data; */ public class JU_Identities { // -// private static final String DATA_IDENTITIES = "/opt/app/onap/data/identities.dat"; -// private static File fids; -// private static Identities ids; -// private static AuthzEnv env; +// private static final String DATA_IDENTITIES = "/opt/app/onap/data/identities.dat"; +// private static File fids; +// private static Identities ids; +// private static AuthzEnv env; // -// /** -// * @throws java.lang.Exception -// */ -// @BeforeClass -// public static void setUpBeforeClass() throws Exception { -// env = new AuthzEnv(); -// AuthzTrans trans = env.newTransNoAvg(); -// // Note: utilize TimeTaken, from trans.start if you want to time. -// fids = new File(DATA_IDENTITIES); -// if(fids.exists()) { -// ids = new Identities(fids); -// ids.open(trans, 5000); -// } else { -// -// throw new Exception("Data File for Tests, \"" + DATA_IDENTITIES -// + "\" must exist before test can run. (Current dir is " + System.getProperty("user.dir") + ")"); -// } -// } +// /** +// * @throws java.lang.Exception +// */ +// @BeforeClass +// public static void setUpBeforeClass() throws Exception { +// env = new AuthzEnv(); +// AuthzTrans trans = env.newTransNoAvg(); +// // Note: utilize TimeTaken, from trans.start if you want to time. +// fids = new File(DATA_IDENTITIES); +// if(fids.exists()) { +// ids = new Identities(fids); +// ids.open(trans, 5000); +// } else { +// +// throw new Exception("Data File for Tests, \"" + DATA_IDENTITIES +// + "\" must exist before test can run. (Current dir is " + System.getProperty("user.dir") + ")"); +// } +// } // -// /** -// * @throws java.lang.Exception -// */ -// @AfterClass -// public static void tearDownAfterClass() throws Exception { -// AuthzTrans trans = env.newTransNoAvg(); -// if(ids!=null) { -// ids.close(trans); -// } -// } +// /** +// * @throws java.lang.Exception +// */ +// @AfterClass +// public static void tearDownAfterClass() throws Exception { +// AuthzTrans trans = env.newTransNoAvg(); +// if(ids!=null) { +// ids.close(trans); +// } +// } // -// /** -// * @throws java.lang.Exception -// */ -// @Before -// public void setUp() throws Exception { -// } +// /** +// * @throws java.lang.Exception +// */ +// @Before +// public void setUp() throws Exception { +// } // -// /** -// * @throws java.lang.Exception -// */ -// @After -// public void tearDown() throws Exception { -// } +// /** +// * @throws java.lang.Exception +// */ +// @After +// public void tearDown() throws Exception { +// } // -// @Test -// public void test() throws IOException { -// Reuse reuse = ids.reuse(); // this object can be reused within the same thread. -// Data id = ids.find("osaaf",reuse); -// Assert.assertNotNull(id); -// System.out.println(id); +// @Test +// public void test() throws IOException { +// Reuse reuse = ids.reuse(); // this object can be reused within the same thread. +// Data id = ids.find("osaaf",reuse); +// Assert.assertNotNull(id); +// System.out.println(id); // -// id = ids.find("mmanager",reuse); -// Assert.assertNotNull(id); -// System.out.println(id); +// id = ids.find("mmanager",reuse); +// Assert.assertNotNull(id); +// System.out.println(id); // -// //TODO Fill out JUnit with Tests of all Methods in "Data id" -// } +// //TODO Fill out JUnit with Tests of all Methods in "Data id" +// } } diff --git a/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_Passwords.java b/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_Passwords.java index 72e4ff87..847e59f1 100644 --- a/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_Passwords.java +++ b/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_Passwords.java @@ -46,80 +46,80 @@ import org.powermock.modules.junit4.PowerMockRunner; public class JU_Passwords { - private DefaultOrg defaultOrg; + private DefaultOrg defaultOrg; - Identities.Data data; + Identities.Data data; - @Mock - Env envMock; + @Mock + Env envMock; - @Mock - AuthzTrans authzTransMock; + @Mock + AuthzTrans authzTransMock; - @Mock - TimeTaken ttMock; + @Mock + TimeTaken ttMock; - @Mock - LogTarget logTargetMock; + @Mock + LogTarget logTargetMock; - private static final String REALM = "org.osaaf"; - private static final String NAME = "Default Organization"; + private static final String REALM = "org.osaaf"; + private static final String NAME = "Default Organization"; - String mailHost,mailFromUserId,summary,supportAddress; + String mailHost,mailFromUserId,summary,supportAddress; - @Before - public void setUp() throws OrganizationException{ + @Before + public void setUp() throws OrganizationException{ - mailFromUserId = "frommail"; - mailHost = "hostmail"; - File file = new File("src/test/resources/"); - when(envMock.getProperty(REALM + ".name","Default Organization")).thenReturn(NAME); - when(envMock.getProperty(REALM + ".mailHost",null)).thenReturn(mailHost); - when(envMock.getProperty(REALM + ".mailFrom",null)).thenReturn(mailFromUserId); - when(envMock.getProperty("aaf_data_dir")).thenReturn(file.getAbsolutePath()); - when(envMock.warn()).thenReturn(logTargetMock); - when(authzTransMock.warn()).thenReturn(logTargetMock); - when(authzTransMock.start(any(String.class),any(Integer.class))).thenReturn(ttMock); - when(authzTransMock.error()).thenReturn(logTargetMock); - when(authzTransMock.getProperty("CASS_ENV", "")).thenReturn("Cassandra env"); + mailFromUserId = "frommail"; + mailHost = "hostmail"; + File file = new File("src/test/resources/"); + when(envMock.getProperty(REALM + ".name","Default Organization")).thenReturn(NAME); + when(envMock.getProperty(REALM + ".mailHost",null)).thenReturn(mailHost); + when(envMock.getProperty(REALM + ".mailFrom",null)).thenReturn(mailFromUserId); + when(envMock.getProperty("aaf_data_dir")).thenReturn(file.getAbsolutePath()); + when(envMock.warn()).thenReturn(logTargetMock); + when(authzTransMock.warn()).thenReturn(logTargetMock); + when(authzTransMock.start(any(String.class),any(Integer.class))).thenReturn(ttMock); + when(authzTransMock.error()).thenReturn(logTargetMock); + when(authzTransMock.getProperty("CASS_ENV", "")).thenReturn("Cassandra env"); - defaultOrg = new DefaultOrg(envMock, REALM); + defaultOrg = new DefaultOrg(envMock, REALM); - } + } - @Test - public void testDefOrgPasswords() { - // Accepts letters and one of (number, Special Char, Upper) - assertEquals(defaultOrg.isValidPassword(authzTransMock, null, "newyou2", "Pilgrim"),""); - assertEquals(defaultOrg.isValidPassword(authzTransMock, null, "newyou!", "Pilgrim"),""); - assertEquals(defaultOrg.isValidPassword(authzTransMock, null, "newyou!", "Pilgrim"),""); - - // Don't accept just letters, Numbers or Special Chars, or without ANY letters - assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "newyouA", "Pilgrim"),""); - assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "NEWYOU", "Pilgrim"),""); - assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "newyou", "Pilgrim"),""); - assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "125343", "Pilgrim"),""); - assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "#$@*^#", "Pilgrim"),""); - assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "#$3333", "Pilgrim"),""); + @Test + public void testDefOrgPasswords() { + // Accepts letters and one of (number, Special Char, Upper) + assertEquals(defaultOrg.isValidPassword(authzTransMock, null, "newyou2", "Pilgrim"),""); + assertEquals(defaultOrg.isValidPassword(authzTransMock, null, "newyou!", "Pilgrim"),""); + assertEquals(defaultOrg.isValidPassword(authzTransMock, null, "newyou!", "Pilgrim"),""); + + // Don't accept just letters, Numbers or Special Chars, or without ANY letters + assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "newyouA", "Pilgrim"),""); + assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "NEWYOU", "Pilgrim"),""); + assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "newyou", "Pilgrim"),""); + assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "125343", "Pilgrim"),""); + assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "#$@*^#", "Pilgrim"),""); + assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "#$3333", "Pilgrim"),""); - // Length - assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "w2Yu!", "Pilgrim"),""); - assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "", "Pilgrim"),""); - assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "moreThan20somethingCharacters, even though good", "Pilgrim"),""); + // Length + assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "w2Yu!", "Pilgrim"),""); + assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "", "Pilgrim"),""); + assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "moreThan20somethingCharacters, even though good", "Pilgrim"),""); - // May not contain ID - assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "Pilgrim", "Pilgrim"),""); - assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "Pilgrim1", "Pilgrim"),""); - assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "Pilgrim#", "Pilgrim"),""); - assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "aPilgrim1", "Pilgrim"),""); + // May not contain ID + assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "Pilgrim", "Pilgrim"),""); + assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "Pilgrim1", "Pilgrim"),""); + assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "Pilgrim#", "Pilgrim"),""); + assertNotSame(defaultOrg.isValidPassword(authzTransMock, null, "aPilgrim1", "Pilgrim"),""); - // Solid - assertEquals(defaultOrg.isValidPassword(authzTransMock, null, "new2You!", "Pilgrim"),""); + // Solid + assertEquals(defaultOrg.isValidPassword(authzTransMock, null, "new2You!", "Pilgrim"),""); - - } + + } } |